*&

---------------------------------------------------------------------*
*& Report Z_ALV_TEST_3
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT Z_ALV_TEST_3.
DATA: ITAB LIKE ZALV OCCURS 0 WITH HEADER LINE.

PARAMETERS: P_EBELN LIKE EKPO-EBELN.

SELECT MANDT
EBELN
EBELP
LOEKZ
STATU
AEDAT
TXZ01
MATNR
EMATN
BUKRS
WERKS
LGORT
FROM EKPO
INTO TABLE ITAB
WHERE EBELN = P_EBELN.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'SY-REPID'
I_STRUCTURE_NAME = 'ZALV'
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.