Saturday, October 6, 2018

Interactive Report using GET CURSOR technique

*&---------------------------------------------------------------------*
*& Report  ZINTDEMO
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZINTDEMO.
DATA IT_MARA TYPE TABLE OF MARA,
       WA_MARA TYPE MARA,
       IT_MAKT TYPE TABLE OF MAKT,
       WA_MAKT TYPE MAKT.
DATA FNAM(20)FVAL(30).

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_SECONDLIST.

TOP-OF-PAGE DURING LINE-SELECTION.
  PERFORM LINE_TOPOFPAGE.
FORM VALIDATE_INPUT .
  IF S_MATNR IS INITIAL.
    MESSAGE 'Enter material' TYPE 'E'.
  ENDIF.
ENDFORM.
FORM GET_DATA .
  SELECT FROM MARA INTO TABLE IT_MARA WHERE MATNR IN S_MATNR.
ENDFORM.
FORM DISPLAY_DATA .
  LOOP AT IT_MARA INTO WA_MARA.
    WRITE:/ WA_MARA-MATNRWA_MARA-MTARTWA_MARA-MATKLWA_MARA-MEINS.
  ENDLOOP.
ENDFORM.
FORM DISPLAY_SECONDLIST.

  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.

  ENDIF.

ENDFORM.
FORM DISPLAY_TOPOFPAGE .
  WRITE:'Material Details' COLOR 4.
 ULINE .
ENDFORM.
FORM LINE_TOPOFPAGE .
  IF FNAM 'WA_MARA-MATNR'.
    WRITE:'Material details 'WA_MARA-MATNR COLOR 5.

ULINE.

  ENDIF.
ENDFORM.


 
 if you click on the material number then you will get inside another detail list .