2023 Aug 17 3:58 AM
Hi,
Is it possible to create radio buttons in the lower part of an ALV display? Below is the ALV output indicated in my FSD. I have already created the ALV with the PF-STATUS buttons "Calculate Sample" and "Reset Sample" using CL_SALV_TABLE, but I do not know if it's possible to also add the radio buttons in the lower part of the screen? If yes, how do I add these radio buttons?
Thanks for any help.
Regards,
Kath
2023 Aug 17 8:07 AM
You have to use the concept of Custom Container, dynpro will contain Custom Container containing the ALV grid, and radio buttons below the custom container.
CREATE OBJECT custom_container TYPE cl_gui_custom_container
EXPORTING container_name = 'YOURNAME'
EXCEPTIONS OTHERS = 1.
cl_salv_table=>factory( EXPORTING r_container = custom_container
IMPORTING r_salv_table = DATA(salv)
CHANGING t_table = gt_alv_table[] ).
2023 Aug 17 8:07 AM
You have to use the concept of Custom Container, dynpro will contain Custom Container containing the ALV grid, and radio buttons below the custom container.
CREATE OBJECT custom_container TYPE cl_gui_custom_container
EXPORTING container_name = 'YOURNAME'
EXCEPTIONS OTHERS = 1.
cl_salv_table=>factory( EXPORTING r_container = custom_container
IMPORTING r_salv_table = DATA(salv)
CHANGING t_table = gt_alv_table[] ).
2023 Aug 17 8:13 AM
Hi Sandra,
Thanks for your response, I have tried this, but it raises a dump "Class CL_SALV_TABLE, method SET_SCREEN_STATUS not supported for CL_SALV_TABLE". I have a PF-STATUS because of the "Calculate Sample" and "Reset sample" buttons.
2023 Aug 17 8:30 AM
It's a different question which has been already answered in the forum. SET_SCREEN_STATUS is only for fullscreen ALV. For container ALV, you must add the buttons using:
salv->get_functions( )->add_function( ... ).
2023 Aug 18 8:19 AM
Thanks Sandra,
I was able to get my desired ALV output by use of custom container and added_function as suggested. My problem is when I click on Calculate Sample, SY-UCOMM is just blank. I'm expecting SY-UCOMM to be 'RAD_BUT' which is the function code for my radio button group.
In debugger, after clicking on Calculate Sample, it goes directly to the user_command method and sets the e_salv_function parameter to the name of my added button but sy-ucomm is blank. How do I get the value of my radio button?
2023 Aug 18 8:21 AM
2023 Aug 18 8:59 AM
The OK code (SY-UCOMM) is not concerned when you deal with Control Framework. You have probably declared:
METHODS me_user_command
FOR EVENT added_function OF cl_salv_events
IMPORTING e_salv_function .
So, you must use E_SALV_FUNCTION in ME_USER_COMMAND instead of SY-UCOMM.
NB: if you have to deal with OK codes, SAP says to not use SY-UCOMM, instead declare your own global variable
DATA okcode TYPE syucomm.
and define it in the element list in the OK field.
2023 Aug 18 8:59 AM
Make a global variable called G_OKCODE TYPE OKCODE. Activate. In the screen editor (not the painter!), in the Element List tab, set the OKCODE field to have the name G_OKCODE.
In the PBO you should now get whatever fcode you've assigned to your radiobuttons in G_OKCODE.
But I suspect what you need to do is create global variables called RB_EACH and RB_... of type abap_bool. If that's the case, delete the RB from the screen. Add the new global variables, activate. Then add the RB back into the screen. (The reason I first delete them is that sometimes I've experience problems with the binding of the screen field to the variable).
2023 Aug 18 11:51 AM
Note that defining a function code on a radio button group means only that it will trigger that function code at the time you switch the radio button status, NOT when you click on a button of the ALV toolbar.
2023 Aug 18 1:12 PM
2023 Aug 18 4:15 PM
I guess you must be confused by contradictory comments 😉
Or maybe I didn't understand something.
Your screenshot shows that you have added the button "calculate" as part of the ALV toolbar, not as part of the Application Toolbar (GUI status / below the screen title bar).
If the button "calculate" was in the application toolbar, it would trigger a PAI/PBO cycle.
But your button "calculate" is in the ALV toolbar, so it triggers an event that you handle in your method ME_USER_COMMAND, and there's no PBO/PAI cycle.
The PBO/PAI cycle occurs only when you click on the "other" radio button -> function code RAD_BUT, and the method ME_USER_COMMAND is not called.
(note that it's possible from either "side" to trigger the other side)