Classical report example in ABAP

It's nothing but to display the entire information in a single list.

INITIALIZATION:  It's an event which is triggered before displaying the selection-screen.

    ADV: - it's used to provide the default values to the selection-screen.

AT SELECTION-SCREEN: It's an event which is triggered after providing the input to the screen & before leaving the selection-screen.

    ADV: - This is used to validate the given input.

START-OF-SELECTION: It's an event which is triggered after leaving the selection-screen & before display the output.

ADV: - This is used to fetch the data from data base & place into internal table.

END-OF-SELECTION:  It's an event which is triggered after completion of the logic.

    ADV: - This is used to display the output.

TOP-OF-PAGE:  It's an event which is triggered at the top of each page.

    ADV: - It's used to display the header information.

END-OF-PAGE:  It's an event which is triggered at the end of each page.

    ADV: - It's used to display the footer information.

Step 1: Goto SE38.

Step 2: Give report name and click on create.

Step 3: Give description and select type.

Step 4: Write code.

*&---------------------------------------------------------------------*
*& Report ZR_AB_CLASSICAL_REPORT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zr_ab_classical_report.
DATAl_banfn  TYPE banfn,
      l_header TYPE string,
      l_footer TYPE string.
SELECT-OPTIONS s_banfn FOR l_banfn.

INITIALIZATION.
  l_header 'PR DETAILS'.
  l_footer 'Thank you'.

AT SELECTION-SCREEN.
  IF s_banfn IS INITIAL.
    MESSAGE 'Please enter PR' TYPE 'E' DISPLAY LIKE 'E'.
  ENDIF.

* Event: START-OF-SELECTION
START-OF-SELECTION.
  SELECT banfn,
          bnfpo,
          bsart,
          txz01,
          matnr,
          matkl
  FROM eban
  INTO TABLE @DATA(l_t_eban)
  WHERE banfn IN @s_banfn.

END-OF-SELECTION.
  LOOP AT l_t_eban INTO DATA(l_r_eban).
    WRITE / l_r_eban-banfn,l_r_eban-bnfpo,
              l_r_eban-bsart,l_r_eban-matnr,
              l_r_eban-matkl,l_r_eban-txz01.
  ENDLOOP.

TOP-OF-PAGE.
  WRITE/ l_header  COLOR 1.

END-OF-PAGE.
  WRITEl_footer COLOR 2.

Testing

Case 1: No input in selection screen.


Case 2: Give input in selection screen.

******************************Thank You***************************

Comments

Popular posts from this blog

New syntax for append- VALUE (new syntax 7.4+) in ABAP

Read statement new syntax in ABAP. (7.4+).

Concatenation new syntax( 7.4+ ).