🚀PROMO #PLANCARRERA2024 - 🔥Bonificaciones, Precios Congelados y Cuotas

 X 

✒️ABAP Los reportes ALV

ABAP Los reportes ALV

ABAP Los reportes ALV

ALV Reports (ABAP List Viewer Reports)

The ABAP List Viewer (ALV) is an exclusive tool used for efficient, quick, and standardized report creation in ABAP.

Key advantages of ALV reports include:

  • Simplified report development leading to reduced programming times.
  • Provision of numerous standard functionalities for reports, such as sorting, total calculation, filtering, column sorting, hiding columns, and exporting results to Microsoft Excel, local files, CSV files, HTML format, among others.
  • Consistent and uniform screen output.

The Evolution of ALV Reports

  • ABAP List: The initial tool for on-screen data output was the ABAP List. It used the WRITE statement to display data lines on the screen. However, it required manual coding for each field, column, total, or subtotal, offering users a rigid report structure.
  • ALV List: The ALV framework, first as ALV List, improved upon ABAP List functionality. ALV Lists featured aligned columns, an enhanced toolbar with sorting, filtering, and subtotal capabilities. Users could customize column visibility and order, saving preferences for future runs. Developers benefited from tools for data presentation without manual position calculations.
  • ALV Grid: The next step in ALV evolution was ALV Grid, resembling a tabular format like Microsoft Excel. Early implementations utilized SAP function modules starting with REUSE_ALV.
  • Hierarchical ALV: Used for displaying header and detail data.
  • First Object-Oriented ALV Framework: Introduced object classes starting with CL_GUI_ALV, producing visually similar results to function module-based implementations but allowing ALV objects to link to custom containers on a screen.
  • SALV Framework: Current implementation, available since SAP Netweaver 7.0, employs object classes starting with CL_SALV, supporting ALV table, ALV tree, and sequential hierarchical list formats.
  • ALV with IDA: The latest, known as SAP List View with Integrated Data Access (ALV with IDA), leverages SAP HANA in-memory database functionality. Implementation uses the object class CL_SALV_TABLE_IDA.

Creating ALV Reports with Function Modules

Commonly used function modules are:

  • Grids: REUSE_ALV_GRID_DISPLAY
  • Lists: REUSE_ALV_LIST_DISPLAY
  • Hierarchical: REUSE_ALV_HIERSEQ_LIST_DISPLAY

Grids and lists can be used in any report, while hierarchical ones are for cases involving header and detail data (e.g., invoice numbers and details, airline and flight data).

ALV Report Creation Steps

  • Step 1: Declarations of ALV-specific types, structures, and internal tables. Within this step, we declare the type SLIS, which is essential for utilizing ALV reports. We also declare an internal table and a structure for the ALV catalog, both of type SLIS_T_FIELDCAT_ALV and SLIS_FIELDCAT_ALV, respectively. Another structure for output configuration, type SLIS_LAYOUT_ALV, is declared, along with a variable of type SY-REPID to store the program name.
* Internal table and structure for the catalog
DATA: it_catalog TYPE slis_t_fieldcat_alv,
wa_catalog TYPE slis_fieldcat_alv.

* Structure for output configuration
DATA: wa_layout TYPE slis_layout_alv.

* Variable with the program name
DATA: v_repid LIKE sy-repid.
  • Step 2: Declaration of the ALV output internal table.

* Internal table and output structure for ALV
DATA: it_users TYPE STANDARD TABLE OF zuser_table_jega,
wa_users LIKE LINE OF it_users,

  • Step 3: Data selection for ALV display. Within the START-OF-SELECTION event, create a subroutine to select data records from the database table to be displayed in the output list, storing them in the internal table.

START-OF-SELECTION.
PERFORM select_data.

FORM select_data.
REFRESH it_users.
SELECT * FROM zuser_table_jega INTO TABLE it_users.
ENDFORM.

  • Step 4: Building the ALV catalog. Within the START-OF-SELECTION event, create a subroutine to build the ALV catalog with fields that will become columns in the report. Complete the fields for each column in the list, belonging to the internal catalog table.

START-OF-SELECTION.
PERFORM build_catalog.

FORM build_catalog.
REFRESH it_catalog.

