Application Development and Automation 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: 
Read only

Runtime Error when Usercommand event is fired in ALV

Former Member
0 Likes
367

Hi all,

i'm writing ALv report and i successfully got Top of Page and End of List but when im try to fire Usercommand a run time error .

ERROR:

Too many parameters specified with PERFORM.

Error analysis

A PERFORM was used to call the routine "GENERATE_USER_COMMAND

"ZSAP1_ALV ".

This routine contains exactly 0 formal parameters, but the cu

call contains 2 actual parameters.

parameters.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

  • EXPORTING

  • I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = IT_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.

WA_EVENTS-NAME = 'TOP_OF_PAGE'.

WA_EVENTS-FORM = 'TOP_FORM'.

APPEND WA_EVENTS TO IT_EVENTS.

CLEAR WA_EVENTS.

WA_EVENTS-NAME = 'END_OF_LIST'.

WA_EVENTS-FORM = 'END_OF_FORM'.

APPEND WA_EVENTS TO IT_EVENTS.

CLEAR WA_EVENTS.

WA_EVENTS-NAME = 'USER_COMMAND'.

WA_EVENTS-FORM = 'GENERATE_USER_COMMAND'.

APPEND WA_EVENTS TO IT_EVENTS.

*ENDIF.

and after this i created a form for Generate_user_command.

using perform keyword.

Please help me...

Thanks in Advance

Kiran.

2 REPLIES 2
Read only

Former Member
0 Likes
345

The Error you are getting due to the Subroutine intterface parameters.

Use the Dynamic Subroutine for User_Command.

FORM user_command USING r_ucomm LIKE sy-ucomm
                                    rs_selfield TYPE slis_selfield.
CODE.       
ENDFORM.

Regards,

Gurpreet

Read only

Former Member
0 Likes
345

Hi

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
* EXPORTING
* I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_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.

" You shold not append the events to IT_EVENTS table. as all the alv events will 
" get populated from the above FM.you need to modify the required events with the formnames.
READ TABLE IT_EVENTS INTO  WA_EVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENTS-FORM = 'TOP_FORM'.
MODIFY TABLE IT_EVENTS FROM WA_EVENTS TRANSPORTING  FORM INDEX SY-TABIX.
ENDIF.

READ TABLE IT_EVENTS INTO  WA_EVENTS WITH KEY NAME = 'END_OF_LIST'.
IF SY-SUBRC EQ 0.
WA_EVENTS-FORM = 'END_OF_FORM'.
MODIFY TABLE IT_EVENTS FROM WA_EVENTS TRANSPORTING  FORM INDEX SY-TABIX.
ENDIF.

READ TABLE IT_EVENTS INTO  WA_EVENTS WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENTS-FORM = = 'GENERATE_USER_COMMAND'.
MODIFY TABLE IT_EVENTS FROM WA_EVENTS TRANSPORTING  FORM INDEX SY-TABIX.
ENDIF.

FORM GENERATE_USER_COMMAND USING r_ucomm LIKE sy-ucomm
                                    rs_selfield TYPE slis_selfield.
" Write the code here
ENDFORM.