Summary -

In this topic, we described about the below sections -

A report is a data presentation made with the specific intention of conveying information in an organized structure. Many systems enable to design and generate the reports in easily understandable format. ABAP application supports report programming to create reports.

Report programs specially used when dealing with enormous amounts of data needs to be displayed in structured format. ABAP supports downloading the reports to the system in other format which can distribute outside of the application.

SAP provides some standard reports functions apart from the regular report writing statements. Reports can be used when data from many tables must be selected and processed or data demand a special format or report must be downloaded from SAP to an Excel sheet.

Report programs are always executable programs and every report program corresponds to an application. Report Programming is an Event-driven programming.


We can use various events and each event has its own importance during the report creation. Each event is associated to a specific action and below table lists the events –

Event Description
LOAD-OF-PROGRAMTriggers the associated event after program loading of type 1, M, F, or S.
INITIALIZATONEvent executed just before the display of selection screen.
Initialization of all the values.
Specifies the values that are initialized or the values assigned by default on the selection screen.
The values can be assigned during the runtime also.
AT SELECTION-SCREENEvent triggered after the user input processing on the selection screen.
This event verifies the user input prior to the execution of a program and after the input.
The selection screen remains in the active mode after processing the user input.
START-OF-SELECTIONEvent triggered after the processing of the selection screen is completed.
In this event, the values are selected from tables.
END-OF-SELECTIONEvent triggered after the last statement in the START-OF-SELECTON event is executed.
This statement writes the data to the screen which was selected from the tables.
TOP-OF-PAGEEvent triggered by the first WRITE statement.
It displays the data on a new page.
END-OF-PAGEEvent triggered to display the text at the end of a page in a report.

Interactive Reports -

In simple, Interactive reports interacts with the user. A classical non-interactive report consists only a program that creates a single list.

Instead of one extensive and detailed list, we create basic list by positioning the cursor and entering commands with interactive reporting. Interactive reporting reduces information retrieval to the data required.

Uses -

  • The user can actively control data retrieval and display during the session.
  • Instead of an extensive and detailed list, you create a basic list with condensed information from which the user can switch to detailed displays by positioning the cursor and entering commands.
  • The detailed information appears in secondary lists.

Interactive Report Programming -

Interactive Report Programming used to actively control the data retrieval and display of data. Interactive report used to create a detailed list and the detailed data is written on a secondary list.

The secondary list is an interactive and either completely overlay the first screen or one can display it in a new screen. Some commands used for interactive report programming -

Hotspot -

Hotspot can change the mouse symbol to indexed hand symbol when the cursor hover on the text. The hotspot can be achieved using the FORMAT statement -

Format Hotspot On (Off).
Hide -

Hide command helps to store the field names based on selection from the screen. When a row is selected the values get automatically filled in the variables for further use.

It is written immediately after the WRITE statement for the specific field -

Hide <field-name>.


Example -

Simple example of implementing report programming in application program.


Code -

*&---------------------------------------------------------------------*
*& Report  Z_REPORT_PROG
*&---------------------------------------------------------------------*
*& Written by TutorialsCampus
*&---------------------------------------------------------------------*

REPORT  Z_REPORT_PROG
LINE-SIZE 120
LINE-COUNT 25(3)
NO STANDARD PAGE HEADING.

* Specifying table name
TABLES ZTC_TPRODUCT.

* Declaring cursor and work area
DATA: WA  LIKE ZTC_TPRODUCT,
      it  TYPE TABLE OF ZTC_TPRODUCT.

* Report primary and secondary heading
TOP-OF-PAGE.
WRITE:/40 'PRODUCT INFORMATION REPORT' COLOR 4.
ULINE.
WRITE:/ 'PRODUCT ID' COLOR 1,30 'PRODUCT NAME' COLOR 2,100 
	'PRODUCT AMOUNT' COLOR 3.
ULINE.
END-OF-PAGE.

START-OF-SELECTION.
* Retrieving data from the table with product ID
* and writing the table data to internal table
SELECT *
  INTO WA
  FROM ZTC_TPRODUCT ORDER BY PRODUCTID.
  INSERT WA INTO TABLE it.
ENDSELECT.

* Writing the table data to report.
LOOP AT it INTO wa.
  WRITE:/  WA-PRODUCTID,30 WA-PRODUCT,100 WA-PRODUCT_PRICE.
ENDLOOP.

ULINE.

* Writing report footer
WRITE:/ 'REPORT HAS BEEN CREATED' COLOR 5.

ULINE.
SKIP.

Output -

Report Programming Example Output