Skip to main content

SAP ABAP Interactive Reports – Complete Beginner to Advanced Guide with Real-Time Examples

 Interactive Report Programming in SAP ABAP – Step-by-Step Tutorial for Developers

What You Will Learn in This SAP ABAP Interactive reports.

  1. Understanding SAP ABAP Interactive Reports and how they differ from Classical Reports for real-time data display.

  2. Implementing AT LINE-SELECTION event to create clickable rows and drill-down secondary lists in your report.

  3. Using HIDE statements to pass selected row data from the basic list to secondary lists effectively.

  4. Creating hotspots and navigation in Interactive Reports for better user interaction and dynamic output.

  5. Building real-time examples using MARA or other SAP tables to demonstrate practical Interactive Report programming in ABAP.

📘 What is an Interactive Report in SAP ABAP?

Interactive Reports allow users to interact with the report output. They start with a basic list and allow users to drill down into secondary or detail lists.

  1. Basic List: Main report output
  2. Secondary List: Output shown after user action (e.g., clicking a line)
  3. Supports up to 20 secondary lists
  4. Navigation is done via AT LINE-SELECTION, HIDE, and SY-LSIND

🎯 Why Use Interactive Reports?

  1. Improve user experience
  2. Provide hierarchical data views
  3. Useful in master-detail scenarios (e.g., header → item)
  4. Save screen clutter

🔁 Key Events in Interactive Reporting

Event

Description

START-OF-SELECTIONBasic list logic
AT LINE-SELECTIONTriggered on user click
HIDEStores values for use in detail screen
SY-LSINDSystem variable showing list level
  1. Basic List: Show Purchase Orders from EKKO
  2. Secondary List: Show Items from EKPO for selected PO.
ABAP INTERACTIVE REPORT

*
the above screen short  is a selection screen where user enter required purchase order details.
click on EXECUTE BUTTON OR  F8 KEY.


REPORT z_interactive_ekko_ekpo.
TABLES: ekko, ekpo.
DATA: it_ekko TYPE STANDARD TABLE OF ekko,
wa_ekko TYPE ekko.
DATA: it_ekpo TYPE STANDARD TABLE OF ekpo,
wa_ekpo TYPE ekpo.
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.
START-OF-SELECTION.
SELECT * FROM ekko INTO TABLE it_ekko
WHERE ebeln IN s_ebeln.
IF sy-subrc = 0.
LOOP AT it_ekko INTO wa_ekko.
WRITE: / 'PO Number:', wa_ekko-ebeln,
'Vendor:', wa_ekko-lifnr,
'Doc Type:', wa_ekko-bsart.
" HIDE the PO number for later use
HIDE wa_ekko-ebeln.
ENDLOOP.
ELSE.
WRITE: / 'No purchase orders found.'.
ENDIF.
*--- Secondary List on PO selection
AT LINE-SELECTION.
CLEAR it_ekpo.
READ LINE sy-lilli FIELD VALUE wa_ekko-ebeln.
SELECT * FROM ekpo INTO TABLE it_ekpo
WHERE ebeln = wa_ekko-ebeln.
IF sy-subrc = 0.
WRITE: / 'Item details for PO:', wa_ekko-ebeln.
ULINE.
LOOP AT it_ekpo INTO wa_ekpo.
WRITE: / 'Item:', wa_ekpo-ebelp,
'Material:', wa_ekpo-matnr,
'Quantity:', wa_ekpo-menge,
'Net Price:', wa_ekpo-netpr.
ENDLOOP.
ELSE.
WRITE: / 'No items found for this PO.'.
ENDIF.

* The below screen short  shows the purchase order data.

SAP ABAP INTERACTIVE REPORTS

WHEN A USER DOUBLE  CLICK ON THE  PURCHASE ORDER HEADER DATA  IT WILL OPEN THE SECOUNDRY SCREEN, IT HAS ITEM PURCHASE DATA.

sap abap interactive reports

🧠 Explanation of the Code
HIDE is used to remember the ebeln value for use in the secondary list.
On clicking any PO line, AT LINE-SELECTION is triggered, and the corresponding EKPO data is displayed.
SY-LSIND is automatically handled to show a secondary screen.

Initial Screen – List of Purchase Orders from EKKO.
User clicks on any PO line.
Secondary screen – Shows PO items from EKPO for selected EBELN.

Always use HIDE after WRITE when you want to use field values in detail screens.
You can create up to 20 levels of interaction (SY-LSIND increases with every drill-down).
Use ULINE, SKIP, and formatting for bette
r output r

*****REAL TIME  EXAMPLE  USING PURCHASE HEADER AND ITEM DATA.

💡 Real-Time Example Using EKKO & EKPO (Header/Item)

📌 Goal:

📄 Output Behavior

📌 Tips for Interactive Reports.

REPORT ZMM_INTERACTIVE_REPORT.

TABLESkna1vbak.

DATAit_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-kunnrwa_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-vbelnwa_order-erdat.
ENDLOOP.

TOP-OF-PAGE DURING LINE-SELECTION.
WRITE'Sales Orders for Customer:'wa_customer-name1.


THE OUT PUT  WILL BE

FIRST SCREEN

ABAP INTERACTIVE REPORT


THE ABOVE   DATA DISPLAYING  CUSTOMER  DATA
WHEN A USER CLICK ON  CUSTOMER  NUMBER  IT CALL  ANOTHER SCREEN IT HAS  SALE ORDER DATA.

SAP ABAP REPORTS

TOP 10 REAL-TIME INTERVIEW QUESTIONS & ANSWERS (SAP ABAP INTERACTIVE REPORTS)

1️⃣ What is an Interactive Report in SAP ABAP?

An Interactive Report allows the user to click on a list line and display a secondary list, enabling drill-down navigation for detailed data.


2️⃣ How many secondary lists can an Interactive Report have?

Up to 20 secondary lists (up to list index 21) can be created using WRITE statements in interactive mode.


3️⃣ Which event is mandatory for Interactive Reports?

The event AT LINE-SELECTION is mandatory because it triggers when the user double-clicks a line to display the secondary list.


4️⃣ What is the use of the HIDE statement?

HIDE stores the field values of the selected line so that they can be accessed in secondary lists. It is used to pass context.


5️⃣ What is the purpose of SY-LSIND?

SY-LSIND represents the current list level.

  • 0 = Basic list

  • 1…20 = Secondary lists


6️⃣ How do you create Hotspot fields in an Interactive Report?

Use WRITE statement with HOTSPOT option.
Example:

WRITE: lv_matnr HOTSPOT.

7️⃣ What is the difference between Classical and Interactive Reports?

Classical reports show only one list, while Interactive Reports allow drilldown lists using events like AT LINE-SELECTION and HIDE.


8️⃣ What is the ON HELP-REQUEST event used for?

It triggers when F1 help is pressed, allowing dynamic help for input fields or list contents.


9️⃣ How do you display a secondary list?

By writing statements inside the AT LINE-SELECTION event:

AT LINE-SELECTION. WRITE: / 'Material Details:'.

🔟 Can ALV Reports be Interactive?

Yes, ALV Grid and OO ALV support interactive features like double-click events using user commands (sy-ucomm).


NOTE:

* LEARN CLASSICAL REPORTS


* LEARN REAL TIME ALV REPORTS.

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