✒️ABAP / Los reportes ALV Por Jaime Gomez Arango

Selector Alummnos / Empresas

CVOSOFT UNITED STATES OF AMERICA | 17 años de ingeniería dedicados a formación profesional de Consultores SAP | +info

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"


 

Escanear / Compartir

 

 


Sobre el autor

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

SAP Expert


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:

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 Expert


El ALV (ABAP List Viewer) es una herramienta exclusiva de ABAP diseñada para la creación de reports de manera eficaz, rápida y estandarizada. 1. Ventajas Clave del ALV Las principales ventajas de utilizar reports ALV son: Estandarización y Uniformidad: Proporcionan una salida en pantalla estandarizada y uniforme. Funcionalidades Estándar Integradas: Ofrecen muchas funcionalidades estándar sin necesidad de codificación manual. Entre ellas se encuentran opciones para: Clasificación (ascendente y descendente). Aplicar filtros y obtener totales. Ordenar u ocultar columnas. Exportar resultados a Microsoft Excel, archivos locales (.TXT, .XLS), archivos...

Acceder a esta publicación

Creado y Compartido por: Gabriel José Luces González

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

SAP Senior

¿Qué es el ALV? · ALV = ABAP List Viewer. Es una herramienta de SAP para hacer reportes que ya trae muchísimas funciones incorporadas: ordenar, filtrar, sumar, exportar a Excel, etc. · Es mucho más profesional y rápido de desarrollar que un reporte con WRITE. Tipos de ALV: 1. ALV Grid (GRID): Se ve como una tabla de Excel. Es el más moderno y usado. 2. ALV List (LISTA): Se ve como un listado tradicional, pero con las funciones ALV. 3. ALV Jerárquico: Para mostrar información con estructura de cabecera y detalle (como una factura con sus líneas). ¿Cómo se hace un ALV? (Pasos generales) 1. Declaro mis datos: Una tabla interna con la información...

Acceder a esta publicación

Creado y Compartido por: Mara Fadua Romero Hernandez

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

SAP Master


Introducción y creación de ALV ¿Qué es un ALV? ALV (ABAP List Viewer) es una herramienta exclusiva de ABAP para crear reportes de forma eficaz, rápida y estandarizada. Ventajas principales: simplifica el desarrollo de reportes, reduce los tiempos de programación y ofrece muchas funcionalidades estándar para manipular los resultados. Funciones integradas: clasificación, totales, filtros, orden por columnas, ocultar columnas y exportar resultados a Excel, CSV, HTML, entre otros. Proporciona una salida estandarizada y uniforme en pantalla. Evolución histórica de los reportes ALV La primera herramienta fue la "lista ABAP" con salida basada en la sentencia WRITE,...

Acceder a esta publicación

Creado y Compartido por: Juan Ignacio Romero

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

SAP Master

Introducción: ALV (ABAP List Viewer) es el estándar de SAP para crear reportes interactivos con funciones avanzadas (filtros, totales, exportación a Excel). 1 ¿Qué es ALV? Definición clave: "Framework ABAP para generar listados tabulares con funcionalidades integradas (ordenar, filtrar, calcular totales) y diseño estandarizado." Ventajas principales: Reducción de código: Hasta un 70% menos que con WRITE tradicional. Funcionalidades listas: Filtros dinámicos Totales/subtotales automáticos Exportar a Excel/PDF/HTML Ocultar/ordenar columnas...

Acceder a esta publicación

Creado y Compartido por: Oscar Aravena Muller / Disponibilidad Laboral: FullTime

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

SAP Expert


Los reportes ALV 1 Qué es un ALV? El ALV (ABAP List Viewer) es una herramienta exclusiva del lenguaje ABAP que permite crear reportes de forma eficiente, rápida y estandarizada. Su objetivo es simplificar el desarrollo de reportes al ofrecer una estructura uniforme para la presentación de datos y muchas funcionalidades integradas. Principales ventajas del ALV: Facilita el desarrollo reduciendo tiempos de programación. Proporciona funcionalidades estándar, como: Ordenamiento por columnas. Filtros y subtotales. Clasificación y ocultamiento de columnas. Exportación de resultados...

Acceder a esta publicación

Creado y Compartido por: Geovanny Martínez Campoverde

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

SAP Expert