CLEAR wa_catalog.
wa_catalog-fieldname = 'DNI'. "Field Name
wa_catalog-tabname = 'IT_USERS'. "Table Name
wa_catalog-seltext_s = 'DNI'. "Short Header Description
wa_catalog-seltext_m = 'DNI'. "Medium Header Description
wa_catalog-seltext_l = 'DNI'. "Long Header Description
wa_catalog-outputlen = 10. "Column Width
wa_catalog-just = 'R'. "Alignment
APPEND wa_catalog TO it_catalog.

CLEAR wa_catalog.
wa_catalog-fieldname = 'NAME'.
wa_catalog-tabname = 'IT_USERS'.
wa_catalog-seltext_s = 'Name and Surname'.
wa_catalog-seltext_m = 'Name and Surname'.
wa_catalog-seltext_l = 'Name and Surname'.
wa_catalog-outputlen = 25.
wa_catalog-just = 'R'.
APPEND wa_catalog TO it_catalog.

CLEAR wa_catalog.
wa_catalog-fieldname = 'STATUS'.
wa_catalog-tabname = 'IT_USERS'.
wa_catalog-seltext_s = 'User Status'.
wa_catalog-seltext_m = 'User Status'.
wa_catalog-seltext_l = 'User Status'.
wa_catalog-outputlen = 20.
wa_catalog-just = 'R'.
APPEND wa_catalog TO it_catalog.

CLEAR wa_catalog.
wa_catalog-fieldname = 'BIRTH_DATE'.
wa_catalog-tabname = 'IT_USERS'.
wa_catalog-seltext_s = 'Birth Date'.
wa_catalog-seltext_m = 'Birth Date'.
wa_catalog-seltext_l = 'Birth Date'.
wa_catalog-outputlen = 16.
wa_catalog-just = 'R'.
APPEND wa_catalog TO it_catalog.
ENDFORM.

  • Step 5: Configuring the ALV output layout. Within the START-OF-SELECTION event, create a subroutine to configure certain aspects of the ALV output. There are many more options to configure in the layout of an ALV report. For additional information, double-click on the SLIS_LAYOUT_ALV type.

START-OF-SELECTION.
PERFORM configure_layout.

*&---------------------------------------------------------------------*
*& Form CONFIGURE_LAYOUT
*&---------------------------------------------------------------------*
* This form configures the layout settings for the ALV report.
* It sets the window titlebar to display "User Report."
*---------------------------------------------------------------------*
FORM configure_layout.
CLEAR wa_layout.
wa_layout-window_titlebar = TEXT-001. "User Report
ENDFORM.

  • Step 6: Finally, execute the ALV function module. For a grid-type report, use the REUSE_ALV_GRID_DISPLAY function module. For a list-type report, use REUSE_ALV_LIST_DISPLAY. Both function modules are completed in the same manner.

START-OF-SELECTION.
PERFORM execute_alv.

*&---------------------------------------------------------------------*
*& Form EXECUTE_ALV
*&---------------------------------------------------------------------*
* This form executes the ALV display based on the specified parameters.
* If the display mode is 'Grid' (p_grid = c_x), it uses REUSE_ALV_GRID_DISPLAY.
* If the display mode is 'List' (p_list = c_x), it uses REUSE_ALV_LIST_DISPLAY.
*---------------------------------------------------------------------*
FORM execute_alv.

CLEAR v_repid.
v_repid = sy-repid.

IF p_grid EQ c_x.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = it_catalog[]
is_layout = wa_layout
TABLES
t_outtab = it_users.

ELSEIF p_list EQ c_x.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = it_catalog[]
is_layout = wa_layout
TABLES
t_outtab = it_users.
ENDIF.

ENDFORM.

E.g

*&---------------------------------------------------------------------*
*& Report ZTEST_ABAP_JEGA_18
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ztest_abap_jega_18.

* Type-pool declaration for ALV
TYPE-POOLS: slis.

* Constants
CONSTANTS: c_x(1) TYPE c VALUE 'X'.

* Internal table and structure for user data
DATA: it_users TYPE STANDARD TABLE OF zuser_table_jega,
wa_users LIKE LINE OF it_users.

* Internal table and structure for ALV catalog
DATA: it_catalog TYPE slis_t_fieldcat_alv,
wa_catalog TYPE slis_fieldcat_alv.

* Structure for the configuration of the output
DATA: wa_layout TYPE slis_layout_alv.

