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