REPORT ZALV_SAMPLE_03.
*---type pools
TYPE-POOLS: slis.
*---internal tables
DATA: BEGIN OF it_flight OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
END OF it_flight,
*--internal tables for alv
it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fcat LIKE LINE OF it_fieldcat,
layout TYPE slis_layout_alv,
it_sort type slis_t_sortinfo_alv,
wa_sort like line of it_sort.
*---start-of-selection .
START-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_FLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
*----get data
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_flight
UP TO 20 ROWS.
.
wa_fcat-do_sum = 'X'.
MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
WHERE fieldname = 'SEATSOCC' .
wa_sort-fieldname = 'CARRID'.
wa_sort-group = 'UL'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
wa_sort-fieldname = 'CONNID'.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
it_fieldcat = it_fieldcat
it_sort = it_sort
TABLES
t_outtab = it_flight
EXCEPTIONS
program_error = 1.
实现分组小计
最新推荐文章于 2020-10-24 22:02:36 发布
本文介绍了一个使用ABAP编程语言创建ALV(Application List Viewer)报表的具体示例。示例中定义了内部表it_flight用于存储航班信息,并通过调用REUSE_ALV_FIELDCATALOG_MERGE和REUSE_ALV_LIST_DISPLAY函数来设置字段目录并展示数据。报表按航空公司标识进行了分组,并对座位占用数进行求和。
摘要由CSDN通过智能技术生成