Abap İnternal Tablo Örneği
&———————————————————————
& Report ZMK_ALV_TEST
*&———————————————————————
&
*&———————————————————————
REPORT ZMK_ALV_TEST.
TABLES:vbak.
TYPE-POOLS: slis. ” SLIS contains all the ALV data types
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
SELECTION-SCREEN : END OF BLOCK blk1.
*&———————————————————————
& Data Declaration
*&———————————————————————
DATA: it_stest TYPE TABLE OF zmk_s_test.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
&———————————————————————
& START-OF-SELECTION
*&———————————————————————
START-OF-SELECTION.
*Fetch data from the database
*SELECT KUNNR, NAME1, NAME2, TELF1,ORT01, ADRNR FROM KNA1 INTO CORRESPONDING FIELDS OF TABLE @it_kna1.
SELECT t2~VBELN, t2~ERDAT, t2~ERNAM, t1~POSNR, t1~MATNR, t1~MATKL
FROM VBAP as t1
INNER JOIN VBAK as t2 ON t1~VBELN = t2~VBELN
WHERE t2~vbeln in @s_vbeln
INTO CORRESPONDING FIELDS OF TABLE @it_stest.
“*Build field catalog
wa_fieldcat-fieldname = ‘VBELN’. ” Fieldname in the data table
wa_fieldcat-seltext_m = ‘Satış Belgesi’. ” Column description in the output
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = ‘ERDAT’.
wa_fieldcat-seltext_m = ‘Kayıt Tarihi’.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = ‘ERNAM’.
wa_fieldcat-seltext_m = ‘Sorumlu Adı’.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = ‘POSNR’.
wa_fieldcat-seltext_m = ‘Satış Belgesi Kalemi’.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = ‘MATNR’.
wa_fieldcat-seltext_m = ‘Malzeme Numarası’.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = ‘MATKL’.
wa_fieldcat-seltext_m = ‘Mal Grubu’.
APPEND wa_fieldcat TO it_fieldcat.
*Pass data and field catalog to ALV function module to display ALV list
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTING
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_stest
EXCEPTIONS
program_error = 1
OTHERS = 2.