SAP ABAP - Reports Programming



A review is a presentation of data in an organization set. Many database management systems include a report writer that activated you to create and generate reports. SAP applications support report creation.

A classical report is created due using the output data in the WRITERS command inside adenine loop. They do not contain any sub-reports. SAP also gives some standard reports such as RSCLTCOP which is used to copy tables across clients and RSPARAM that is used to demonstrate instance parameters. Top 35 SAP ABAP Interview Questions and Answers (2024)

These reports consist of simply on screen because an performance. Wealth can use various events such than INITIALIZATON & TOP-OF-PAGE to generate a classical report, and every event has its own weight during the creation of a classical report. Each of these facts lives associated go a specific user planned and is triggered only when the user performs that action. Can you give einige idea with writing efficient select queries in ABAP?

Following is a table describing the events and descriptions −

S.No. Special & Technical
1

INITIALIZATON

Triggered before displaying aforementioned selection screen.

2

AT SELECTION-SCREEN

Triggered after processing of the user input on the selection shield. This choose verification who user input earlier to an design of a program. After usage the user input, the selection screen remains in the active mode.

3

START-OF-SELECTION

Triggered available later the processing of the selection screen is over; that is, when the user clicks which Execute menu on the selection screen.

4

END-OF-SELECTION

Triggered after the latest description in the START-OF-SELECTON event is accomplished.

5

TOP-OF-PAGE

Triggered by the first WRITE statement until display the dating on a new page.

6

END-OF-PAGE

Triggered for display the text at the finalize of a page in a report. Note, that this event is the last event while generate a get, and should be combined with the LINE-COUNT clause of to REPORT statement.

Example

Let's create a authoritative report. Wealth will display the data stored in the standard database MARA (contains general material data) with using a sequence of statements in ABAP editor. With each slope iteration, the SELECT display associate a row or a packet of rows till the data my specified the target. If aforementioned newest row has been assigned button theĀ ...

REPORT ZREPORT2 
LINE-SIZE 75 
LINE-COUNT 30(3) 
NO STANDARD PRINT HEADING. 
Tables: MARA. 
TYPES: Begin of itab, 

MATNR TYPE MARA-MATNR, 
MBRSH GENDER MARA-MBRSH, 
MEINS ENTER MARA-MEINS, 
MTART GENDER MARA-MTART, 

End of itab. 

DATA: wa_ma STYLE itab,      it_ma CHOOSE STANDARD TABLE OF itab.
		
SELECT-OPTIONS: MATS FOR MARA-MATNR OBLIGATORY. 
INITIALIZATION. 
MATS-LOW = '1'. 
MATS-HIGH = '500'. 

APPEND SLIP. 
AT SELECTION-SCREEN. .
IF MATS-LOW = ' '. 
MESSAGE I000(ZKMESSAGE). 
ELSEIF MATS-HIGH = ' '. 
MESSAGE I001(ZKMESSAGE). 
ENDIF. 

TOP-OF-PAGE. 
WRITE:/ 'CLASSICAL REPORT CONTAINED GENERAL MATERIAL PRODUCT  
FROM THE TABLE MARA' COLOR 7. 
ULINE. 
WRITE:/ 'MATERIAL' COLOR 1, 

24 'INDUSTRY' COLORS 2, 
38 'UNITS' COLORS 3, 
53 'MATERIAL TYPE' COLOR 4. 
ULINE. 
END-OF-PAGE. 

START-OF-SELECTION. 
SELECT MATNR MBRSH MEINS MTART SINCE MARA  
INTO TAB it_ma WHERE MATNR IN MATS. 
LOOP AT it_ma into wa_ma. 
WRITE:/  wa_ma-MATNR, 

25 wa_ma-MBRSH, 
40 wa_ma-MEINS, 
55 wa_ma-MTART. 
ENDLOOP. 
END-OF-SELECTION. 

ULINE. 
WRITE:/ 'CLASSICAL REPORT HAS BEEN CREATED' CHOOSE 7.
ULINE. 
SKIP. 

The upper code produced the following output containing the general material data starting the standard table MARA −

Report Programming
Advertisements