En el encabezado podremos distinguir tres áreas:
- Header: Se muestra el texto con un tamaño de fuente grande.
- Selection: Podremos mostrar el par de valores clave y valor.
- Action: Se muestra el texto en cursiva.
El código es el siguiente:
REPORT z_sflight. * Cargar la tabla SFLIGHT de la base de datos TABLES: sflight. * Cargamos los datos tipo slis TYPES: slis. * Definición de variables DATA: g_it_sflight TYPE TABLE OF sflight, g_st_sflight TYPE sflight. DATA: g_it_fieldcat TYPE slis_t_fieldcat_alv, g_st_fieldcat TYPE slis_fieldcat_alv. DATA: g_repid TYPE sy-repid. * SQL para copiar la tabla sflight a la tabla interna SELECT * FROM sflight INTO TABLE g_it_sflight. * Variable con el nombre del programa g_repid = sy-repid. * Datos del fieldcat para el ALV g_st_fieldcat-fieldname = 'CARRID'. g_st_fieldcat-seltext_s = 'Comp.'. APPEND g_st_fieldcat TO g_it_fieldcat. g_st_fieldcat-fieldname = 'CONNID'. g_st_fieldcat-seltext_s = 'Vuelo'. APPEND g_st_fieldcat TO g_it_fieldcat. g_st_fieldcat-fieldname = 'FLDATE'. g_st_fieldcat-seltext_s = 'Fecha'. APPEND g_st_fieldcat TO g_it_fieldcat. g_st_fieldcat-fieldname = 'PRICE'. g_st_fieldcat-seltext_s = 'Tarifa'. APPEND g_st_fieldcat TO g_it_fieldcat. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = g_repid i_callback_top_of_page = 'MI_TOP_OF_PAGE' it_fieldcat = g_it_fieldcat[] TABLES t_outtab = g_it_sflight[] EXCEPTIONS program_error = 1 OTHERS = 2. *&---------------------------------------------------------------------* *& Form mi_top_of_page *&---------------------------------------------------------------------* * *----------------------------------------------------------------------* FORM mi_top_of_page. *ALV Header declarations DATA: l_it_header TYPE slis_t_listheader, l_st_header TYPE slis_listheader, l_it_line LIKE l_st_header-info, ld_lines TYPE i, ld_linesc(10) TYPE c. * Tipo H para escribir con la fuente grande l_st_header-typ = 'H'. l_st_header-info = 'SFLIGHT DATA'. APPEND l_st_header TO l_it_header. CLEAR l_st_header. * Tipo S para indicar parámetro clave y su valor (fecha) l_st_header-typ = 'S'. "Selection l_st_header-key = 'Date: '. CONCATENATE sy-datum+6(2) '.' sy-datum+4(2) '.' sy-datum(4) INTO l_st_header-info. "Fecha de hoy APPEND l_st_header TO l_it_header. CLEAR: l_st_header. * Tipo A para escribir en cursiva l_st_header-typ = 'A'. "Action l_st_header-info = 'ALV Report'. APPEND l_st_header TO l_it_header. CLEAR: l_st_header. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = l_it_header[] i_logo = 'ENJOYSAP_LOGO'. ENDFORM. "mi_top_of_page
Top of page con imagen en un ALV Report. |
EXELENTE APORTE , GRACIAS
ResponderEliminar