SAPфорум.RU
https://www.sapboard.ru/forum/

Grid: вывод параметра LVC_S_FCAT в зависимости от значений в конкретной строке
https://www.sapboard.ru/forum/viewtopic.php?f=13&t=97231
Страница 1 из 1

Автор:  Igor_Beruk [ Пн, янв 14 2019, 14:22 ]
Заголовок сообщения:  Grid: вывод параметра LVC_S_FCAT в зависимости от значений в конкретной строке

Добрый день,форумчане! Подскажите как решить такой момент. Есть грид. Есть столбец типа quan.
Необходимо в зависимости от разных ситуаций,выводить в гриде его и как нулем и как пустым.
По сути настройка параметра LVC_S_FCAT должна меняться для ячейки в зависимости от разных ситуациий-
как это можно реализовать?

Автор:  John Doe [ Пн, янв 14 2019, 16:02 ]
Заголовок сообщения:  Re: Grid: вывод параметра LVC_S_FCAT в зависимости от значений в конкретной строке

Нужно в таблице данных и каталоге полей иметь технический ссылочный столбец с ЕИ для Ваших QUAN. Каталог полей объявить как-то так...
Code:
fieldcat-fieldname = 'WRBTR'.
fieldcat-datatype = 'CURR'.
fieldcat-ref_fieldname = 'WAERS'.
append fieldcat.

fieldcat-fieldname = 'WAERS'.
fieldcat-datatype = 'CUCY'.
fieldcat-tech = 'X'.
append fieldcat.

Соответственно будет следующее поведение ALV:
1. Есть значение WRBTR и ЕИ WAERS - выводится числовое значение, включая 0.
2. Есть значения WRBTR и нет ЕИ WAERS - должно выводиться SPACE.

Насчет суммирования нужно смотреть, не помню.

Автор:  Igor_Beruk [ Пн, янв 14 2019, 17:17 ]
Заголовок сообщения:  Re: Grid: вывод параметра LVC_S_FCAT в зависимости от значений в конкретной строке

Не совсем понял.. Есть у меня мое поле 'MNDVTN' в таблице типа QUAN. Ссылается оно на поле MEINS которое типа UNIT.
Описываю:
WHEN 'MNDVTN'
<ls_fieldcat>-datatype = 'QUAN'.
<ls_fieldcat>-REF_FIELD = 'MEINS'.
WHEN 'MEINS'
<ls_fieldcat>-datatype = 'UNIT'.
<ls_fieldcat>-tech = 'X'.
?

Автор:  John Doe [ Вт, янв 15 2019, 09:16 ]
Заголовок сообщения:  Re: Grid: вывод параметра LVC_S_FCAT в зависимости от значений в конкретной строке

Немного неправильно Вас направил, чуть другое поле нужно было. Понадеялся на документацию к ФМ REUSE_ALV_GRID_DISPLAY
Цитата:
Reference to fields with currency units/units of measure
Each amount or quantity field of the internal output table whose decimal places are to be displayed with the proper unit in the list output, must comply with the following conventions:◦The field is of data type QUAN or CURR (internal type P).
(Physically, the field must actually belong to this data type. Overriding the physical data type with parameter FIELDCAT-DATATYPE has no effect.)
◦There is one field in the internal output table that contains the relevant unit.
◦There is also an entry for the unit field in the field catalog.
(If the unit should not be displayed as a column in the list and the user should not be able to show the unit interactively, for example, because the unit is always unique and therefore explicitly output by the caller in the list header, then you can assign parameter FIELDCAT-TECH = 'X' to the field catalog entry for the unit field.
If a value field has a reference to a unit, this has the following effects when the list is output:◦The decimal places are displayed with the proper unit.
◦An initial value field with reference to a non-initial unit is displayed as '0' (provided that FIELDCAT-NO_ZERO is initial). If unit-specific totals are calculated for this value field, the unit is considered in the analysis of whether homogeneous units exist.
◦An initial value field with reference to an initial unit is displayed as SPACE. If unit-specific totals are calculated for this value field, the unit SPACE has no effect on the homogeneity of the unit if the value field is initial.
◦For non-initial value fields with initial unit, the unit SPACE is considered as a unit when unit-specific totals are calculated.




Работает со старым REUSE
Code:
TYPE-POOLS: slis.

DATA: BEGIN OF itab OCCURS 0,
        menge      TYPE menge_d,
        meins      TYPE bstme,
        tech_meins TYPE bstme,
      END OF itab.

DATA: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

START-OF-SELECTION.
  itab-menge = 10.
  itab-meins = 'ШТ'.
  itab-tech_meins = 'ШТ'.
  APPEND itab.

  CLEAR itab-menge.
  itab-meins = 'ШТ'.
  itab-tech_meins = space.
  APPEND itab.

  itab-menge = 0.
  itab-meins = 'ШТ'.
  itab-tech_meins = 'ШТ'.
  APPEND itab.


  CLEAR fieldcat.
  fieldcat-fieldname = 'MENGE'.
  fieldcat-seltext_m = 'Кол-во'.
  fieldcat-qfieldname = 'TECH_MEINS'.
  APPEND fieldcat.

  CLEAR fieldcat.
  fieldcat-fieldname = 'MEINS'.
  fieldcat-seltext_m = 'ЕИ'.
  APPEND fieldcat.

  CLEAR fieldcat.
  fieldcat-fieldname = 'TECH_MEINS'.
  fieldcat-seltext_m = 'ЕИ'.
  fieldcat-tech = 'X'.
  APPEND fieldcat.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      it_fieldcat = fieldcat[]
    TABLES
      t_outtab    = itab.

Автор:  Igor_Beruk [ Вт, янв 15 2019, 10:11 ]
Заголовок сообщения:  Re: Grid: вывод параметра LVC_S_FCAT в зависимости от значений в конкретной строке

Спасибо-работает!

Страница 1 из 1 Часовой пояс: UTC + 3 часа
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/