WHEN 'EMPLOYEE_DETAILS'.
SELECT * FROM ZPROJECT_EMP INTO TABLE EMP_DETAILS.
REFRESH IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EMP_ID'.
WA_FIELDCAT-SELTEXT_M = 'EMP_ID'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EMP_NAME'.
WA_FIELDCAT-SELTEXT_M = 'EMP_NAME'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'DEPT_NO'.
WA_FIELDCAT-SELTEXT_M = 'DEPARTMENT NO.'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'DEPT_NAME'.
WA_FIELDCAT-SELTEXT_M = 'DEPARTMENT NAME'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'JOINING_DATE'.
WA_FIELDCAT-SELTEXT_M = 'JOINING DATE'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EMP_PHONE'.
WA_FIELDCAT-SELTEXT_M = 'PHONE NO.'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ADDRESS'.
WA_FIELDCAT-SELTEXT_M = 'EMP-ADDRESS'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = EMP_DETAILS.
WHEN 'PROJECT_STATUS'.
SELECT * FROM ZPROJECT_DETAILS INTO TABLE PROJECT_DETAILS.
REFRESH IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EMP_ID'.
WA_FIELDCAT-SELTEXT_M = 'EMP_ID'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'DEPT_NAME'.
WA_FIELDCAT-SELTEXT_M = 'DEPT_NAME'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'PROJECT_NAME'.
WA_FIELDCAT-SELTEXT_M = 'PROJECT_NAME'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'PROJECT_ID'.
WA_FIELDCAT-SELTEXT_M = 'PROJECT_ID'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'PROJECT_START_DATE'.
WA_FIELDCAT-SELTEXT_M = 'PROJECT_START_DATE'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'PROJECT_END_DATE'.
WA_FIELDCAT-SELTEXT_M = 'PROJECT_END_DATE'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'PROJECT_STATUS'.
WA_FIELDCAT-SELTEXT_M = 'PROJECT_STATUS'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = PROJECT_DETAILS.
ENDCASE.
ENDMODULE. " USER_COMMAND_0135 INPUT
Output:
SELECT * FROM ZPROJECT_EMP INTO TABLE EMP_DETAILS.
REFRESH IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EMP_ID'.
WA_FIELDCAT-SELTEXT_M = 'EMP_ID'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EMP_NAME'.
WA_FIELDCAT-SELTEXT_M = 'EMP_NAME'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'DEPT_NO'.
WA_FIELDCAT-SELTEXT_M = 'DEPARTMENT NO.'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'DEPT_NAME'.
WA_FIELDCAT-SELTEXT_M = 'DEPARTMENT NAME'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'JOINING_DATE'.
WA_FIELDCAT-SELTEXT_M = 'JOINING DATE'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EMP_PHONE'.
WA_FIELDCAT-SELTEXT_M = 'PHONE NO.'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ADDRESS'.
WA_FIELDCAT-SELTEXT_M = 'EMP-ADDRESS'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = EMP_DETAILS.
WHEN 'PROJECT_STATUS'.
SELECT * FROM ZPROJECT_DETAILS INTO TABLE PROJECT_DETAILS.
REFRESH IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EMP_ID'.
WA_FIELDCAT-SELTEXT_M = 'EMP_ID'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'DEPT_NAME'.
WA_FIELDCAT-SELTEXT_M = 'DEPT_NAME'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'PROJECT_NAME'.
WA_FIELDCAT-SELTEXT_M = 'PROJECT_NAME'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'PROJECT_ID'.
WA_FIELDCAT-SELTEXT_M = 'PROJECT_ID'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'PROJECT_START_DATE'.
WA_FIELDCAT-SELTEXT_M = 'PROJECT_START_DATE'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'PROJECT_END_DATE'.
WA_FIELDCAT-SELTEXT_M = 'PROJECT_END_DATE'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'PROJECT_STATUS'.
WA_FIELDCAT-SELTEXT_M = 'PROJECT_STATUS'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = PROJECT_DETAILS.
ENDCASE.
ENDMODULE. " USER_COMMAND_0135 INPUT
Output:
list of employees
project details of employee