DISPLAY ALL FIELDS FROM A TABLE IN ALV:
We use MARA table to select all the fields and then display the output using function module 'REUSE_ALV_GRID_DISPLAY'.
Display all the fields in a table in alv output
*&---------------------------------------------------------------------*
*& Report ZR_ALL_FIELDS_ALV
*&
*&---------------------------------------------------------------------*
REPORT ZR_ALL_FIELDS_ALV.
TABLES: MARA.
DATA : IT_MARA TYPE TABLE OF MARA .
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
START-OF-SELECTION .
PERFORM GET_MARA_DATA.
END-OF-SELECTION .
PERFORM DISP_MARA_ALV .
*&---------------------------------------------------------------------*
*& Form GET_MARA_DATA
*&---------------------------------------------------------------------*
FORM GET_MARA_DATA .
SELECT * FROM MARA
INTO TABLE IT_MARA
WHERE MATNR IN S_MATNR
.
ENDFORM. " GET__MARA_DATA
*&---------------------------------------------------------------------*
*& Form DISP_MARA_ALV
*&---------------------------------------------------------------------*
FORM DISP_MARA_ALV .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_STRUCTURE_NAME = 'MARA'
TABLES
T_OUTTAB = IT_MARA.
ENDFORM. " DISP_MARA_ALV
OUTPUT:
We use MARA table to select all the fields and then display the output using function module 'REUSE_ALV_GRID_DISPLAY'.
Display all the fields in a table in alv output
*&---------------------------------------------------------------------*
*& Report ZR_ALL_FIELDS_ALV
*&
*&---------------------------------------------------------------------*
REPORT ZR_ALL_FIELDS_ALV.
TABLES: MARA.
DATA : IT_MARA TYPE TABLE OF MARA .
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
START-OF-SELECTION .
PERFORM GET_MARA_DATA.
END-OF-SELECTION .
PERFORM DISP_MARA_ALV .
*&---------------------------------------------------------------------*
*& Form GET_MARA_DATA
*&---------------------------------------------------------------------*
FORM GET_MARA_DATA .
SELECT * FROM MARA
INTO TABLE IT_MARA
WHERE MATNR IN S_MATNR
.
ENDFORM. " GET__MARA_DATA
*&---------------------------------------------------------------------*
*& Form DISP_MARA_ALV
*&---------------------------------------------------------------------*
FORM DISP_MARA_ALV .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_STRUCTURE_NAME = 'MARA'
TABLES
T_OUTTAB = IT_MARA.
ENDFORM. " DISP_MARA_ALV
OUTPUT: