Skip to main content

SAP ABAP Classical Reports Tutorial – Structure, Events, and Real-Time Example

 

Complete Guide to Classical Reports in SAP ABAP for Beginners (Step-by-Step Examples)

What You Will Learn in This Blog.

  • Understanding SAP ABAP Classical Report Structure with real-time business use cases and sample report formats.

  • Mastering ABAP Report Events like INITIALIZATION, START-OF-SELECTION, and END-OF-SELECTION for clean program flow.

  • Creating Selection Screens in SAP ABAP Reports using PARAMETERS, SELECT-OPTIONS, and user-friendly input validation.

  • Building Real-Time ABAP Classical Report Examples using MARA, MARC, and MSEG tables with SELECT queries and output formatting.

  • TOP 10 REAL-TIME INTERVIEW QUESTIONS & ANSWERS

📌 1. What is a Classical Report in SAP ABAP?

Definition:
Classical reports are traditional reports used to display data in a simple list format (line-by-line output). They are the most basic report type in SAP ABAP.

Use Case Example:
Displaying a list of materials from the MARA table.


📌 2. Key Characteristics

  1. Line-by-line output
  2. Single event START-OF-SELECTION
  3. Simple and fast to execute
  4. Mostly uses WRITE statements for output


📌 3. Events Used in Classical Reports

Explain these ABAP events briefly with syntax:

  1. REPORT – Declares the program name
  2. PARAMETERS / SELECT-OPTIONS – For input
  3. START-OF-SELECTION – Main logic
  4. END-OF-SELECTION (optional) – Final output
  5. INITIALIZATION (optional) – Default screen values
  6. TOP-OF-PAGE / END-OF-PAGE – Page headings/footers


📌 4. Syntax Template for a Simple Classical Report

abap
REPORT z_classical_report_demo. TABLES: mara. PARAMETERS: p_matnr TYPE mara-matnr. START-OF-SELECTION. SELECT * FROM mara INTO TABLE @DATA(it_mara) WHERE matnr = @p_matnr. LOOP AT it_mara INTO DATA(wa_mara). WRITE: / wa_mara-matnr, wa_mara-ernam, wa_mara-ersda. ENDLOOP.

📌 5. Real-Time Example Using SELECT-OPTIONS

DEVELOPING A CLASSICAL REPORTS PROGRAM.

REPORT z_classical_report_mara. TABLES: mara. SELECT-OPTIONS: s_matnr FOR mara-matnr. START-OF-SELECTION. SELECT * FROM mara INTO TABLE @DATA(it_mara) WHERE matnr IN @s_matnr. IF sy-subrc = 0. LOOP AT it_mara INTO DATA(wa_mara). WRITE: / wa_mara-matnr, wa_mara-mtart, wa_mara-mbrsh. ENDLOOP. ELSE. WRITE: 'No data found.'. ENDIF.

📌 6. Formatting Output with ULINE, SKIP, and WRITE

Show how to use:

ULINE. " Draws a line
SKIP. " Skips a line WRITE: / 'Header', 'More Header'.

📌 7. Using TOP-OF-PAGE Event for Page Header


TOP-OF-PAGE.

WRITE: / 'Material Report'. ULINE.

📌 8. Tips to Optimize Classical Reports

  1. Avoid nested loops
  2. Use internal tables instead of fetching record-by-record
  3. Use SELECT ... INTO TABLE instead of SELECT ... ENDSELECT


📌 9. Advantages and Limitations

Advantages:

  1. Easy to write and understand
  2. Useful for simple list outputs

Limitations:

  1. No modern GUI support
  2. Not interactive (compared to ALV)


📌 10. When to Use Classical Reports?

  1. For quick reporting needs
  2. Background job reports
  3. Data review for functional consultants

Classical Report in SAP ABAP

Classical Reports are used in scenario where you want to display the entire output in a single list called basic list. There are multiple events used in Classical Report -

1) INITIALIZATION.
This is the first event to trigger in ABAP report. This allows the user to maintain default values in the selection-screen.

Syntax:

INITIALIZATION.
2) AT SELECTION-SCREEN.
This event works only if you have added selection-screen in your program. It triggers once the selection-screen is displayed and used for validation for the pre-defined values in the selection-screen.

Syntax :
AT SELECTION-SCREEN ON <FIELDNAME>.

3) START-OF-SELECTION.
This event is default in any ABAP program. But if you have used INITIALIZATION and AT SELECTION-SCREEN in your program you need to declared it manually. This event is used to extract data from the database and thus is an important event.
SYNTAX:
START-OF-SELECTION.

4) END-OF-SELECTION.
This event triggers after the data is being is extracted and after that the first record in the output list is displayed.

Syntax :

