Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

END OF PAGE IN BLOCK ALV : PLZ HELP

Hi experts.

I have a requirement to display top-of-page end-of-page end-of-list in block alv but the problem is that end-of-page is not getting triggered instead top-of-page is getting triggered twice.

Below is the code for your reference :

REPORT zbhr_workers_comp_report

LINE-COUNT 60(4)

LINE-SIZE 999

NO STANDARD PAGE HEADING

MESSAGE-ID zmhr.

*//// This is how event table is getting populated:*

FORM events_get1 CHANGING t1_events TYPE slis_t_event.

DATA:ls1_events TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

IMPORTING

et_events = t1_events.

READ TABLE t1_events INTO ls1_events WITH KEY name = slis_ev_top_of_page.

IF sy-subrc = 0.

MOVE c_form_top_of_page TO ls1_events-form.

  • APPEND ls1_events TO t1_events.

modify t1_events FROM ls1_events INDEX sy-tabix TRANSPORTING form.

CLEAR ls1_events.

ENDIF.

READ TABLE t1_events INTO ls1_events WITH KEY name = slis_ev_end_of_page.

IF sy-subrc = 0.

MOVE c_form_end_of_page TO ls1_events-form.

  • APPEND ls1_events TO t1_events.

modify t1_events FROM ls1_events INDEX sy-tabix TRANSPORTING form.

CLEAR ls1_events.

ENDIF.

READ TABLE t1_events INTO ls1_events WITH KEY name = slis_ev_end_of_list.

IF sy-subrc = 0.

MOVE c_form_end_of_list TO ls1_events-form.

  • APPEND ls1_events TO t1_events.

modify t1_events FROM ls1_events INDEX sy-tabix TRANSPORTING form.

CLEAR ls1_events.

ENDIF.

ENDFORM. " EVENTS_GET1

**********************************************************************

  • FORM : TOP_OF_PAGE

**********************************************************************

FORM top_of_page.

WRITE : /45 text-020, 65(5) text-021 , 71(11) v_begda, 84(3) text-022 , 89(11) v_endda.

ENDFORM. "TOP_OF_PAGE

**********************************************************************

  • FORM : end_of_page

**********************************************************************

FORM end_of_page.

DATA: lv_process TYPE i.

CLEAR: lv_process.

LOOP AT t_final_temp INTO w_final_temp where customer = t_final-customer.

lv_process = lv_process + 1.

ENDLOOP.

*RESERVE 3 LINES.

WRITE: /4 'Number of read Record : '(023), v_total_read.

WRITE: /4 'Number of processed Record : '(024), lv_process.

ENDFORM. "end_of_page

**********************************************************************

  • FORM : end_of_list

**********************************************************************

FORM end_of_list .

v_total_process = LINES( t_final[] ).

WRITE: /4 'Total sum of all processed data: '(029), v_total_process.

ENDFORM. "end_of_list

*****Displaying the block alv.

FORM display_output .

      • To restrict the display of sel info and list info.

st_print-no_print_selinfos = 'X'.

st_print-no_print_listinfos = 'X'.

st_print-reserve_lines = 2. " Lines reserved for end of page

      • Initialize ALV Block List

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

i_callback_program = sy-repid.

      • Append the ALV Block list with table t_final.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = w1_layout

it_fieldcat = t1_fieldcat

i_tabname = 'T_FINAL'

it_events = t1_events

it_sort = t_sort

TABLES

t_outtab = t_final

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

      • Append the ALV Block list with table t_msg_display.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = w2_layout

it_fieldcat = t2_fieldcat

i_tabname = 'T_MSG_DISPLAY'

it_events = t2_events

TABLES

t_outtab = t_msg_display

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

EXPORTING

i_interface_check = ' '

is_print = st_print

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. " DISPLAY_OUTPUT

Above is the core logic which I have used for displaying top-of-page end-of-page and end-of-list in block alv.

Please Help

Regards

Arvind.

Tags:
Not what you were looking for? View more on this topic or Ask a question