SAP ABAP Classical Reports

SAP ABAP Classical Reports are the most basic ABAP reports that contain both selection screen and an output screen. Classical reports are executed based on events, and not executed on a line-by-line basis. Classical reports are non-interactive reports. Basically, they consist of one program that creates a single list.

The following SAP training tutorials guides various events in classical reports, provide the syntax for each and then present a simple programming example of a Classical Report.

Events in Classical Reports.

The following are the list of Events in Classical Reports.

1. Load-of-program: The Load-of-program event  loads the program into memory for execution. Always, Load-of-program is the first event in execution sequence.

2. Initialization: Initialization is an event that is used for initialize variables, screen values and other default actions.

3. At Selection-Screen output: One of the selection screen events is used to manipulate dynamic selection-screen changes.

4. At Selection-Screen on field: It is used to validates the screen input parameter.

5. At Selection-Screen on value request: This selection screen event allows for a value help or field help  for an input field.

6. At Selection-Screen on help request: This selection screen event enables function key F1 help for a input field.

7. At Selection-Screen: Selection screen validates various input fields.

8. Start-of-Selection: This is the default event in any ABAP program and is activated whether we use it explicitly or not .

9. End-of-Selection: This event signals that event of what has been initiated by the start-of-selection event.

10. Top-of-Page: This event is used to print the same heading for all pages.

11. End-of-Page: This event is used to print the same footer for all pages.

ABAP Classical Reports Tutorial with Programming Example

The below simple programming example shows how an typical Classical Report is written:

 

REPORT  ZSIMPLE_DBPRG.

TABLES MARA.

DATA : WA_MARA LIKE MARA.
START-OF-SELECTION.

**FIRST MARA IS DATABASE TABLE SECOND MARA IS DEFAULT STRUCTURE

*SELECT SINGLE * FROM MARA INTO MARA.

*  SELECT SINGLE * FROM MARA INTO MARA WHERE matnr EQ ‘000000000000000023’.

SELECT SINGLE * FROM MARA INTO MARA WHERE matnr EQ ‘000000000000000023’.

IF SY-SUBRC EQ 0.

WRITE :/10 ‘SELECT SUCCESSFUL’.

move-CORRESPONDING mara to wa_mara.

ELSE.

WRITE :/10 ‘SELECT NOT SUCCESSFUL’.

ENDIF.

END-OF-SELECTION.

if WA_mara is not INITIAL.

WRITE /10 : WA_MARA-MATNR,  “MATERIAL NUMBER

WA_MARA-MTART,  “MATERIAL TYPE

WA_MARA-MBRSH,  “INDUSTRY SECTOR

WA_MARA-MATKL.  “MATERIAL ID

else.

write :/10 ‘wa_mara is empty…’.

endif.

Continue to read SAP ABAP tutorials and learn SAP ABAP programming from basics.