END-OF-SELECTION.
5) TOP-OF-PAGE.
This event helps in giving heading to the report.
Syntax :
TOP-OF-PAGE.

6) END-OF-PAGE.
This event helps in maintaining the footer.

Syntax :
END-OF-PAGE.

To understand more about classical report let’s take a requirement and display the output.

********  DISPLAYING  MATERIAL MASTER DATA

DISPLAY MATERIAL MASTER DATA REPORTS

WHEN A  USER ENTER THE REQUIRED  MATERIAL NUMBER 
AND
PLANT  NUMBER 

IT WILL DISPLAY THE  DATA  OUT PUT GIVEN BELOW.

SAP ABAP REPORTS OUT PUT DISPLAY DATA
CLASSICAL REPORT PROGRAM DISPLAYING MATERIAL MASTE DATA   USING ALL CLASSICAL  EVENTS.
REPORT ZJH2_CLASSICAL_REPORTS.
*&---------------------------------------------------------------------*
*& Report  ZMAZ_CLASICAL_REPORTS
*&
*&---------------------------------------------------------------------*
TABLES MARA.
TYPES BEGIN OF T_FINAL,
        MATNR TYPE MARA-MATNR,
        ERSDA TYPE MARA-ERSDA,
        ERNAM TYPE MARA-ERNAM,
        PSTAT TYPE MARC-PSTAT,
        WERKS TYPE MARC-WERKS,
        END OF T_FINAL.

TYPES BEGIN OF T_MAT,
        MATNR TYPE MARA-MATNR,
        ERSDA TYPE MARA-ERSDA,
        ERNAM TYPE MARA-ERNAM,
        END OF T_mAT.
TYPES BEGIN OF T_MARC,
        MATNR TYPE MARC-MATNR,
        PSTAT TYPE MARC-PSTAT,
        WERKS TYPE MARC-WERKS,
      END OF T_mARC.
 DATA :  WA_MAT TYPE T_MAT,
       IT_MAT TYPE STANDARD TABLE OF T_MAT.

 DATA WA_MARC TYPE T_MARC,
       IT_MARC TYPE STANDARD TABLE OF T_MARC.

 DATA WA_FINAL TYPE T_FINAL,
       IT_FINAL TYPE STANDARD TABLE OF T_FINAL.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
 SELECT-OPTIONS S_MATNR FOR MARA-MATNR.

 PARAMETERS P_WERKS TYPE MARC-WERKS.

SELECTION-SCREENEND OF BLOCK B1.
 initialization.
 P_WERKS '1000'.

 S_MATNR-LOW 10.
 S_MATNR-HIGH 2000.
 S_MATNR-OPTION 'BT'.
 S_MATNR-SIGN 'I'.
 APPEND S_MATNR.

** AT SELECTION SCREEN EVENT  USED FOR  USER RISTRICTION

AT SELECTION-SCREEN.

  IF P_WERKS  IS initial.

MESSAGE 'ENTER THE REQUIRED VALUE FOR R PLANT NUMBER'   TYPE 'E'.
    ENDIF.

IF S_MATNR   IS initial.

  MESSAGE ' ENTER THE REQUIRED MATIAL NUMBER' TYPE 'E'.
  ENDIF.

START-OF-SELECTION.
 SELECT MATNR
   ERSDA
   ERNAM FROM MARA INTO TABLE IT_MAT.
IF IT_MAT IS NOT INITIAL.
  SELECT MATNR
    PSTAT
    WERKS FROM MARC INTO TABLE IT_MARC UP TO 10 ROWS
    FOR ALL ENTRIES IN IT_MAT
    WHERE MATNR IT_MAT-MATNR .
  ENDIF.
  LOOP AT IT_MARC INTO WA_MARC.
    WA_FINAL-MATNR WA_MARC-MATNR.
    WA_FINAL-PSTAT WA_MARC-PSTAT.
    WA_FINAL-WERKS WA_MARC-WERKS.
    READ TABLE IT_MAT INTO WA_MAT WITH KEY MATNR WA_MARC-MATNR.
    WA_FINAL-ERSDA WA_MAT-ERSDA.
    WA_FINAL-ERNAM WA_MAT-ERNAM.

APPEND WA_FINAL TO IT_FINAL.
    CLEAR WA_FINAL.
    ENDLOOP.
END-OF-SELECTION.
 IF IT_FINAL IS NOT INITIAL.
   LOOP AT IT_FINAL INTO WA_FINAL.

WRITE / WA_FINAL-MATNR,
WA_FINAL-ERSDA,
WA_FINAL-ERNAM,
WA_FINAL-PSTAT,
WA_FINAL-WERKS.

   ENDLOOP.
   ELSE.
     MESSAGE ' FINAL INTERN AL TABLE RECOR ARE NOT MATCHING' TYPE 'I'.
     ENDIF.
