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: 

How to capture an event after the list is displayed in an alv list

Former Member
0 Kudos

Hey

I added a Print button in the application toolbar using SE41 and called that in my Z program which displays data in an alv list.

Each record in the alv has a check box against it. And user has the option to select one/more checkboxes and push the print button , which should print the selected record details ( worked in background ).

I am not using SE51 transaction at all here. Now the issue is I am not able to trap the print button push event. The code that I am using is :-

Immediately after the functional module ALV_DISPLAY is executed ,

CASE SY_UCOMM.

WHEN 'PRNT'.

.....................

.....................

ENDCASE.

but its not working. Please advise or help what can be the missing point here from my side , which would solve the issue.

Thanks in advance

Kaushal

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

Pass the name of a subrotine to handle your user commands to the fm parameter.

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'.

Then code for the user command function,

form user_command using r_ucomm type sy-ucomm.

case r_ucomm.

when '<FCODE of your button>'.

  • Code your logic....

endcase.

endform.

To add your button using your own pf-status, you should copy a standard gui status and modify it.

To trigger this pf-status you should pass routine name to I_CALLBACK_PF_STATUS_SET.(I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS..)

form set_pf_status.

set pf-status 'ZSTAT'. "THis ZSTAT must be created by copying a STANDARD pf-status of say some std program like SAPLKKBL. and then modifying it.

endform.

1 REPLY 1

former_member181962
Active Contributor
0 Kudos

Pass the name of a subrotine to handle your user commands to the fm parameter.

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'.

Then code for the user command function,

form user_command using r_ucomm type sy-ucomm.

case r_ucomm.

when '<FCODE of your button>'.

  • Code your logic....

endcase.

endform.

To add your button using your own pf-status, you should copy a standard gui status and modify it.

To trigger this pf-status you should pass routine name to I_CALLBACK_PF_STATUS_SET.(I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS..)

form set_pf_status.

set pf-status 'ZSTAT'. "THis ZSTAT must be created by copying a STANDARD pf-status of say some std program like SAPLKKBL. and then modifying it.

endform.