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: 

Radiobutton value in AT SELECTION-SCREEN ON VALUE REQUEST

Marçal_Oliveras
Active Contributor
0 Kudos

Hi, I have a radiobutton to choose if the user wants to upload or download a file. And then a file parameter for the path. My problem is that in F4 help for path the value of the radiobutton selected is not updated.

The logic is the following (in the AT SELECTION-SCREEN ON VALUE-REQUEST p_up = 'X' always!)


PARAMETERS: p_up   RADIOBUTTON GROUP rbg1 DEFAULT 'X',
            p_down RADIOBUTTON GROUP rbg1.
            p_file TYPE file_name OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  CASE 'X'.
    WHEN p_up.
      PERFORM up_dialog CHANGING p_file.
    WHEN p_down.
      PERFORM down_dialog CHANGING p_file.
  ENDCASE.


1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Add user-command uc1 at the first radiobutton, and remove obligatory at the file parameter. And check if the file is initial on at selection-screen event...


  PARAMETERS: p_up   RADIOBUTTON GROUP rbg1 DEFAULT 'X' user-command gr1,
                           p_down RADIOBUTTON GROUP rbg1,
                           p_file TYPE file_name.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    IF p_up = 'X'.
        PERFORM up_dialog CHANGING p_file.
    ELSEIF p_down = 'X'.
        PERFORM down_dialog CHANGING p_file.
  ENDIF.

at selection-screen.
if sy-ucomm <> 'GR1' and p_file is initial.
  message...
 endif.

Regards,

Edited by: Diego Alvarez on Feb 10, 2010 12:03 PM

10 REPLIES 10

former_member404244
Active Contributor
0 Kudos

Hi,

a small change..



PARAMETERS: p_up   RADIOBUTTON GROUP rbg1 DEFAULT 'X' user-command app,
            p_down RADIOBUTTON GROUP rbg1.
            p_file TYPE file_name OBLIGATORY.
 

Regards,

Nagaraj

0 Kudos

Hi nagaraj, thanks but it's still not working, the value of the radiobutton is not updated until START-OF-SELECTION.

Former Member
0 Kudos

hi,

try like this.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CASE p_up.

WHEN 'X'.

PERFORM up_dialog CHANGING p_file.

WHEN others.

PERFORM down_dialog CHANGING p_file.

ENDCASE.

regards,

sakshi

Former Member
0 Kudos

Hi Marshall,

This is quite tricky. Instead, why don't you have two separate parameters for the two radiobuttons: One parameter will take the file name as input for uploading, the other will take the file path for downloading.

You can handle the visibility of these two parameters in the AT SELECTION-SCREEN OUTPUT event, so that depending on which radiobutton is selected, the corresponding parameter is displayed.

This way, you don't have to worry about the F4 event, because you don't have to check the radiobutton at all.

Hope this helps! Do revert if you want the specific source code, or if have any further queries.

Cheers,

Shailesh

Always provide feedback for helpful answers

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

Did you check the p_down radio-button & did an F4 on p_file ? After this in the debug mode you find that in the event AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file, the value for p_up = 'X' ?

Can you try like this & check ?

PARAMETERS: p_up   RADIOBUTTON GROUP rbg1 DEFAULT 'X',
            p_down RADIOBUTTON GROUP rbg1.
            p_file TYPE file_name OBLIGATORY.
 
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
 
  IF p_up = 'X'.
      PERFORM up_dialog CHANGING p_file.
ELSEIF p_down = 'X'.
      PERFORM down_dialog CHANGING p_file.
  ENDIF.

@Nagaraja: Adding USER-COMMAND will trigger the AT SELECTION-SCREEN OUTPUT event & not AT SELECTION-SCREEN ON VALUE-REQUEST.

BR,

Suhas

0 Kudos

Thanks suhas,

You pointed me , i was just checking the radiobutton part which was not working.. :)..Didn't check the event.. 😛

Regards,

Nagaraj

0 Kudos

Hi Suhas, yes the problem is that the value of p_up is always 'X' in ON VALUE-REQUEST event. And p_down is always initial. Your solution doesn't correct this, but thanks!

To Shailesh: Yes, I had thought about this solution, or starting the file dialog when the user begins the program execution, deleting the p_file parameter from the selection screen. It seems that I must go this way

Former Member
0 Kudos

Hi,

Add user-command uc1 at the first radiobutton, and remove obligatory at the file parameter. And check if the file is initial on at selection-screen event...


  PARAMETERS: p_up   RADIOBUTTON GROUP rbg1 DEFAULT 'X' user-command gr1,
                           p_down RADIOBUTTON GROUP rbg1,
                           p_file TYPE file_name.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    IF p_up = 'X'.
        PERFORM up_dialog CHANGING p_file.
    ELSEIF p_down = 'X'.
        PERFORM down_dialog CHANGING p_file.
  ENDIF.

at selection-screen.
if sy-ucomm <> 'GR1' and p_file is initial.
  message...
 endif.

Regards,

Edited by: Diego Alvarez on Feb 10, 2010 12:03 PM

0 Kudos

Thanks Diego, I didn't imagine that the OBLIGATORY option causes this.

Solved

vinod_vemuru2
Active Contributor

Hi,

Check below code. It will work.


PARAMETERS: p_up   RADIOBUTTON GROUP rbg1 DEFAULT 'X' USER-COMMAND ucomm,
            p_down RADIOBUTTON GROUP rbg1 ,
            p_file TYPE file_name .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  CASE 'X'.
    WHEN p_up.
     PERFORM up_dialog CHANGING p_file.
    WHEN p_down.
      PERFORM down_dialog CHANGING p_file.
  ENDCASE.

AT SELECTION SCREEN.
CHECK po_file IS IITIAL.
MESSAGE 'Please enter file name' TYPE 'E'.

This is because, till you fill all the OBLIGATORY fields, selection screen values are not updated.

Alternate way is, you need to call the FM DYNP_VALUES_UPDATE/DYNP_UPDATE_FIELDS which is not required with above code.

Thanks,

Vinod.