点击此处---> 群内免费提供SAP练习系统(在群公告中)
加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)
REPORT YALVTREE.
DATA GT_FIELDCATALOG TYPE LVC_T_FCAT.
DATA LS_FIELDCATALOG TYPE LVC_S_FCAT.
*THE FOLLOWING FUNCTION MODULE GENERATES A FIELDCATALOG ACCORDING
* to a given structure.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
CHANGING
CT_FIELDCAT = GT_FIELDCATALOG.
* Now change the fieldcatalog to hide fields and to determine
* some initial calculations for chosen fields.
LOOP AT GT_FIELDCATALOG INTO LS_FIELDCATALOG.
CASE LS_FIELDCATALOG-FIELDNAME.
* hide columns which are already displayed in our tree
WHEN 'CARRID' OR 'FLDATE'.
LS_FIELDCATALOG-NO_OUT = 'X'.
* Do some initial calculations:
* ALV Tree uses the field 'do_sum' to declare that a function
* for the corresponding column shall be calculated.
* Use 'h_ftype' to set the function type (MAX, MIN, SUM, AVG).
WHEN 'PRICE'.
LS_FIELDCATALOG-DO_SUM = 'X'.
LS_FIELDCATALOG-H_FTYPE = 'MAX'.
WHEN 'SEATSMAX'.
LS_FIELDCATALOG-DO_SUM = 'X'.
LS_FIELDCATALOG-H_FTYPE = 'SUM'.
WHEN 'SEATSOCC'.
LS_FIELDCATALOG-DO_SUM = 'X'.
LS_FIELDCATALOG-H_FTYPE = 'AVG'.
ENDCASE.
MODIFY GT_FIELDCATALOG FROM LS_FIELDCATALOG.
ENDLOOP.
* The fieldcatalog is provided in form 'init_tree' using method
* set_table_for_first_display.