Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Top-of-page is displayed blank

Former Member
0 Kudos

Hi Friends,

Good Day all!!

Can any one guide me, when i use top of page with events as per below code i get a blank top of page in ALV output..

FORM build_header.

CLEAR wa_listheader.

wa_listheader-typ  = 'A'.

wa_listheader-info ='SAP ALV Report'.

APPEND wa_listheader TO it_listheader.

endform.



form display_header.

   CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

     EXPORTING

       IT_LIST_COMMENTARY = it_listheader.

ENDFORM.


form display_alv.

v_repid = sy-repid.

   sort gt_out_table by empid.

   s_alv_event-name = 'TOP_OF_PAGE'.

   s_alv_event-form = 'display_header'.

   APPEND s_alv_event TO i_alv_event.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

       i_callback_program     = v_repid   "Report ID

       is_layout              = v_layout  "Layout

       it_fieldcat            = t_fcat    "Field catalog

       IT_EVENTS              = i_alv_event

     TABLES

       t_outtab               = gt_out_table.   "Output table

endform.


Please guide me what has to be changed so that i data gets populated on top of page.


Thanks a lot in advance for your help!

Regards,

Archana

1 ACCEPTED SOLUTION

pranay570708
Active Contributor
0 Kudos

Hi,

1. Pass form name in CAPS -> s_alv_event-form = 'DISPLAY_HEADER'.

2. Your 'build_header' subroutine is not getting called anywhere inside 'display_header', that's why TOP-of-page is coming blank. Inside 'display_header', call 'build_header' like below:

form display_header.

perform build_header.

   CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

     EXPORTING

       IT_LIST_COMMENTARY = it_listheader.

ENDFORM.

5 REPLIES 5

satvik_panchal
Participant
0 Kudos

In 'REUSE_ALV_GRID_DISPLAY', u will have to declare one more parameter for calling your top of page event

lord339
Explorer
0 Kudos

Hi,

This sample code will help you

DATA:   form_top_of_page  type slis_formname value 'FORM_TOP_OF_PAGE'.

call function 'REUSE_ALV_GRID_DISPLAY'

     exporting

       i_callback_program      = sy-repid

       i_callback_user_command = form_callback

       i_callback_top_of_page  = form_top_of_page

       is_layout               = it_layout

       it_fieldcat             = it_fieldcat

     tables

       t_outtab                = it_mara

     exceptions

       program_error           = 1

       others                  = 2.




form form_top_of_page.

   data: it_header type slis_t_listheader,

         wa_header type slis_listheader,

         lv_line like wa_header-info,

         ld_lines type i,

         ld_linesc(10) type c.

   " Title

   wa_header-typ  = 'H'.

   wa_header-info = 'MARA Master Report'.

   append wa_header to it_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 it_header.

   clear: wa_header.

   " Date

   wa_header-typ  = 'S'.

   wa_header-key = 'User: '.

   concatenate  sy-uname ' ' into wa_header-info.   "Logged in user

   append wa_header to it_header.

   clear: wa_header.

   " Total No. of Records Selected

   describe table  it_mara lines ld_lines.

   ld_linesc = ld_lines.

   concatenate 'Total No. of Records Selected: ' ld_linesc

                     into lv_line separated by space.

   wa_header-typ  = 'A'.

   wa_header-info = lv_line.

   append wa_header to it_header.

   clear: wa_header, lv_line.

   call function 'REUSE_ALV_COMMENTARY_WRITE'

     exporting

       it_list_commentary = it_header.

   clear it_header.

endform.

Former Member
0 Kudos

Hi,


When i defined the below statement s_alv_event-form = 'display_header' as s_alv_event-form = 'DISPLAY_HEADER' i got output.


Thanks a lot for your support!!


Have a great day!!


Regards,

Archana


vamsilakshman_pendurti
Active Participant
0 Kudos

Hi Archana ,

You need to change this display_header into Capital letters... as like shown below bold Letters Statement...

Then your code will be fine....

s_alv_event-name = 'TOP_OF_PAGE' .

s_alv_event-form = 'DISPLAY_HEADER' .

Append s_alv_event to i_alv_Event .

Reply me when it works fine ....

Thanks ,

Vamsi .

pranay570708
Active Contributor
0 Kudos

Hi,

1. Pass form name in CAPS -> s_alv_event-form = 'DISPLAY_HEADER'.

2. Your 'build_header' subroutine is not getting called anywhere inside 'display_header', that's why TOP-of-page is coming blank. Inside 'display_header', call 'build_header' like below:

form display_header.

perform build_header.

   CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

     EXPORTING

       IT_LIST_COMMENTARY = it_listheader.

ENDFORM.