Buenos dias.
Tengo un problema con un ALV. Estoy haciendo un alv grid, para mostrar un reporte y quería agregarle una cabecera. El problema que tengo, es que agrego la cabecera pero no me muestra los datos, siempre sale vacía. Ya busque por todos lados y no encuentro la solución. Dejo el código a ver si alguien me puede ayudar

Código:
FORM imp_datos.
DATA: l_level LIKE sy-tabix.
DATA: l_first(1).
DATA: l_last(1).
DATA: l_third(4) TYPE n.
DATA: r_necesidades LIKE i_necesidades.
*ALV data declarations
TYPE-POOLS: slis.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
gd_tab_group TYPE slis_t_sp_group_alv,
ls_layout TYPE slis_layout_alv,
ls_variant TYPE disvariant,
lt_sort TYPE slis_t_sortinfo_alv,
lw_nec_ext TYPE zer_necesi_ext,
* gd_repid like sy-repid,
gt_events TYPE slis_t_event.
* gd_prntparams type slis_print_alv.
PERFORM fill_catalog CHANGING lt_fieldcat.
PERFORM fill_sort CHANGING lt_sort.
PERFORM build_events CHANGING gt_events.
ls_layout-zebra = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_variant-report = sy-repid.
* APPEND LINES OF i_necesidades TO i_necesidades_ext.
LOOP AT i_necesidades.
lw_nec_ext-matnr = i_necesidades-matnr.
lw_nec_ext-maktx = i_necesidades-maktx.
lw_nec_ext-delb0 = i_necesidades-delb0.
lw_nec_ext-delnr = i_necesidades-delnr.
lw_nec_ext-dat00 = i_necesidades-dat00.
lw_nec_ext-mng01 = i_necesidades-mng01.
lw_nec_ext-delb1 = i_necesidades-delb1.
lw_nec_ext-delnrel = i_necesidades-delnrel.
lw_nec_ext-dat00el = i_necesidades-dat00el.
lw_nec_ext-mng01el = i_necesidades-mng01el.
lw_nec_ext-revlvel = i_necesidades-revlvel.
lw_nec_ext-zben = i_necesidades-zben.
lw_nec_ext-aetx0 = i_necesidades-aetx0.
lw_nec_ext-datu1 = i_necesidades-datu1.
lw_nec_ext-werksel = i_necesidades-werksel.
APPEND lw_nec_ext TO i_necesidades_ext.
ENDLOOP.
SORT i_necesidades_ext. "BY matnr maktx delb0 delnr dat00 mng01 delb1.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'ZER_NECESI_EXT'
i_callback_top_of_page = 'TOP-OF-PAGE'
i_grid_title = sy-title
is_layout = ls_layout
i_save = 'A'
it_events = gt_events
is_variant = ls_variant
it_sort = lt_sort
TABLES
t_outtab = i_necesidades_ext[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
Código:
FORM top-of-page.
*ALV Header declarations
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
* Title
wa_header-typ = 'H'.
wa_header-info = sy-title.
APPEND wa_header TO t_header.
CLEAR wa_header.
* Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
APPEND wa_header TO t_header.
CLEAR: wa_header.
* Usuario
wa_header-typ = 'S'.
wa_header-key = 'Usuario: '.
wa_header-info = sy-uname.
APPEND wa_header TO t_header.
CLEAR: wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
ENDFORM.
Código:
FORM build_events CHANGING gt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_events[].
READ TABLE gt_events WITH KEY name = slis_ev_end_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE 'END_OF_PAGE' TO ls_event-form.
APPEND ls_event TO gt_events.
ENDIF.
READ TABLE gt_events WITH KEY name = slis_ev_end_of_list
INTO ls_event.
IF sy-subrc = 0.
MOVE 'END_OF_LIST' TO ls_event-form.
APPEND ls_event TO gt_events.
ENDIF.
ENDFORM.
Comentario