Reports in SAP ABAP
Reports are the final output of the program. It retrieves data from the database, processes the data, and displays the output in the desired format. A report consists of a selection screen, logic, and the output screen. The Selection screen is optional.
In ABAP there are seven types of reports which are follows:
1. Classical Report:
This is a basic report that provides minimal information, displaying output using Write statements. Technically, within a program, there is typically only one classical report. In this type of report, the output is displayed in a single list without any sub-reports.
Basic Reporting events for Classical reports
To design any report, you need to consider the six basic events which are as follows:
All of these events are optional, and you can choose any depending on your requirements. It's not mandatory to select an event you can also run a program without any event. Each event has its own properties. There's no need to maintain a specific sequence, and no syntax check is required if some events are missing. However, the format and spelling must be checked.
- TOP-OF-PAGE: Whatever you write in Top-OF-PAGE event it will displayed at top of the output.
- INITIALIZATION: This event is used to initialize the values. This event is triggered before the selection screen. This event is used to give default value to selection screen.
- AT SELECTION-SCREEN: This event is triggered to check and validate the input values when the user process the selection screen.
- START-OF-SELECTION: This event triggered as soon as the user press the F8 button or click execute button.
- END-OF-SELECTION: This event is triggered when the last statement of the start-of-selection event is executed.
- END-OF-PAGE: It displayed at the end of the output.
REPORT aji_report.
TOP-OF-PAGE.
WRITE: /'Top of page'.
INITIALIZATION.
WRITE / 'Initialization'.
AT SELECTION-SCREEN.
WRITE / 'At selection screen'.
START-OF-SELECTION.
WRITE / 'Start of selection'.
END-OF-SELECTION.
WRITE / 'End of Selection'.
END-OF-PAGE
WRITE / 'End of page'.
2. Interactive Report:
As the name suggests, the user can interact with the output. For example, in a report, if column one displays the product ID and the user wants more information about the product price, they can hide the data under the product ID.
When the user clicks on the product ID, another report displaying the product rate is shown. In other words, after the basic list is displayed, the user can click on any field to display a secondary list providing relevant information for that field.
In short when you click on some field of the output it navigate you to another screen. In an interactive report, the output is displayed in multiple lists.
It is important to note that in one ABAP program, you can maintain one basic list (first report) and up to 19 secondary list so total is 20. There are 0 to 19 interactive reports.
Events in Interactive report:
AT-LINE SELECTION: This event is triggered as soon as the user double click a line in the list and a new sub-list is generated. The statement return under this event is displayed in the newly generated sub-list as the event is triggered.
AT USER-COMMAND: It triggers when the user presses the function keys.
At PREDEFINED FUNCTION (PF): For predefined function keys.
TOP OF PAGE during Line Selection: This event triggers during the processing of the secondary list at which a new page starts. The secondary list allows you to enhance the information shown in the basic list.
3. Logical Database:
Logical Database Report adds some more features to the ABAP report like you don’t need to declare parameters or selection screen generated automatically.
4. ABAP query:
ABAP Query reports or ABAP SQVI reports are different types of reports that do not require any coding. You can create user-specific reports by selecting tables and joining them on certain fields.
There are predefined steps to generate the final report. ABAP query reports are very efficient and accurate.
5. ALV Reports (ALV stands for ABAP List Viewer):
ALV Reports are used to improve the readability and functionality of report outputs. They offer advanced list display features such as sorting, filtering, subtotaling, and hierarchical data presentation in a tabular format.
ALV Reports are primarily used for customized data formatting and display in reports. They are particularly useful when dealing with large datasets involving over 90 columns, offering a wide range of display options.
This tool enables dynamic sorting and arrangement of columns in report outputs. Similar to interactive reports, ALV Reports also support secondary displays, allowing operations like summing numeric fields or performing arithmetic calculations.
List and Grid are the two modes of ALV. List mode offers traditional list processing with standard functionalities, while grid mode utilizes a new OCX object to display grids
6. Report Writer/Report Painter:
Report Writer or Report Painter tool is used by super user and end users to write their report .
7. Views (There are different types of views also):
They serve as virtual tables that do not store any data themselves. Instead, they provide a dynamic means to access and manipulate data stored in underlying database tables, enabling developers to work with data in a more efficient and flexible manner.
Views are primarily used for reporting, data manipulation, and designing user interfaces.