📘Reuse_alv_commentary_write

Selector Alummnos / Empresas

Definición de Reuse_alv_commentary_write

Es el módulo de funciones estándar del sistema que se utiliza para mostrar el encabezado de un reporte ALV grilla.

Veamos a continuación un ejemplo de la utilización del módulo de funciones REUSE_ALV_COMMENTARY_WRITE en un reporte ALV:

REPORT ZPRUEBA_ALV_HEADER .

tables: ZTABLA_PRUEBA.

TYPE-POOLS: slis.

DATA: it_alv  LIKE TABLE OF ZTABLA_PRUEBA WITH HEADER LINE,

      gt_catalogo TYPE slis_t_fieldcat_alv WITH HEADER LINE,

      wa_header type slis_listheader,

      it_header type slis_t_listheader.

*------------------------------------------

START-OF-SELECTION.

*------------------------------------------

  SELECT * FROM ZTABLA_PRUEBA

    INTO CORRESPONDING FIELDS OF TABLE it_alv.

  PERFORM armar_catalogo.

  PERFORM llenar_header.

  PERFORM top_of_page.

  PERFORM armar_reporte.

*&---------------------------------------------------------------------*

*&      Form  armar_CATALOGO

*&---------------------------------------------------------------------*

Form armar_catalogo.

 CLEAR gt_catalogo. "******LIMPIA LA cabecera*********

 gt_catalogo-fieldname = 'NROCLI'. "***SIEMPRE EN MAYUSCULA

 gt_catalogo-tabname = 'IT_ALV'.

 gt_catalogo-ref_tabname = 'ZTABLA_PRUEBA'.

 gt_catalogo-ref_fieldname = 'NROCLI'.

 APPEND gt_catalogo.

 CLEAR gt_catalogo. "******LIMPIA LA cabecera*********

 gt_catalogo-fieldname = 'NOMBRE'. "***SIEMPRE EN MAYUSCULA

 gt_catalogo-tabname = 'IT_ALV'.

 gt_catalogo-ref_tabname = 'ZTABLA_PRUEBA'.

 gt_catalogo-ref_fieldname = 'NOMBRE'.

 APPEND gt_catalogo.

 CLEAR gt_catalogo. "******LIMPIA LA cabecera*********

 gt_catalogo-fieldname = 'STRAS'. "***SIEMPRE EN MAYUSCULA

 gt_catalogo-tabname = 'IT_ALV'.

 gt_catalogo-ref_tabname = 'ZTABLA_PRUEBA'.

 gt_catalogo-ref_fieldname = 'STRAS'.

 APPEND gt_catalogo.

 

ENDFORM.

*&---------------------------------------------------------------------*

*&      Form  armar_reporte

*&---------------------------------------------------------------------*

form armar_reporte.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

    I_CALLBACK_PROGRAM                = 'ZPRUEBA_ALV_HEADER'

    IT_FIELDCAT                       = gt_catalogo[]

    i_callback_top_of_page            = 'TOP_OF_PAGE'

   TABLES

    t_outtab                          = it_alv.

endform.

*&---------------------------------------------------------------------*

*&      Form  llenar_header

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM llenar_header.

data: fecha type date.

  wa_header-typ  = 'H'.

  wa_header-info = 'Listado de Sueldos'.

  append wa_header to it_header.

  clear  wa_header.

  wa_header-typ  = 'S'.

  wa_header-key  = 'Tipo de reporte: '.

  wa_header-info = 'ALV'.

  append wa_header to it_header.

  clear  wa_header.

  write sy-datum to fecha.

  wa_header-typ  = 'S'.

  wa_header-key  = 'Fecha: '.

  wa_header-info = fecha.

  append wa_header to it_header.

  clear  wa_header.

  wa_header-typ  = 'A'.

  wa_header-info = 'LISTADO DE COMPROBANTES DE FACTURACION'.

  append wa_header to it_header.

  clear  wa_header.

ENDFORM.                    " llenar_header

*&---------------------------------------------------------------------*

*&      Form  top_of_page

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM top_of_page.

*   it_list_commentary Va una tabla interna con los datos que quiero

*   poner en la cabecera.

  call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

      it_list_commentary       = it_header

      I_LOGO                   = 'LOGO_AGUAS'.

ENDFORM.

 

 

 

✒️+Comunidad Académica CVOSOFT

Para continuar aprendiendo, le invitamos a conocer las últimas 10 Publicaciones Académicas sobre el tema "Reuse_alv_commentary_write" creadas y compartidas abiertamente por nuestros alumnos.

SAP Master


Creación automática del catálogo ALV Se explican dos métodos para crear el catálogo de un reporte ALV: de forma manual (campo por campo) y de forma automática usando el módulo de funciones Reduce ALV Fill Catalog Merge. Para la creación automática, es necesario modificar la declaración de la tabla interna del ALV utilizando OCCURS y LIKE, haciendo referencia a una tabla de base de datos existente. Declarar la tabla con OCCURS cero permite que la estructura esté incluida en la tabla interna y evita declarar una cabecera adicional. Se debe configurar el editor ABAP para que ninguna línea de código supere los 72 caracteres de ancho, desde el menú Utilidades...

Acceder a esta publicación

Creado y Compartido por: Juan Ignacio Romero


👉Bueno, estos fueron los últimos artículos de 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.