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: 

Radio Button in lower part of the ALV display (not as a column)

kmdarunday
Explorer
0 Kudos

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

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

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[] ).
10 REPLIES 10

Sandra_Rossi
Active Contributor

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[] ).

0 Kudos

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.

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( ... ).

0 Kudos

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?

0 Kudos

Debugger::

0 Kudos

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.

matt
Active Contributor

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).

0 Kudos

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.

0 Kudos
  • When you clicked on the radiobutton, it triggered a first PAI/PBO cycle with OK_CODE = 'RAD_BUT' that also updated screen values to program memory.
  • When you later click on the 'Calculate' function it triggers a new PAI/PBO cycle with OK_CODE = '&CALC'. But at this step you can now use the values of the radiobutton fields RB_EACH and (?) in the main program.

0 Kudos

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)