* Variable with the name of the program
DATA: v_repid LIKE sy-repid.

*---------------------------------------------------------------------*
* Selection screen
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK bloque WITH FRAME TITLE TEXT-001.
PARAMETERS: p_grid RADIOBUTTON GROUP bot2,
p_list RADIOBUTTON GROUP bot2.
SELECTION-SCREEN END OF BLOCK bloque.

*---------------------------------------------------------------------*
* Start of selection
*---------------------------------------------------------------------*
START-OF-SELECTION.

PERFORM select_data.
PERFORM build_catalog.
PERFORM configure_layout.
PERFORM execute_alv.

*---------------------------------------------------------------------*
* Form: SELECT_DATA
* Description: Selects data from the database table ZUSER_TABLE_JEGA.
*---------------------------------------------------------------------*
FORM select_data.

REFRESH it_users.

SELECT *
FROM zuser_table_jega
INTO TABLE it_users.

ENDFORM. " SELECT_DATA"

*---------------------------------------------------------------------*
* Form: BUILD_CATALOG
* Description: Builds the catalog for ALV display.
*---------------------------------------------------------------------*
FORM build_catalog.

CLEAR it_catalog.

" DNI Field
CLEAR wa_catalog.
wa_catalog-fieldname = 'DNI'.
wa_catalog-tabname = 'ZUSER_TABLE_JEGA'.
wa_catalog-seltext_s = 'DNI'.
wa_catalog-seltext_m = 'DNI'.
wa_catalog-seltext_l = 'DNI'.
wa_catalog-outputlen = 10.
wa_catalog-just = 'R'.
APPEND wa_catalog TO it_catalog.

" Name and Surname Field
CLEAR wa_catalog.
wa_catalog-fieldname = 'NOMBRE_APE'.
wa_catalog-tabname = 'ZUSER_TABLE_JEGA'.
wa_catalog-seltext_s = 'Name and Surname'.
wa_catalog-seltext_m = 'Name and Surname'.
wa_catalog-seltext_l = 'Name and Surname'.
wa_catalog-outputlen = 25.
wa_catalog-just = 'R'.
APPEND wa_catalog TO it_catalog.

" Status Field
CLEAR wa_catalog.
wa_catalog-fieldname = 'ESTADO'.
wa_catalog-tabname = 'ZUSER_TABLE_JEGA'.
wa_catalog-seltext_s = 'User Status'.
wa_catalog-seltext_m = 'User Status'.
wa_catalog-seltext_l = 'User Status'.
wa_catalog-outputlen = 20.
wa_catalog-just = 'R'.
APPEND wa_catalog TO it_catalog.

" Birthdate Field
CLEAR wa_catalog.
wa_catalog-fieldname = 'BIRTHDATE'.
wa_catalog-tabname = 'ZUSER_TABLE_JEGA'.
wa_catalog-seltext_s = 'Birth Date'.
wa_catalog-seltext_m = 'Birth Date'.
wa_catalog-seltext_l = 'Birth Date'.
wa_catalog-outputlen = 16.
wa_catalog-just = 'R'.
APPEND wa_catalog TO it_catalog.

ENDFORM. " BUILD_CATALOG"

*---------------------------------------------------------------------*
* Form: CONFIGURE_LAYOUT
* Description: Configures the layout settings for the ALV report.
*---------------------------------------------------------------------*
FORM configure_layout.

CLEAR wa_layout.
wa_layout-window_titlebar = 'User Report'.

ENDFORM. " CONFIGURE_LAYOUT"

*---------------------------------------------------------------------*
* Form: EXECUTE_ALV
* Description: Executes the ALV display based on the specified parameters.
* If the display mode is 'Grid' (p_grid = 'X'), it uses
* REUSE_ALV_GRID_DISPLAY. If the display mode is 'List'
* (p_list = 'X'), it uses REUSE_ALV_LIST_DISPLAY.
*---------------------------------------------------------------------*
FORM execute_alv.

CLEAR v_repid.
v_repid = sy-repid.

IF p_grid = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = it_catalog[]
is_layout = wa_layout
TABLES
t_outtab = it_users.

ELSEIF p_list = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = it_catalog[]
is_layout = wa_layout
TABLES
t_outtab = it_users.
ENDIF.

ENDFORM. " EXECUTE_ALV"


 

 

 


Sobre el autor