¿Qué son los Reportes ALV en SAP? Los reportes ALV (Approved Vendor List) en SAP hacen referencia a los informes o listados que permiten identificar a los proveedores aprobados para la adquisición de productos o servicios dentro de una organización. Esta lista contiene proveedores que han cumplido con ciertos criterios establecidos por la empresa, como calidad, cumplimiento de entregas, precios competitivos, cumplimiento contractual, entre otros. En SAP, aunque el término “ALV” no siempre aparece literalmente en el sistema estándar, su funcionalidad se implementa a través de distintas herramientas, especialmente en el módulo MM (Materials Management), y se puede reforzar con...

Acceder a esta publicación

Creado y Compartido por: David Ibarra / Disponibilidad Laboral: FullTime + Carta Presentación

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

SAP Senior

Los reportes ALV 1. Que es un ALV Es una herramienta exclusiva de ABAP que se utiliza para crear reportes de manera eficaz, rapida y estandarizada. Sus siglas significan ABAP List Viewer 3. La creación de un ALV mediante módulos de funciones Los tipos de ALV más comunmente utilizados son 3: 1. Grillas 2. Listas 3. Jerárquico Las grillas y las listas pueden utilizarse en cualquier reporte, pero el jerárquico se utiliza solo en los casos donde se muestran datos de cabecera y de detalle, como por ejemplo los números de factura. Cada tipo de ALV le corresponde un modulo de funciones diferentes > Para las grillas utilizamos el módulo de funciones: REUSE_ALV_GRID_DISPLAY > Para las listas utilizamos...

Acceder a esta publicación

Creado y Compartido por: Yeny Gisela Yanes Bautista

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

SAP Senior

N°5 Los reportes ALV ¿Qué es un ALV? ALV ( ABAP List viewer)Es una herramienta exclusiva de ABAP que se utiliza para crear reportes de manera eficaz y estandarizada. (La declaracion del tipo SLIS es necesario para la utilizacion de un reporte ALV). Ventajas: simplifican el desarrollo de reportes, proporciona funcionalidades estandar, posee multiples opciones para manipular los resultados como la clasificacion, obtener totales, aplicar filtros, el ordenamiento por columnas, la posibilidad de ocultar columnas y tambien posee funciones para exportar resultados en Excel, fichero local, archivos CSV o en formato HTML. Historia de los reportes ALV: La lista ABAP: la primera herramienta para la salida de datos en pantalla,...

Acceder a esta publicación

Creado y Compartido por: Lautaro Gabriel Dominici

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

SAP Senior

Reportes ALV (ABAP List Viewer) Es una herramienta de ABAP que se usa para crear reportes de manera eficaz, rapida y estandarizada, sus ventajas son: Simplifica el desarrollo de reportes y los tiempos de programacion. Porporcionan funcionalidades estandar y funciones integradas para manipular resultados como: clasificacion, obtener totales, aplicar filtros, ordenar por columnas o ocutar columnas, exportar resultados a Excel, a un fichero local, archivos CSV, formato HTML, entre otras. Salida de datos por pantalla estandarizada e uniforme. Hay varias opciones a tener en cuenta a la hora de crear un reporte ALV: La lista ABAP: fue la primera herramienta, esta salida se genera usando WRITE para mostrar los datos por pantalla,...

Acceder a esta publicación

Creado y Compartido por: Luciano Martinez / Disponibilidad Laboral: FullTime + Carta Presentación

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

SAP Expert


ALV. Es un tipo de reporte especifico de ABAP donde el sistema nos proporciona una gran cantidad de funcionalidades para agregar a nuestro reporte, tal como la impresión, enviar a excel, ordenar, clasificar, etc. Los tipos de ALV más utilizados son: Grillas Listas Jerárquico Las grillas son reportes que estan encuadrados en tablas. Las listas es un tipo de reporte similar a cuando se muestran los datos con write, pero con una serie de botón de comando. El jerárquico es un listado cabecera/detalle, como por ejemplo una factura y sus posiciones. Dados que los reportes ALV requieren de la interaccion del usuario ya que porporcionan muchas funcionalidades estandar que el usuario desde el repote puede...

Acceder a esta publicación

Creado y Compartido por: Jose Medina / Disponibilidad Laboral: FullTime + Carta Presentación

 


 

👌Genial!, estos fueron los últimos artículos sobre más de 99.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:


🔎Googlear en CVOSOFT:
Googlear: "ABAP - Los reportes ALV"

 


 

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