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: 

Runtime Error while Displaying End of Page in ALV

former_member188829
Active Contributor
0 Kudos

Hi,

This is the Code i have written.. The top of page is printing when i comment the end of page in the program (BOLD FORMAT)..But when Uncomment the End of page Code this is going to Short dump..and the Runtime Error is..

A PERFORM was used to call the routine "END_OF_LIST" of the program "ZPROGRAM

".

This routine contains exactly 0 formal parameters, but the current

call contains 1 actual parameters.

*&----


*

*& Form DISPLAY_ALV_VBAP

*&----


*

FORM DISPLAY_ALV_VBAP .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE1'

I_CALLBACK_HTML_END_OF_LIST = 'END_OF_LIST'

I_GRID_TITLE = 'THIS IS LAST'

IS_LAYOUT = WA_LAYO

IT_FIELDCAT = I_FIELDCAT

TABLES

T_OUTTAB = IT_VBAP

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_ALV_VBAP

&----


*& Form top_of_page1

&----


  • text

----


FORM TOP_OF_PAGE1.

DATA:IT_LISTHEAD2 TYPE SLIS_T_LISTHEADER.

DATA:WA_LISTHEAD2 TYPE SLIS_LISTHEADER.

WA_LISTHEAD2-TYP = 'H'.

WA_LISTHEAD2-INFO = 'THIS IS TOP OF PAGE FOR SECOND LIST'.

APPEND WA_LISTHEAD2 TO IT_LISTHEAD2.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_LISTHEAD2

I_LOGO = 'ENJOYSAP_LOGO'.

ENDFORM. "top_of_page1

&----


*& Form end_of_list

&----


  • text

----


FORM END_OF_LIST.

DATA:IT_LISTHEAD1 TYPE SLIS_T_LISTHEADER.

DATA:WA_LISTHEAD1 TYPE SLIS_LISTHEADER.

WA_LISTHEAD1-TYP = 'H'.

WA_LISTHEAD1-INFO = 'THIS IS END OF PAGE FOR SECOND LIST'.

APPEND WA_LISTHEAD1 TO IT_LISTHEAD1.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_LISTHEAD1

I_LOGO = 'ENJOYSAP_LOGO'

I_END_OF_LIST_GRID = 'X'

.

ENDFORM.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

The "END_OF_LIST" event is not called as you have called it.

First capture END_OF_LIST as an event in your events table.

Then use it.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE1'

I_CALLBACK_HTML_END_OF_LIST = 'END_OF_LIST' <----- Wrong

I_GRID_TITLE = 'THIS IS LAST'

IS_LAYOUT = WA_LAYO

IT_FIELDCAT = I_FIELDCAT

TABLES

T_OUTTAB = IT_VBAP

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_ALV_VBAP

Build an events table like this :

FORM build_events.

DATA: ls_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = gt_events[]

EXCEPTIONS

list_type_wrong = 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.

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.

And then use the END_OF_list form as you have defined.

Hope that helps.

Cheers

Ravish

2 REPLIES 2

Former Member
0 Kudos

Hi

The "END_OF_LIST" event is not called as you have called it.

First capture END_OF_LIST as an event in your events table.

Then use it.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE1'

I_CALLBACK_HTML_END_OF_LIST = 'END_OF_LIST' <----- Wrong

I_GRID_TITLE = 'THIS IS LAST'

IS_LAYOUT = WA_LAYO

IT_FIELDCAT = I_FIELDCAT

TABLES

T_OUTTAB = IT_VBAP

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_ALV_VBAP

Build an events table like this :

FORM build_events.

DATA: ls_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = gt_events[]

EXCEPTIONS

list_type_wrong = 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.

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.

And then use the END_OF_list form as you have defined.

Hope that helps.

Cheers

Ravish

0 Kudos

Hi Ravish,

You are Right..First i Captured END_OF_LIST Event into Event Table..like this..

DATA: IT_EVENTS TYPE SLIS_T_EVENT,

WA_EVENT TYPE SLIS_ALV_EVENT.

wa_event-name = 'END_OF_LIST'.

wa_event-form = 'LIST_END'.

append wa_event to it_events.

and then i passed that it_events in the parameter IT_EVENTS of REUSE_ALV_GRID_DISPLAY..

and writeen code like this...

FORM LIST_END.

DATA:IT_LISTHEAD1 TYPE SLIS_T_LISTHEADER.

DATA:WA_LISTHEAD1 TYPE SLIS_LISTHEADER.

WA_LISTHEAD1-TYP = 'H'.

WA_LISTHEAD1-INFO = 'THIS IS END OF PAGE FOR SECOND LIST'.

APPEND WA_LISTHEAD1 TO IT_LISTHEAD1.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_LISTHEAD1

I_LOGO = 'ENJOYSAP_LOGO'

I_END_OF_LIST_GRID = 'X'.

ENDFORM.