Classical Interactive report using HIDE technique in SAP ABAP

In the above requirement we have to get material details for a material type input(Parameter input for MTART field), when ever user double clicks on any record of basic list, it will go to second screen and display list plants for that material, display page header and footer for the report.

REPORT ZCLASSICAL_INTERACTIVE_REPORT_HIDE LINE-COUNT 10(1NO STANDARD PAGE HEADING"leave some pages for footer and hide standard heading
DATA IT_MARA TYPE TABLE OF MARA"mara internal table
       WA_MARA 
TYPE MARA"mara work area
       IT_MARC 
TYPE TABLE OF MARC"marc internal table
       WA_MARC 
TYPE MARC"marc work area
PARAMETERS P_MTART TYPE MARA-MTART"selection screen element input field
INITIALIZATION"initialization event
AT SELECTION-SCREEN"at selection screen event to validate inputs
  
PERFORM VALIDATE_INPUT"Subroutine to validate input
START-OF-SELECTION.
  
PERFORM GET_MATERIAL_DATA.
  
PERFORM DISPLAY_MATERIALS.
TOP-OF-PAGE.
  
PERFORM DISPLAY_HEADER.
END-OF-PAGE.
  
PERFORM DISPLAY_FOOTER.
AT LINE-SELECTION.
  
PERFORM GET_PLANT_DATA.
  
PERFORM DISPLAY_PLANT_DATA.
TOP-OF-PAGE DURING LINE-SELECTION.
  
PERFORM DISPLAY_LIST_HEADER.
FORM VALIDATE_INPUT .
  
IF P_MTART IS INITIAL.
    
MESSAGE 'Please enter input' TYPE 'E'.
  
ENDIF.
ENDFORM.                    " VALIDATE_INPUT
FORM GET_MATERIAL_DATA .
  
SELECT FROM MARA
    
INTO TABLE IT_MARA
    
UP TO 50 ROWS
    
WHERE MTART P_MTART .ENDFORM.                    " GET_MATERIAL_DATA
FORM DISPLAY_MATERIALS .
  
LOOP AT IT_MARA INTO WA_MARA.
    
WRITE:/ WA_MARA-MATNRWA_MARA-MTARTWA_MARA-MATKLWA_MARA-MBRSH.
   
 HIDE WA_MARA"store line details in HIDE area (Basic List)
  
ENDLOOP.
ENDFORM.                    " DISPLAY_MATERIALS
FORM DISPLAY_HEADER .
  
WRITE : 'Material Basic Details' COLOR 5.
ENDFORM.                    " DISPLAY_HEADER
FORM DISPLAY_FOOTER .
  
WRITE'Report Generated at:', SY-DATUM COLOR 1.
ENDFORM.                    " DISPLAY_FOOTER
FORM GET_PLANT_DATA .
  
SELECT FROM MARC
    
INTO TABLE IT_MARC
    
WHERE MATNR WA_MARA-MATNR.
ENDFORM.                    " GET_PLANT_DATA
FORM DISPLAY_PLANT_DATA .
  
LOOP AT IT_MARC INTO WA_MARC.
    
WRITE :/ WA_MARC-MATNRWA_MARC-WERKS"Display secondary list
  
ENDLOOP.
ENDFORM.                    " DISPLAY_PLANT_DATA
FORM DISPLAY_LIST_HEADER .
  
WRITE'List of Plants for material:', WA_MARA-MATNR COLOR 6.
ENDFORM.                    " DISPLAY_LIST_HEADER

Input Screen


Output (Basic List)



Output (Secondary List)




Share this

Related Posts