‎2011 May 03 1:16 PM
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
‎2011 May 03 4:59 PM
Change 'user_command' to 'USER_COMMAND' (upper case) and make sure it is spelled the same in both cases.
Rob
‎2011 May 03 4:34 PM
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?
‎2011 May 03 4:59 PM
hi,
i`m not sure but try to write in upper case:
I_CALLBACK_USER_COMMAND = 'user_command'
regards,
christian
‎2011 May 03 4:59 PM
Change 'user_command' to 'USER_COMMAND' (upper case) and make sure it is spelled the same in both cases.
Rob
‎2011 May 03 5:18 PM
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.
‎2011 May 04 9:33 AM
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?
‎2011 May 04 9:39 AM
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 ).
‎2011 May 04 1:41 PM
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.
‎2011 May 04 1:54 PM
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.
‎2011 May 04 2:08 PM
‎2011 May 04 2:16 PM
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'?
‎2011 May 04 2:44 PM
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.
‎2011 May 04 3:11 PM
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
‎2011 May 04 3:40 PM
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'
‎2011 May 04 3:54 PM
‎2011 May 05 7:14 AM
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
‎2011 May 19 10:02 AM
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