TOP-OF-PAGE.
WRITE 'MATERIAL NO',  'DATE' ,  ' NAME' 'PSTAT' 'LOCATION'.
SKIP 1.

END-OF-PAGE.

WRITE 'PAGE NO OF THJE LIST' SY-DATUM.

**********************   END OF THE PROGRAM  *********************

EXAMPLE 2
THE BELOW PROGRAM  WILL DISPLAY CLASSICAL REPORTS  USING
AT SELECTION-SCREEN EVENT FOR VALIDATION  PURPOSE.

ABAP USER  INPUT FIELD

THE BWLOW SCREEN  TELL US IF THE USER   NOT ENTER THE VALUE  LEAVE  USER ENTER VALUE IS EMPTY  THAT IT PROVIDE THE ERROR MESSAGE

ABAP REPORT OUTPUT DATA

CODE GIVEN BELOW.
REPORT ZJH2_CLASSICAL_REPORTS_1.
*SAP ABAP REPORTS 11.05.2025
*REPORTS
*TYPES OF REPORTS
*CLASSICAL REPORTS
*EVENTS
*
*
*REPORTS
*IT CONTAINS SET OF REALATED DATA.
*DATA BASE CONSIST OF LOT OF DATA
*BY USING  REPORTS CONCEPT YOU CAN  FETCH RELATED DATA.
*
*TYPES OF REPORTS
*CLASSICAL REPORTS         OLD FORMAT
*INTERACTIVE REPORTS       2 SCREEN INTERACTION
*ALV REPORTS             EXCEL FORMAT
*HERICAL  REPORTS
TABLES MARC.
SELECT-OPTIONS S_MATNR FOR MARC-MATNR.
parametersP_WERKS TYPE MARC-WERKS.

DATA WA_MARC TYPE MARC,
       IT_MARC TYPE STANDARD TABLE OF MARC.
Initialization.

 S_MATNR-LOW '10'.
 S_MATNR-HIGH '2000'.
 S_MATNR-OPTION 'BT'.
 S_MATNR-SIGN 'I'.
 APPEND S_MATNR.

 P_WERKS '3000'.
* ** THE ABOVE ARE THE COMPONENTS OF SELECT OPTIONS
* LOW
* HIGH
* OPTION
* SIGN    I   INCLUDE    AND E  EXCLUDE

*INITIALIZATION EVENTS USED TO PROVIDE THE DEFAULT VALUE  TO SELECT SCREEN FIELDS
AT SELECTION-SCREEN.
*  TO VALIDATE THE SELECTION FIELDS
  IF S_MATNR-LOW ' ' AND S_MATNR-HIGH ' '.
  MESSAGE  'ENTER THE  VALID MATERIAL NUMBER'  TYPE 'E'.
  ENDIF.

  IF P_WERKS ' '.
    MESSAGE ' ENTER THE VALID PLANT LOCATION' TYPE 'E'.
    ENDIF.


   START-OF-SELECTION.

    SELECT FROM MARC INTO TABLE IT_MARC
      WHERE MATNR IN S_MATNR
      AND
      WERKS P_WERKS..
 END-OF-SELECTION.
 LOOP AT IT_MARC INTO WA_MARC.

   WRITE / WA_MARC-MATNR,
   WA_MARC-WERKS,
  45  WA_MARC-PSTAT.
   ENDLOOP.
   TOP-OF-PAGE.
   WRITE /50 '  DISPLAYING MATERIAL INFORMATION DATA'.
   SKIP.
   WRITE 'MATERIAL NUMBER'.
   END-OF-PAGE.
   WRITE ' LAST RECORDS'.


OUTPUT SCREEN.
ABAP CLASSICAL REPORTS OUT PUT SCREEN


TOP 10 REAL-TIME INTERVIEW QUESTIONS & ANSWERS

1️⃣ What is a Classical Report in SAP ABAP?

A Classical Report is the basic, traditional ABAP report that displays output in a simple list format using WRITE statements. It follows a predefined sequence of events, making it ideal for simple reporting needs.


2️⃣ What are the main events used in Classical Reports?

Common ABAP Report Events:

  1. INITIALIZATION
  2. AT SELECTION-SCREEN
  3. START-OF-SELECTION
  4. END-OF-SELECTION
  5. TOP-OF-PAGE / END-OF-PAGE

These events control the program flow in a Classical Report.

3️⃣ What is the use of START-OF-SELECTION in Classical Reports?

It is the default event where the main business logic is written.
Example:

  1. Reading MARA/MARC table data
  2. Performing SELECT statements
  3. Calculations and validations


