The Simple ABAP Report uses Internal tables and Work Areas


SAP ABAP report using internal tables and work areas, write statement in SAP ABAP


Getting data from a data base table and display data in the form of report using SAP ABAP.

In ABAP write statement is used to print output and : is chain statement ( Print multiple records ).

Display MARA data

DATA : IT_MARA TYPE TABLE OF MARA . "INTERNAL TABLE FOR MARA TABLE

DATA : WA_MARA TYPE MARA. "WORK AREA FOR MARA

SELECT * FROM MARA INTO TABLE IT_MARA. " GET MARA DATA
LOOP AT IT_MARA INTO WA_MARA.
WRITE :/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MEINS, WA_MARA-MBRSH. "Display required fields
ENDLOOP.

Display MARA data using user defined internal table

**TYPES is a statement which is used to declare a user defined internal table with specific fields
TYPES : BEGIN OF TY_MARA,
        MATNR TYPE MARA-MATNR,
        MTART TYPE MARA-MTART,
        MEINS TYPE MARA-MEINS,
        MBRSH TYPE MARA-MBRSH,
        END OF TY_MARA.
DATA : IT_MARA TYPE TABLE OF TY_MARA . "INTERNAL TABLE FOR ABOVE USER DEFINED TYPES TABLE

DATA : WA_MARA TYPE TY_MARA. "WORK AREA FOR ABOVE USER DEFINED TABLE

SELECT MATNR MTART MEINS MBRSH FROM MARA INTO TABLE IT_MARA. " GET MARA DATA
LOOP AT IT_MARA INTO WA_MARA.
  WRITE :/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MEINS, WA_MARA-MBRSH. "Display required fields
ENDLOOP.

Display MARA data using user defined internal table ABAP 7.4

SELECT matnr, mtart, meins, mbrsh FROM mara INTO TABLE @DATA(it_mara). " GET MARA DATA
LOOP AT it_mara INTO DATA(wa_mara).
  WRITE :/ wa_mara-matnr, wa_mara-mtart, wa_mara-meins, wa_mara-mbrsh. "Display required fields
ENDLOOP.


Was this lesson helpful to you? Yes No 95 People out of 96 think this lesson helpful

Lesson Navigation

←Previous Chapter
Next Chapter →