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

Problem Executing Custom Button On ALV Grid

Former Member
0 Likes
2,824

Hello,

I have used the hierarchical ALV grid function and I have added a button to the toolbar with the name &PS, I have activated the GUI Status and also added the line I_CALLBACK_USER_COMMAND = 'user_command' into the ALV call. I have created a function called user command IF r_ucomm EQ '&ETA' but when I click the button in the form nothing happens. Have I missed a line of code somewhere?

Thanks

Katie

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,137

Change 'user_command' to 'USER_COMMAND' (upper case) and make sure it is spelled the same in both cases.

Rob

16 REPLIES 16
Read only

Former Member
0 Likes
2,137

Where do you have this IF statement in your program (at user command, pai) ? Have you tried putting a breakpoint there to see if it catches?

Read only

0 Likes
2,137

hi,

i`m not sure but try to write in upper case:

I_CALLBACK_USER_COMMAND = 'user_command'

regards,

christian

Read only

Former Member
0 Likes
2,138

Change 'user_command' to 'USER_COMMAND' (upper case) and make sure it is spelled the same in both cases.

Rob

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,137

Did you place a debug point in the user command routine and check it ??? I hope youar copying & modifying the standard PF status, if so assign it to the program.

Read only

0 Likes
2,137

Thank you for your responses, I have put a breakpoint into the code and I have found that it is catching but the IF statements isnt being executed as the variable r_ucomm is empty, but it should say &PS which is the name of the function code I have added. Have I missed a step out somewhere?

Read only

0 Likes
2,137

Now its clear that its the problem with the custom GUI status.If you are using a custom pf status the you have set the "I_CALLBACK_PF_STATUS_SET in you function module parameter as you did for user command. Please make sure that its activated properly and assigned to your program( this can be checked via se80 providing your program name ).

Read only

0 Likes
2,137

I have checked that it is activated and that is is assigned to the correct program. when I called the ALV function I set the following:

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

i_callback_pf_status_set = 'SET_PF_STATUS'

i_callback_user_command = 'USER_COMMAND'

Then I have created 2 forms, one to set the PF Status and One for the User command:

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

DESCRIBE TABLE rt_extab. "Avoid Extended Check Warning

SET PF-STATUS 'STANDARD'.

ENDFORM. "Set_pf_status

&----


*& Form user_command

&----


  • text

----


FORM user_command.

DATA: r_ucomm LIKE sy-ucomm.

r_ucomm = sy-ucomm.

IF r_ucomm EQ '&PS'.

BREAK-POINT.

ENDIF.

The button is showing ok, but r_ucomm isnt getting assigned as anything when the button is clicked.

Thank you for your help.

Read only

0 Likes
2,137

Not sure if this would even work but I guess you could give it a try. Try this out and see if you have any luck.

FORM user_command using r_ucomm like sy-ucomm.

 IF r_ucomm EQ '&PS'.
BREAK-POINT.
ENDIF.

ENDFORM.

Read only

0 Likes
2,137

Thanks but unfortunately it didn't work.

Read only

0 Likes
2,137

There must be something going on with your gui status. You said that the button is visible, so your gui status must be set. Have you tried creating a new button and changing the name to something like 'BUTTON'?

Read only

0 Likes
2,137

I have just added another button called &Button to the same GUI status in the same program, and I have clicked activate and also activated the program but when I run the program it isnt showing the new button...... So it must be something to do with the GUI Status. Any ideas? Thanks for the help.

Read only

0 Likes
2,137

I've set up the GUI Status again from the beginning and added another button, the new buttons are showing ok but sy-ucomm is still empty - is there anything I need to do to get this filled in?

Thanks

Read only

0 Likes
2,137

Try adding the callback program parameter to your FM call....

DATA: lv_repid like sy-repid.

lv_repid = sy-repid.


CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program       = lv_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command  = 'USER_COMMAND'

Read only

0 Likes
2,137

Thanks for the suggestion but Im afraid theres no change.

Read only

0 Likes
2,137

HI,

What is the function type given for the Button which you have added in PF status, keep it space (' ' - normal application function) .

Regards,

Madhukar Shetty

Read only

0 Likes
2,137

For this requirement, you have to copy the standard PF status of the ALV output. Do as below :-

1) Go to SE41

2) Enter the program name as SAPLKKBL

3) In the field status enter STANDARD_FULLSCREEN

4) Click on STATUS button on the application toolbar.

5) Enter the name of your Program & a new status name.

6) Click on COPY.

This way the standard status will be copied to the custom status & call the same status in your program using SET PF STATUS statement. Then double click on the custom status name & you will be navigated to SE41, there you can add you new button on the application tool bar & assign a function code, which you can program by enabling the export parameter I_CALLBACK_USER_COMMAND of the Function module REUSE_ALV_GRID_DISPLAY.

Just a sample code snippet for your reference :-

FORM USER_COMMAND USING L_UCOMM LIKE SY-UCOMM

LS_SELFIELD TYPE SLIS_SELFIELD.

CASE L_UCOMM.

WHEN 'your function code goes here'.

Do further processing.

This way you will have the standard PF status alongwith your button as well.

Thx