Hi Every One
I have created a ALV report and its working. The problem is the header is not showing up. I mean the space for the header is there but its all blank. I used the code from another of my ALV report and there its working alright. Can anyone point to me what I did wrong this time?
************************************************************************
CALL_ALV
************************************************************************
form call_alv.
perform build_field_catalog using field_tab[].
perform build_eventtab using events[].
perform comment_build using header_alv[].
perform build_layout.
v_variant-variant = '/DETAIL'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = field_tab[]
i_structure_name = 'REC'
i_callback_program = v_repid
is_variant = v_variant
it_events = events[]
i_save = v_save
is_layout = gd_layout
tables
t_outtab = REC
exceptions
program_error = 1
others = 2.
endform.
************************************************************************
BUILD_EVENTTAB
************************************************************************
form build_eventtab using events type slis_t_event.
data: tmp_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = events.
read table events with key name = slis_ev_top_of_page
into tmp_event.
if sy-subrc = 0.
move top_of_page to tmp_event-form.
append tmp_event to events.
endif.
endform.
************************************************************************
COMMENT_BUILD
************************************************************************
form comment_build using pt_top_of_page type slis_t_listheader.
data: v_head_string(255) value space, d1(2), m1(2), y1(2), d2(2), m2(2), y2(2).
clear: ls_line, pt_top_of_page.
ls_line-typ = 'H'.
data pnpfrom(10).
data pnpto(10).
data: print_date(10).
data: print_time(10).
d1 = PNPBEGDA6(2). d2 = PNPENDDA6(2).
m1 = PNPBEGDA4(2). m2 = PNPENDDA4(2).
y1 = PNPBEGDA2(2). y2 = PNPENDDA2(2).
concatenate m1 '/' d1 '/' y1 into pnpfrom.
concatenate m2 '/' d2 '/' y2 into pnpto.
d1 = sy-datum6(2). d2 = sy-uzeit2(2).
m1 = sy-datum4(2). m2 = sy-uzeit0(2).
y1 = sy-datum2(2). y2 = sy-uzeit4(2).
concatenate m1 '/' d1 '/' y1 into print_date.
concatenate m2 ':' d2 ':' y2 into print_time.
ls_line-info = sy-repid.
append ls_line to pt_top_of_page.
concatenate 'Printed by:' sy-uname 'on' print_date 'at' print_time
into ls_line-info separated by space.
append ls_line to pt_top_of_page.
ls_line-info = 'BGM INDUSTRIES, INC.'.
append ls_line to pt_top_of_page.
concatenate 'Supply Period:' pnpfrom 'to' pnpto
into ls_line-info separated by space.
append ls_line to pt_top_of_page.
endform.
************************************************************************
Build layout for ALV grid report
************************************************************************
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-info_fieldname = 'LINE_COLOR'.
endform. " BUILD_LAYOUT
************************************************************************
TOP_OF_PAGE
************************************************************************
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'Z_BGLOGO'
it_list_commentary = header_alv.
endform.