DATA: gv_custom_container TYPE REF TO cl_gui_custom_container,
gv_grid TYPE REF TO cl_gui_alv_grid,
gt_itab LIKE TABLE OF vbap WITH HEADER LINE,
gt_fcat TYPE lvc_t_fcat.
IF gv_custom_container IS INITIAL .
CREATE OBJECT gv_custom_container
EXPORTING
container_name = 'CC'.
CREATE OBJECT gv_grid
EXPORTING
i_parent = gv_custom_container.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'VBAP'
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE
gt_itab UP TO 5 ROWS.
CALL METHOD gv_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
CHANGING
it_outtab = gt_itab[]
it_fieldcatalog = gt_fcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Team Lead
Contact : serkurumsal@yandex.com
Social Plugin