Publicación académica de Jaime Eduardo Gomez Arango, en su ámbito de estudios para la Carrera Consultor ABAP.

SAP Master

Jaime Eduardo Gomez Arango

Profesión: Ingeniero de Sistemas y Computación - España - Legajo: SW34C

✒️Autor de: 99 Publicaciones Académicas

🎓Cursando Actualmente: Consultor ABAP Nivel Avanzado

🎓Egresado del módulo:

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

✒️+Comunidad Académica CVOSOFT

Continúe aprendiendo sobre el tema "Los reportes ALV" de la mano de nuestros alumnos.

SAP Master

ALV: se utiliza para crear reportes de manera eficaz, rapida y estandarizada. - Simplifican el desarrollo de reportes. se reducen los tiempos de programacion. -proporcionan a nuestros reportes un monton de funcionalidades estandar. -Proporcionan una salida por pantalla estandarizada e uniforme

Acceder a esta publicación

Creado y Compartido por: Mauro Fanego / Disponibilidad Laboral: FullTime

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Master

Que es un ALV alv(abap list viewer es una herramienta exclusica de abap, que se utiliza para crear reportes de manera eficaz, rapida y estandarizada las principañes ventajas de los reportes ALV son: simplifican el desarrollo de reportes, por lo tanto se reducen los tiempo de programacion. Proporcionan a nuestros reportes un monton de funcionalidad estandar proporcionan una salida por pantalla estandarizada e unifrome La creacion de un reporteALV, se basa en la utilizacion de funciones. Los tipos ALV mas comunmente usados son tres: grillas, lstas y jerarquico. a cada tipo de ALV le conrresponde una funcion diferente. ellas son: grillas = REUSE_ALV_GRID_DISPLAY listas = REUSE_ALV_LIST_DISPLAY jerarquico = REUSE_ALV_HIERSEQ_LIST_DISPLAY

Acceder a esta publicación

Creado y Compartido por: Oscar Sebastian Caicedo Carlier / Disponibilidad Laboral: PartTime + Carta Presentación

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

AVL (ABAP List Viewer) Es una herramienta eclusiva de ABAP, que se usa para crear reportes de manera eficaz, rapida y estandarizada. Su principales ventasjas son: -simplifican el desarrollo de reportes, por lo tanto se reducen lso tiempos de programacion. -proporcionan a nuestros reportes un monton de funcionalidad estandar. -proporcionan una salida por pantalla estandarizada e uniforme. La creacionde reportes AVL, se basa en la utilizacion de funciones. Los tipos de AVL que mas se usan son 3: Grillas, Listas y Jerarquico. Las grillas y las lsitas pueden usarse en cualquier reporte pero el Jerarquico se usa solo en los casos donde se muestran datos de cabecera y de detalle, como por ejemplo numeros de facturas y detalles o Aerolineas y vuelos....

Acceder a esta publicación

Creado y Compartido por: Bruno Edgardo Gallinoto / Disponibilidad Laboral: FullTime + Carta Presentación

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

Los principales ventajas de un reporte AVL son: *simplifica el desarrollo de reportes *proporciona a nuestros reportes un monton de funcionalidad estandar. *proporciona una salida por pantalla estandarizada e uniforme. Los tipos de AVL mas comunes son: *grillas *listas *jerarquicos

Acceder a esta publicación

Creado y Compartido por: Melissa Rodriguez Dominguez

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Master

Un ALV es una herramienta ABAP que se utiliza para crear reportes de manera eficaz, rápida y estandarizada, brinda una forma mas presentable a los reportes, podemos destacar sobre los ALV los siguiente: Clasifica la información de forma ascendente o descendente. se puede filtrar la información. se puede seleccionar unicamente los campos que se quieren visualizar y modificar las columnas para adecuarlo a la necesidad del usuario. simplifica el desarrollo de los reportes, reduciendo el tiempo de programación.

Acceder a esta publicación

Creado y Compartido por: William Alejandro Lemus

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP SemiSenior

Resumen Lección: Reportes ALV: Grillas y Listas Que es un ALV (ABAP List Viewer) Es una herramienta exclusiva de ABAP, que se utiliza para crear reportes de manera eficaz, rápida y estandarizada. Las principales ventajas de los reportes ALV son: Simplifican el desarrollo de reportes, por lo tanto se reducen los tiempos de programación. Proporcionan a nuestros reportes un montón de funcionalidad estándar. Proporcionan una salida por pantalla estandarizada e uniforme. La creación de un reporte ALV, se basa en la utilización de funciones. Los tipos de ALV mas comúnmente usados son tres: Grillas, Listas y Jerárquico. Las grillas y las Listas pueden utilizarse en cualquier...

Acceder a esta publicación

Creado y Compartido por: Alexander José Tovar Rodríguez

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

1| QUE ES UN ALV UNA HERRAMIENTA EXCLUSIVA DE ABAP QUE SE UTILIZA PARA CREAR REPORTES DE MANERA EFICAZ RAPIDA Y ESTANDARIZADA LAS PRINCIPALES VENTAJAS DE LOS REPORTES ALV SON: SIMPLIFICAN EL DESARROLLO DE REPORTES PROPORCIONAN A NUESTROS REPORTES UN MONTON DE FUNCIONALIDAD ESTANDAR PROPORCIONAN UNA SALIDA POR PANTALLA ESTANDARIZADA E UNIFORME LOS TIPOS DE ALV MAS COMUNES SON GRILLAS, LISTAS Y JERARQUICO. LAS GRILLAS Y LAS LISTAS PUEDEN UTILIZARSE EN CUALQUIER REPORTE, PERO EL JERARQUICO SE UTILIZA SOLO EN LOS CASOS DONDE SE MUESTRAN DATOS DE CABECERA Y DETALLE. GRILLAS REUSE_ALV_GRID_DISPLAY LISTAS REUSE_ALV_LIST_DISPLAY JERARQUICO REUSE_ALV_HIERSEQ_LIST_DISPLAY 2| MI PRIMER REPORTE ALV PASO 1 DECLARACION DE TIPOS, ESTRUCTURAS Y TABLAS PROPIAS...

Acceder a esta publicación

Creado y Compartido por: Luis Eugenio Leyva Orozco

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

Unidad 5 - ALV:Grillas y Listas ALV (ABAP List Viewer): herramienta exclusiva para crear reportes de manera eficaz, rapida y estandarizada. Ventajas: 1. Simplican desarollo de reportes, por lo tanto se reducen los tiempos de prog. 2. Proporcionan a nuestros reportes un monton de funcionalidad estandar. 3. Proporcionan una salida por pantalla estandariada e uniforme. Los tres tipos mas comunes de ALV son Grillas, Listas y Jerarquico. Variable para declarar el programa dentro del ALV es SY-REPID Variable para delcarar para configuracion de salida, SLIS_LAYOUT_ALV para las tablas y estructura, SLIS_T_FIELDCAT_ALV y SLIS_FIELDCAT_ALV

Acceder a esta publicación

Creado y Compartido por: Matias Ciutat

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Master

reportes ALV: son tipos de reportes que permiten agilizar el desarrollo de programas, entre estos estan grillas, listas y jerarquico el cual se utiliza para tipos de reporte cabecera-detalle

Acceder a esta publicación

Creado y Compartido por: Rainer Diaz

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

ALV (ABAP list Viewer): Se utiliza para crear reportes de manera eficaz, rapida y estandarizada. Ventajas de los ALV: Simplican el desarrollo de reportes, por lo que reducen los tiempos de programacion. Proporcionan a los reportes un monton de funcionalidad estandar. proporcionan una salida por pantalla estandarizada y uniforme. La creacion de un reporte ALV se basa en la utilizacion de funciones los tipos de ALV mas usados son tres: GRILLAS: cuya funcion correspondiente es REUSE ALV GRID DISPLAY. LISTAS: cuya funcion correspondiente es REUSE ALV LIST DISPLAY. JERARQUICO (se utlizan en los casos donde se muestran datos de cabecera y de detalle): sy funcion correspondientes es REUSE ALV HIERSEQ LIST DISPLAY.

Acceder a esta publicación

Creado y Compartido por: Gema Moreno Ferreiro

 


 

👌Genial!, estos fueron los últimos artículos sobre más de 79.000 publicaciones académicas abiertas, libres y gratuitas compartidas con la comunidad, para acceder a ellas le dejamos el enlace a CVOPEN ACADEMY.

Buscador de Publicaciones:

 


 

No sea Juan... Solo podrá llegar alto si realiza su formación con los mejores!