4️⃣ What is the purpose of TOP-OF-PAGE in Classical Reports?

TOP-OF-PAGE is used to display page headers in the output list.
Example: Company name, report title, and date.


5️⃣ What is the difference between Classical Reports and ALV Reports?

Classical ReportsALV Reports
Uses WRITE statementsUses ALV function modules or OO ALV
Simple list outputInteractive, sortable, filterable output
No automatic formattingAutomatic layout & styling
Limited user interactionHigh interaction options

6️⃣ How do you create a Selection Screen in Classical Reports?

Using:

  1. PARAMETERS – Single input field
  2. SELECT-OPTIONS – Range selection

Example:
PARAMETERS: p_matnr TYPE matnr.

7️⃣ What is the role of END-OF-SELECTION?

Used for final processing after data retrieval.
Example:

  1. Printing totals
  2. Final formatting
  3. Preparing the list display


8️⃣ What is AT SELECTION-SCREEN used for?

This event is used to validate input fields or trigger actions before the report execution.
Example: Check if a material exists before executing the report.


9️⃣ Can Classical Reports have multiple pages? How?

Yes, using:

  1. WRITE: /… to create new lines
  2. NEW-PAGE to force a new page
  3. TOP-OF-PAGE to print header on each page


🔟 What is the importance of SY variables in Classical Reports?

SY fields are system variables used for:

  1. SY-DATUM → Current date
  2. SY-UNAME → Current user
  3. SY-PAGNO → Page number
  4. SY-TABIX → Current row index

  1. These help generate dynamic and user-friendly report outputs.



Comments

Popular posts from this blog

SAP ABAP SE11 Data Dictionary Tutorial | Step-by-Step Explanation with Real-Time Examples

    SAP ABAP Data Dictionary (SE11) – Complete Guide to Tables, Views, Domains & Data Elements    What is the ABAP Data Dictionary? The SAP ABAP data dictionary serves as a primary and structured source of data for creating objects. It is an independent database DDL (Data Definition Language) that primarily deals with creating, editing, and dropping database tables. The data dictionary allows you to define and maintain database-related items. The ABAP data dictionary is readily connected with the ABAP workbench, allowing all of the workbench's components to simply access the definitions contained in the dictionary. Functions of Data Dictionary The important functions of data dictionary objects are as follows. 1. Database tables 2. Domains 3. Data elements 4. Views 5. Search helps 6. Lock Objects 1. Database Tables: –  Database tables are collections of fields that store physical data. It is an object that holds data in the form of rows and columns. So databa...

SAP ABAP ALV Report Using REUSE_ALV_GRID_DISPLAY – Complete Tutorial with Examples

  📘 SAP ABAP ALV Report Using REUSE_ALV_GRID_DISPLAY – Complete Step-by-Step Guide (With Real Examples) SAP ABAP developers frequently use ALV (ABAP List Viewer) to present data in a clean and interactive format. One of the most commonly used ALV function modules in classical reporting is: This function module allows developers to create professional ALV reports with features such as sorting, filtering, totals, layout saving, and exporting to Excel. In this guide, I will explain: What REUSE_ALV_GRID_DISPLAY is How field catalogs work How to build an ALV report using MARC and KNA1 tables Real-time business examples Clean, fully working ABAP code This post is written from my personal learning and hands-on experience while working on SAP ABAP reports. 🧩 What is REUSE_ALV_GRID_DISPLAY? REUSE_ALV_GRID_DISPLAY is a function module-based ALV used in SAP ECC and compatible with S/4HANA systems. It displays internal table data in a grid-style output , which is more user...

SAP ABAP Control Break Statements – Complete Guide with AT FIRST, AT NEW & AT END OF Examples

📘 SAP ABAP Control Break Statements – Complete Guide with Example Learn about Control Break Statements in SAP ABAP including AT FIRST, AT NEW, AT END OF, AT LAST, and ON CHANGE OF. Includes a real-time example program with explanation and output. Perfect for SAP ABAP beginners and developers. SAP ABAP Control Break Statements AT NEW ABAP example AT END OF ABAP tutorial ABAP loop control SAP ABAP report programming AT FIRST, AT LAST in ABAP SAP ABAP internal table sorted 📘 Introduction In SAP ABAP , control break statements are used to trigger events inside a loop . They are essential for creating grouped or hierarchical reports , especially when working with sorted internal tables. There are 5 main control break statements in ABAP: AT FIRST – ENDAT AT NEW – ENDAT AT END OF – ENDAT AT LAST – ENDAT ON CHANGE OF FIELD. SAP ABAP Loop Control Tutorial:  How to Use AT NEW, AT END OF, AT FIRST, AT LAST, & ON CHANGE OF  FIELD. 🧠 Key Control Break Statements Explai...