Skip to main content

Complete SAP ABAP DEVELOPER Reporting Guide: Classical Reports, Events, Inner Joins & Interactive Reports Explained

SAP ABAP Classical Reports, Events, Inner Joins & Interactive Reporting – Complete Real-Time Guide

SAP ABAP reporting is one of the most important skills for every ABAP consultant. In real-time projects, you will work with Classical Reports, Interactive Reports, Select-Options, Events, System Fields, Inner Joins, and Database Access Enhancements.

This article provides step-by-step explanations, tables, events, and real-time ABAP programs.

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

A Classical Report displays output in a single list (basic list). It supports multiple list levels but mainly focuses on the primary output.

✔ Real-Time Use Cases

  1. Display vendor master list
  2. Material master reports
  3. Purchase order list
  4. Customer list
  5. Simple data extraction reports

🟦 2. Events Used in Classical Reports (Explained with Examples)

SAP ABAP Classical Reports trigger several system-defined events:

🔹 1. INITIALIZATION

Used to set default values in the selection screen.

INITIALIZATION. L_LIFNR-SIGN = 'I'. L_LIFNR-OPTION = 'BT'. L_LIFNR-LOW = '1000'. L_LIFNR-HIGH = '3000'. APPEND L_LIFNR.

🔹 2. AT SELECTION-SCREEN

Used for validation of selection screen fields.

AT SELECTION-SCREEN ON L_LIFNR. IF L_LIFNR-LOW = ' ' OR L_LIFNR-HIGH = ' '. MESSAGE TEXT-111 TYPE 'E'. ENDIF.

🔹 3. START-OF-SELECTION

Default event for data selection logic.

START-OF-SELECTION. SELECT LIFNR NAME1 ORT01 PSTLZ FROM LFA1 INTO TABLE IT WHERE LIFNR IN L_LIFNR.

🔹 4. END-OF-SELECTION

Used to process or display final output.


🔹 5. TOP-OF-PAGE

Used to display custom headers.


🔹 6. END-OF-PAGE

Used for page footer.


🟦 3. Complete Classical Report Program Using LFA1 Table

✔ Fields used

  1. LIFNR – Vendor Number
  2. NAME1 – Name
  3. ORT01 – City
  4. PSTLZ – Postal Code

✔ Real-Time Classical Report Program

REPORT YCLASSICAL_LFA1 NO STANDARD PAGE HEADING. TABLES: LFA1. SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000. SELECT-OPTIONS: L_LIFNR FOR LFA1-LIFNR. SELECTION-SCREEN: END OF BLOCK B1. TYPES: BEGIN OF TY_STR, LIFNR TYPE LIFNR, NAME1 TYPE NAME1_GP, ORT01 TYPE ORT01_GP, PSTLZ TYPE PSTLZ, END OF TY_STR. DATA: IT TYPE TABLE OF TY_STR, WA TYPE TY_STR. INITIALIZATION. L_LIFNR-SIGN = 'I'. L_LIFNR-OPTION = 'BT'. L_LIFNR-LOW = '1000'. L_LIFNR-HIGH = '3000'. APPEND L_LIFNR. AT SELECTION-SCREEN ON L_LIFNR. IF L_LIFNR-LOW = ' ' OR L_LIFNR-HIGH = ' '. MESSAGE TEXT-111 TYPE 'E'. ENDIF. START-OF-SELECTION. SELECT LIFNR NAME1 ORT01 PSTLZ FROM LFA1 INTO TABLE IT WHERE LIFNR IN L_LIFNR. END-OF-SELECTION. WRITE:/ 'LIFNR' COLOR 5, 10 'NAME1' COLOR 5, 40 'ORT01' COLOR 5, 60 'PSTLZ' COLOR 5. ULINE. LOOP AT IT INTO WA. WRITE:/ WA-LIFNR, 10 WA-NAME1, 40 WA-ORT01, 60 WA-PSTLZ. ENDLOOP. TOP-OF-PAGE. WRITE:/20 'CLASSICAL REPORT — LFA1 TABLE' COLOR 4. ULINE. END-OF-PAGE.

🟦 4. Inner Join in SAP ABAP (Real-Time Example)

Inner Join is used when data is required from multiple related tables.

✔ Real-Time Scenario

Join SCARR (Airline Carrier) and SPFLI (Flight Schedule).

TYPES: BEGIN OF FLIGHT, CARRID TYPE SCARR-CARRID, CARRNAME TYPE SCARR-CARRNAME, CONNID TYPE SPFLI-CONNID, CITYFROM TYPE SPFLI-CITYFROM, CITYTO TYPE SPFLI-CITYTO, END OF FLIGHT. DATA: IT_FL TYPE TABLE OF FLIGHT, WA_FL TYPE FLIGHT. SELECT SCARR~CARRID SCARR~CARRNAME SPFLI~CONNID SPFLI~CITYFROM SPFLI~CITYTO FROM SCARR AS SCARR INNER JOIN SPFLI AS SPFLI ON SCARR~CARRID = SPFLI~CARRID INTO TABLE IT_FL. LOOP AT IT_FL INTO WA_FL. WRITE:/ WA_FL-CARRID, WA_FL-CARRNAME, WA_FL-CONNID, WA_FL-CITYFROM, WA_FL-CITYTO. ENDLOOP.

🟦 5. Interactive Reports in SAP ABAP

Interactive Reports allow the user to go from Basic List → Secondary List → Detailed List.

THE BELOW EVENTS ARE USED IN DEVELOPING ALV REPORTS.

- LEARN SAP ABAP ALV REPORTS PROGRAMS.

Main Events in Interactive Reports

EventPurpose
START-OF-SELECTIONDisplays basic list
AT LINE-SELECTIONTriggered on double click
TOP-OF-PAGE DURING LINE-SELECTIONHeader for secondary list
END-OF-PAGEFooter section

🟦 6. System Fields Used in Interactive Reports

Field

Description

SY-LSINDList level index
SY-LISTICalled from which list
SY-LISELSelected line content
SY-CUROWCursor row
SY-CUCOLCursor column
SY-UCOMMFunction code
SY-PFKEYStatus of the list

🟦 7. Real-Time Interactive Report Example

REPORT z_interactive_report. TABLES: kna1, vbak. DATA: it_customers TYPE TABLE OF kna1, it_orders TYPE TABLE OF vbak, wa_customer TYPE kna1, wa_order TYPE vbak. START-OF-SELECTION. SELECT * INTO TABLE it_customers FROM kna1 UP TO 20 ROWS. LOOP AT it_customers INTO wa_customer. WRITE: / wa_customer-kunnr, wa_customer-name1. HIDE wa_customer-kunnr. ENDLOOP. AT LINE-SELECTION. CLEAR it_orders. SELECT * INTO TABLE it_orders FROM vbak WHERE kunnr = wa_customer-kunnr. LOOP AT it_orders INTO wa_order. WRITE: / wa_order-vbeln, wa_order-erdat. ENDLOOP. TOP-OF-PAGE DURING LINE-SELECTION. WRITE: / 'Sales Orders for Customer:', wa_customer-name1.

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...