cancel
Showing results for 
Search instead for 
Did you mean: 

ALV END-OF-PAGE

Former Member
0 Kudos

Hello all ,

I am writeing one alv report .

Would u please tell me how to write END-OF-PAGE.

Footer : No of records processed.

Please send me one example program.

Regards,

vandana.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Vandana,

As Vinaykumar says the event END-OF-PAGE triggers only when we give the print ( or Execute in back ground where the spool is generated ).

So, if you want to display the Footer ( No of records processed ) you can display it on the TOP-OF-PAGE of the next page.

The disadvantage in this is when the user wants to see it on screen first and then give the print, the user sees the grid correctly. but when he gives the print the footer is printed on the top of page of the next page.

The other option is:

Step 1 : Limit the no of items printed on each page ( consider 10 ).

Step 2 : In the item table add one more field page type sy-pagno. This field has to be incremented for every 10 items.

Step 3 : Populate the sort table with this new field so that page trigger happens affter every 10 items.

l_sort-fieldname = 'PAGE'.

l_sort-group = '*'.

Step 4 : Use the even after_line_output to get the current record that is being printed.

form after_line_output using fp_rs_lineinfo type slis_lineinfo.

fp_rs_lineinfo-tabindex indicates the current record number.

Step 5 : Check if the next record number has diffent value in the field page by reading the item table.

Step 6 : If different print end of page. Ie call the perform end_of_page.

form after_line_output using fp_rs_lineinfo type slis_lineinfo.

  • Local data declaration

data: l_wa_item type ty_item, "Item details

l_v_tabix type sy-tabix. "Index cnt

l_v_tabix = fp_rs_lineinfo-tabindex + 1.

read table i_item into l_wa_item index l_v_tabix.

if sy-subrc is initial.

if l_wa_item-page ne v_page.

uline.

perform end_of_page.

v_page = l_wa_item-page.

endif.

endif.

endform. "AFTER_LINE_OUTPUT

Please reward if usefull.

Regards,

Satish.

Edited by: satish kumar varma on Mar 26, 2008 5:56 PM

Former Member
0 Kudos

hi

you have an event END_OF_PAGE.

pass this event along with the form name into the parameter IT_EVENTS.

and use your WRITE statement in the subroutine you specify for that event.


WA_EVENTS-FORM = 'END_PAGE'.
WA_EVENTS-NAME = 'END_OF_PAGE'.
APPEND WA_EVENTS TO IT_EVENTS.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
 EXPORTING
   I_CALLBACK_PROGRAM             = sy-repid
   IT_FIELDCAT                    = it_fieldcat
   IT_EVENTS                      = it_events
  TABLES
    t_outtab                      = it_final


form end_page.
write:/ 'No. of records processed:', l_tabix.
endform.

thx

pavan

Former Member
0 Kudos

Check this link.It can help you.

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_events.htm

Kindly reward points by clicking the star on the left of reply,if you find it as useful.

Former Member
0 Kudos

Hi Vandana,

I think, you can see the end of page only on Hard copies but it is not possible to see it on the screen.

You can test that by using the program BCALV_TEST_HIERSEQ_LIST_EVENTS

1. execute the above program

2.Check the check boxes top-of -page, end-of-page,top-of list,end-of-list

3. execute again

4. you will not see end-of-page in the output.

from above, not possible to watch end-of-page on the screen.

I think it can be obtained on the hard copy.

<b>Sample code:</b>

CLEAR: ls_event.

ls_event-name = 'END_OF_LIST'.

ls_event-form = 'END_OF_LIST'.

APPEND ls_event TO gt_events.

CLEAR: ls_event.

ls_event-name = 'END_OF_PAGE'.

ls_event-form = 'END_OF_PAGE'.

APPEND ls_event TO gt_events.

  • FORM END_OF_PAGE *

FORM end_of_list.

DATA: listwidth TYPE i,

ld_pagepos(10) TYPE c,

ld_page(10) TYPE c.

WRITE: sy-uline(50).

SKIP.

WRITE:/40 'No of records: '.

ENDFORM. "end_of_list

  • FORM END_OF_LIST *

FORM end_of_page.

DATA: listwidth TYPE i,

ld_pagepos(10) TYPE c,

ld_page(10) TYPE c.

SKIP. WRITE:/ 'Page:', sy-pagno .

ENDFORM. "end_of_page

Thanks,

Vinay