CHECK BOX POP-UP AS INPUT HELP FOR ALV REPORT

CHECK BOX POP-UP AS INPUT HELP FOR ALV REPORT :


Provide check box pop-up help for input and then based on check box selection display output.

*&---------------------------------------------------------------------*
*& Report  ZR_CHECKBOX_AS_IN_HELP_ALV
*&
*&---------------------------------------------------------------------*
REPORT ZR_CHECKBOX_AS_IN_HELP_ALV.
TYPE-POOLSSLIS.
TABLEST134.
TYPESBEGIN OF TY_T134,
       
CHECK TYPE CHAR1,
       MTART 
TYPE T134-MTART,
       
END OF TY_T134.
DATA : IT_T134 TYPE TABLE OF TY_T134,
       WA_T134 
TYPE TY_T134.
DATAIT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FCAT 
LIKE LINE OF IT_FCAT.
DATAIT_MARA TYPE TABLE OF MARA,
      WA_MARA 
TYPE MARA.


SELECT-OPTIONSS_MTART FOR T134-MTART NO INTERVALS.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MTART-LOW.
  

  WA_FCAT-COL_POS 1.
  WA_FCAT
-FIELDNAME 'CHECK'.
  WA_FCAT
-SELTEXT_M 'Select'.
  WA_FCAT
-TABNAME 'IT_T134'.
  
APPEND WA_FCAT TO IT_FCAT.
  
CLEAR WA_FCAT.
  

  WA_FCAT-COL_POS 2.
  WA_FCAT
-FIELDNAME 'MTART'.
  WA_FCAT
-SELTEXT_M 'Material Type'.
  WA_FCAT
-TABNAME 'IT_T134'.
  
APPEND WA_FCAT TO IT_FCAT.
  
CLEAR WA_FCAT.
  

SELECT MTART 
       FROM T134 
       INTO CORRESPONDING FIELDS OF TABLE IT_T134.
  

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
    
EXPORTING
      I_TITLE              
'Select Material Type'
      I_CHECKBOX_FIELDNAME 
'CHECK'
      I_TABNAME            
'IT_T134'
      IT_FIELDCAT          
IT_FCAT
      I_CALLBACK_PROGRAM   
SY-REPID
    
TABLES
      T_OUTTAB             
IT_T134
*   EXCEPTIONS
*     PROGRAM_ERROR        = 1
*     OTHERS               = 2
    
.
  
IF SY-SUBRC <> 0.
* Implement suitable error handling here
  
ENDIF.

  
LOOP AT IT_T134 INTO WA_T134 WHERE CHECK 'X'.
    S_MTART
-LOW WA_T134-MTART.
    S_MTART
-OPTION 'EQ'.
    S_MTART
-SIGN 'I'.
    
APPEND S_MTART.
  
ENDLOOP.

START-OF-SELECTION.
  
SELECT FROM MARA 
           INTO TABLE IT_MARA 
           UP TO 50 ROWS
           
WHERE MTART IN S_MTART .


  
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    
EXPORTING
      I_CALLBACK_PROGRAM 
SY-REPID
      I_STRUCTURE_NAME   
'MARA'
    
TABLES
      T_OUTTAB           
IT_MARA
*   EXCEPTIONS
*     PROGRAM_ERROR      = 1
*     OTHERS             = 2
    
.
  
IF SY-SUBRC <> 0.
* Implement suitable error handling here
  
ENDIF.

OUTPUT: