Skip to Content
author's profile photo Former Member
Former Member

changing radio button selection programatically.

I have a requirement where in when user selects a file using file open dialog, the appropriate

radio button should be selected programatically based on file type. For ex. if user selects '.csv' file the

radio button 'CSV' should be selected automatically & the screen should get refreshed. Now I need to know how the screen should be repainted.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 11:44 AM

    hi ,

    Execute the code and see if this is working for u .

    parameters : fname like rlgrap-filename." memory id m01.
          DATA : filename TYPE string.
          DATA : table1 TYPE filetable,
                 rc TYPE i.
    
    PARAMETERS : R1 RADIOBUTTON GROUP RG user-command r modif id abc
    DEFAULT
     'X'.
    PARAMETERS : R2 RADIOBUTTON GROUP RG modif id def.
    
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR fname.
    
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
          EXPORTING
            default_filename = '*.*'
          CHANGING
            file_table       = table1
            rc               = rc.
    
        IF sy-subrc <> 0.
          MESSAGE e000(zXXX) WITH 'Error'.
        ENDIF.
    
        LOOP AT table1 INTO fname.
    
        ENDLOOP.
    
    
    at selection-screen output.
    
    IF fname cs '.CSV'.
    LOOP AT SCREEN.
    IF screen-group1 = 'ABC'.
    r1 = 'X'.
    r2 = ' '.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    
    elseif fname cs '.DOC'.
    LOOP AT SCREEN.
    IF screen-group1 = 'DEF'.
     r2 = 'X'.
     r1 = ' '.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.

    make the f4 select .CSV or .DOC and the radio button is taking the position based on the input.

    hope this helps

    regards,

    vijay

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 10:00 AM

    Hi Gopinath ,

    You will have to get the file type , may be from the extension of the file and then use the at selection-screen output event for the same.

    here is a sample program which works when you enter file as 'CSV' or 'DOC'

    PARAMETERS : FILE(10),
                 RB1 RADIOBUTTON GROUP G1 USER-COMMAND RB ,
                 RB2 RADIOBUTTON GROUP G1.
    
    AT SELECTION-SCREEN OUTPUT.
    
     LOOP AT SCREEN.
       IF FILE = 'CSV'.
         IF SCREEN-NAME = 'RB2'.
           SCREEN-ACTIVE =   0.
           MODIFY SCREEN.
         ENDIF.
       ELSEIF FILE = 'DOC'.
         IF SCREEN-NAME = 'RB1'.
           SCREEN-ACTIVE =   0.
           MODIFY SCREEN.
         ENDIF.
        ENDIF .
    
     ENDLOOP.

    This code will hide the other radio button ,

    Do fell free to revert back if you have any issues ,

    Regards

    Arun

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 10:02 AM

    hi there,

    in the corresponding block for output ( AT SELECTION-SCREEN OUTPUT if there is a selection screen or within a PBO module) you just set desired radiobutton to 'X' and clear all other radiobuttons from the same radiogroup (otherwise you'll get a short dump).

    please ask if questions (but firstly give all relevant info)

    br

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 10:04 AM

    if you are using selection screen for that you have to use

    at selection-screen output.

    if p_file = 'CSV'.

    radio1 = 'X'.

    endif.

    like that.

    or if you have any your screen you have to do it in PBO.

    regards

    shiba dutta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 10:14 AM

    Hi gopinath,

    1. use the event AT SELECTION-SCREEN OUTPUT.

    2. There, just put

    if filetype = 'CSV'.

    radiocsv = 'X'.

    endif.

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 10:28 AM

    sorry as per as i know if you enter some value in the selection screen field and press enter it will trigger at selection-screen and then again it will trigger at selection-screen output. Correct me if i am wrong.

    regards

    shiba dutta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 10:36 AM

    hi,

    the AT SELECTION-SCREEN OUTPUT is executed everytime something happens in the screen (enter values, push buttons, etc) since is the correspondent of the PBO for normal screens.

    so, if you want to modify the screen elements (activating/deactivating, modifying input, etc) or want to modify values you must do it here.

    br

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.