REPORT ZCUSTOMER_REPORT_ALV.
TYPE-POOLS: SLIS.
TABLES: KNA1.
TYPES: BEGIN OF ST_KNA1,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1_GP,
ORT01 TYPE ORT01_GP,
END OF ST_KNA1.
DATA: IT_KNA1 TYPE STANDARD TABLE OF ST_KNA1,
W_KNA1 TYPE ST_KNA1,
IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT TYPE SLIS_FIELDCAT_ALV.
SELECT-OPTIONS: S_KUNNR FOR KNA1-KUNNR.
W_FCAT-COL_POS = '1'.
W_FCAT-FIELDNAME = 'KUNNR'.
W_FCAT-SELTEXT_M = 'Cust Number'.
append W_FCAT TO IT_FCAT.
W_FCAT-COL_POS = '2'.
W_FCAT-FIELDNAME = 'NAME1'.
W_FCAT-SELTEXT_M = 'Cust Name'.
append W_FCAT TO IT_FCAT.
W_FCAT-COL_POS = '3'.
W_FCAT-FIELDNAME = 'ORT01'.
W_FCAT-SELTEXT_M = 'City'.
append W_FCAT TO IT_FCAT.
SELECT KUNNR
NAME1
ORT01 FROM KNA1
INTO TABLE IT_KNA1
WHERE KUNNR IN S_KUNNR.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = it_fcat
TABLES
t_outtab = it_kna1
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Team Lead
Contact : serkurumsal@yandex.com
Social Plugin