✒️ABAP Los reportes interactivos
ABAP Los reportes interactivos
Interactive Reports
An Interactive Report in ABAP is a specialized type of report that initially displays a list on the screen with specific information. Upon double-clicking a particular line in the primary list, additional data related to that line is revealed. This process continues through multiple levels within the report.
In contrast to classic reports, which can be executed both online and in batch mode, interactive reports run exclusively online due to their requirement for user interaction.
The key advantage of interactive reports lies in their ability to create a user-interaction report with minimal code, unlike dialog programs that demand more construction time.
Interactive reports exhibit the following characteristics:
- Data is retrieved and presented on the screen in a primary list.
- Selections can be made from the primary list, commands can be entered from menus, function keys, or buttons can be executed, and information can be input.
- Detailed information is displayed in secondary states. Navigation between different states or levels of the interactive report is facilitated using the BACK and EXIT navigation buttons.
- From a list, there's the possibility to call other transactions or reports.
Events and Variables in an Interactive Report
Upon double-clicking a position in the primary list, the event AT LINE-SELECTION is triggered. At this moment, certain system variables are populated with valuable information:
- SY-LSIND: Contains the index of the list, i.e., the list level.
DATA: lv_index TYPE I.
lv_index = sy-lsind.
WRITE: / 'Current List Level Index:', lv_index.
- SY-LISEL: Stores the content of the selected line.
DATA: lv_selected_line TYPE STRING.
lv_selected_line = sy-lisel.
WRITE: / 'Content of Selected Line:', lv_selected_line.
-
SY-LILLI: Holds the number of the selected line in the list.
DATA: lv_line_number TYPE I.
lv_line_number = sy-lilli.
WRITE: / 'Selected Line Number:', lv_line_number.
- SY-CUROW: Stores the vertical cursor position on the screen.
DATA: lv_cursor_position TYPE I.
lv_cursor_position = sy-curow.
WRITE: / 'Vertical Cursor Position:', lv_cursor_position.
To display header texts for the primary list, the TOP-OF-PAGE event is utilized. For header texts in detail lists, the TOP-OF-PAGE DURING LINE-SELECTION event is used.
An additional option is to present the detail level screen as a dialog window or subscreen, achieved through the WINDOWS STARTING AT statement.
It's possible to create up to 20 levels of secondary lists.
E.g
*&---------------------------------------------------------------------*
*& Report ZTEST_ABAP_JEGA_17
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ztest_abap_jega_17.
* Declaration of Structure
DATA: it_users TYPE STANDARD TABLE OF zuser_table_jega,
wa_users LIKE LINE OF it_users,
v_dni TYPE z_dni.
*---------------------------------------------------------------------*
START-OF-SELECTION.
*---------------------------------------------------------------------*
PERFORM get_users_data.
*----------------------------------------------------------------------*
AT LINE-SELECTION.
*----------------------------------------------------------------------*
CLEAR v_dni.
v_dni = sy-lisel(10).
* Display Detail Report after user performs a line selection
PERFORM display_details_report.
*----------------------------------------------------------------------*
TOP-OF-PAGE DURING LINE-SELECTION.
*----------------------------------------------------------------------*
WRITE:/ 'User Detail', sy-uline.
*&---------------------------------------------------------------------*
*& Form get_users_data
*&---------------------------------------------------------------------*
* Users
*----------------------------------------------------------------------*
FORM get_users_data.
CLEAR it_users.
REFRESH it_users.
SELECT *
FROM zuser_table_jega
INTO TABLE it_users.
IF sy-subrc EQ 0.
* Display Main Report if information was found
PERFORM display_main_report.
ELSE.
* Error
MESSAGE i000(ztest_class).
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form display_main_report
*&---------------------------------------------------------------------*
* Main report Lvl 1
*----------------------------------------------------------------------*
FORM display_main_report.
* Print Header
PERFORM print_header.
* Print Data
PERFORM print_data.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form PRINT_HEADER
*&---------------------------------------------------------------------*
* Content of the Users Table
*----------------------------------------------------------------------*
FORM print_header.
WRITE:/1(133) sy-uline.
WRITE:/1(1) sy-vline,
2(8) 'ID', "DNI
11(1) sy-vline,
12(30) 'Name and Surname', "Full Name
43(1) sy-vline,
44(20) 'User Status', "State
65(1) sy-vline,
97(20) 'Date of Birth', "Birthdate
133(1) sy-vline.
WRITE:/1(133) sy-uline.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form PRINT_DATA
*&---------------------------------------------------------------------*
* Content of the Users Table
*----------------------------------------------------------------------*
FORM print_data.
LOOP AT it_users INTO wa_users.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 sy-vline,
2(8) wa_users-dni,
11 sy-vline,
12(30) wa_users-nombre_ape,
43 sy-vline,
44(20) wa_users-estado,
65 sy-vline,
97(20) wa_users-birthdate,
133 sy-vline.
ENDLOOP.
WRITE:/1(133) sy-uline.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form display_details_report
*&---------------------------------------------------------------------*
* Secondary report Lvl 2
*----------------------------------------------------------------------*
FORM display_details_report.
READ TABLE it_users INTO wa_users WITH KEY dni = v_dni.
IF sy-subrc EQ 0.
* Create a new window
WINDOW STARTING AT 1 15 ENDING AT 79 23.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1(50) sy-uline.
WRITE:/1(1) sy-vline,
2(18) TEXT-004,
21(1) sy-vline,
22(28) wa_users-dni,
50(1) sy-vline.
WRITE:/1(1) sy-vline,
2(18) TEXT-005,
21(1) sy-vline,
22(28) wa_users-nombre_ape,
50(1) sy-vline.
WRITE:/1(1) sy-vline,
2(18) TEXT-006,
21(1) sy-vline,
22(28) wa_users-estado,
50(1) sy-vline.
WRITE:/1(1) sy-vline,
2(18) TEXT-007,
21(1) sy-vline,
22(28) wa_users-birthdate,
50(1) sy-vline.
WRITE:/1(50) sy-uline.
ENDIF.
ENDFORM.
 
 
 
Sobre el autor
Publicación académica de Jaime Eduardo Gomez Arango, en su ámbito de estudios para la Carrera Consultor ABAP.
Jaime Eduardo Gomez Arango
Profesión: Ingeniero de Sistemas y Computación - España - Legajo: SW34C
✒️Autor de: 149 Publicaciones Académicas
🎓Egresado de los módulos:
- Carrera Consultor en SAP Fiori
- Carrera Consultor ABAP Nivel Avanzado
- Carrera Consultor ABAP Nivel Inicial
Disponibilidad Laboral: FullTime
Presentación:
Ingeniero de sistemas y computación con 8 años de experiencia el desarrollo frontend & backend (react/node) y en cloud (aws), actualmente desarrollando habilidades en sap btp, ui5, abap y fiori.
Certificación Académica de Jaime Gomez