Classical Interactive report using GET CURSOR technique in SAP ABAP

Develop a material master report which displays list of materials for a range of materials (select-options input).
  1. If the use double clicks on material number, it should display the details of that material in secondary list.
  2. If the use clicks on material type, it should display all the materials of that material type.
REPORT ZCLASSICAL_INTERACTIVE_GETCURSOR LINE-COUNT 10(3NO STANDARD PAGE HEADING.
DATA IT_MARA TYPE TABLE OF MARA,
       WA_MARA 
TYPE MARA,
       IT_MAKT 
TYPE TABLE OF MAKT,
       WA_MAKT 
TYPE MAKT.
DATA FNAM(30), FVAL(50).
SELECT-OPTIONS S_MATNR FOR WA_MARA-MATNR.
INITIALIZATION.
AT SELECTION-SCREEN.
  
PERFORM VALIDATE_INPUT.
START-OF-SELECTION.
  
PERFORM GET_DATA.
  
PERFORM DISPLAY_DATA.
TOP-OF-PAGE.
  
PERFORM DISPLAY_TOPOFPAGE.
AT LINE-SELECTION.
  
PERFORM DISPLAY_SECONDARYLIST.
TOP-OF-PAGE DURING LINE-SELECTION.
  
PERFORM LINE_TOPOFPAGE.
FORM VALIDATE_INPUT .
  
IF S_MATNR IS INITIAL.
    
MESSAGE 'Enter material input' TYPE 'E'.
  
ENDIF.
ENDFORM.                    " VALIDATE_INPUT
FORM GET_DATA .
  
SELECT FROM MARA INTO TABLE IT_MARA WHERE MATNR IN S_MATNR.
ENDFORM.                    " GET_DATA
FORM DISPLAY_DATA .
  
LOOP AT IT_MARA INTO WA_MARA.
    
WRITE:/ WA_MARA-MATNRWA_MARA-MTARTWA_MARA-MATKLWA_MARA-MEINS.
  
ENDLOOP.
ENDFORM.                    " DISPLAY_DATA
FORM DISPLAY_SECONDARYLIST .
  
GET CURSOR FIELD FNAM VALUE FVAL.
  
CONDENSE FNAM.
  
CONDENSE FVAL.
  
IF FNAM 'WA_MARA-MATNR'.
    
SELECT SINGLE FROM MARA INTO WA_MARA WHERE MATNR FVAL .
    
WRITE:/ WA_MARA-MATNRWA_MARA-MBRSHWA_MARA-MTARTWA_MARA-MATKLWA_MARA-MEINSWA_MARA-ERSDAWA_MARA-ERNAM.
  
ELSEIF FNAM 'WA_MARA-MTART'.
    
SELECT FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS WHERE MTART FVAL.
    
LOOP AT IT_MARA INTO WA_MARA.
      
WRITE:/ WA_MARA-MATNRWA_MARA-MTARTWA_MARA-MATKL.
    
ENDLOOP.
  
ENDIF.
ENDFORM.                    " DISPLAY_SECONDARYLIST
FORM DISPLAY_TOPOFPAGE .
  
WRITE:'Material Details' COLOR 3.
ENDFORM.                    " DISPLAY_TOPOFPAGE
FORM LINE_TOPOFPAGE .
  
IF FNAM 'WA_MARA-MATNR'.
    
WRITE:'Material details 'WA_MARA-MATNR COLOR 5.
  
ELSEIF FNAM 'WA_MARA-MTART'.
    
WRITE:'Material with material type 'WA_MARA-MTART COLOR 5.
  
ENDIF.
ENDFORM.                    " LINE_TOPOFPAGE


Input screen

Output (While click on Material number)


Output (Particular Material number details)


 Output (While click on Material type)


Output (Particular Material type full material details)


Share this

Related Posts