Display ALV report in popup window, capture the selected value based on user action
To display ALV in popup we use function module REUSE_ALV_POPUP_TO_SELECT.
REPORT ZSAPN_ALV_POPUP. TYPE-POOLS: SLIS. DATA: IT_OUTTAB TYPE T134 OCCURS 0, WA_PRIVATE TYPE SLIS_DATA_CALLER_EXIT, WA_SELFIELD TYPE SLIS_SELFIELD. DATA : LT_EXCL TYPE SLIS_T_EXTAB, LS_EXCL TYPE SLIS_EXTAB, LV_EXIT TYPE C. START-OF-SELECTION. SELECT * FROM T134 INTO TABLE IT_OUTTAB. CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT' EXPORTING I_TITLE = 'Select a Material Type' * I_SELECTION = 'X' I_ZEBRA = 'X' * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_CHECKBOX_FIELDNAME = * I_LINEMARK_FIELDNAME = * I_SCROLL_TO_SEL_LINE = 'X' I_TABNAME = 'T134' I_STRUCTURE_NAME = 'T134' * IT_FIELDCAT = 'LT_FCAT' * IT_EXCLUDING = * I_CALLBACK_PROGRAM = * I_CALLBACK_USER_COMMAND = IS_PRIVATE = WA_PRIVATE IMPORTING ES_SELFIELD = WA_SELFIELD E_EXIT = LV_EXIT TABLES T_OUTTAB = IT_OUTTAB EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2. IF SY-SUBRC NE 0. **HANDLE SOMETHING ENDIF. IF LV_EXIT = 'X'. "user clicks exit/cancel button ELSE. WRITE: / WA_SELFIELD-TABNAME, WA_SELFIELD-TABINDEX, WA_SELFIELD-SEL_TAB_FIELD, WA_SELFIELD-VALUE. "selected value ENDIF.