‎2015 Jun 30 11:19 AM
Hi,
Please guide me on this: i have a selection screen with few fixed select-options and few dynamic options.
i want to clear all selection screen variables .
I am reading all selection screen variables using FM
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = itab1. -> all variables got in itab1.
Now, i want to clear all select-options and parameter which are captured in itab1.
i saw somewhere that FM RS_SELECTIONSCREEN_UPDATE can be used for this.
But i tried .may be i am mistaken somewhere. Please guide me if this is the right FM to refresh selection screen variables and if yes how to use it?
‎2015 Jun 30 11:25 AM
Hi abhishek,
Why can't we try with simple clear statement once you fill the selection screen data in Itab.
Check whether Itab is initial or not initial.depending on this you can simply write the statement clear.
clear : P_var1,s_var1.
‎2015 Jun 30 11:25 AM
Hi Abhishek,
By clear you mean erase all the data in the select option right? Did you try REFRESH itab1[] and see if it is refreshed?
Regards,
~Athreya
‎2015 Jun 30 11:30 AM
itab1[] contains names of variables only. not the exact values that user entered on selection screen.
So, refreshing itab1 not serves any purpose.
Suppose there are 5 select-options select-options are there on selection screen:
select-options1
select-option2
select-options3
select-options4
select-options5.
User entered multiple values (say 50) in each of them. now itab1 will only contain 5 values i.e name of selection screen variables.
‎2015 Jun 30 11:25 AM
Hi abhishek,
Why can't we try with simple clear statement once you fill the selection screen data in Itab.
Check whether Itab is initial or not initial.depending on this you can simply write the statement clear.
clear : P_var1,s_var1.
‎2015 Jun 30 11:33 AM
I can't write p_var1 or s_var1 because most of the selection screen variables are dynamically created.so at run time i dont know their names.
That why i am using FM :
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = itab1. -> all variables got in itab1.
Now , itab1 containes all the variable names and now i need to refresh each variable.
something like this,
loop at itab1.
refresh(itab1-selname). => itab1-selname will contain the name of select-option S_VAR1 so i need to write something like Clear S_VAR1[]. dynamically!
endloop.
‎2015 Jun 30 11:52 AM
SELECT-OPTIONS: s_uname FOR sy-uname.
DATA: l_string TYPE string.
FIELD-SYMBOLS: <dyn> TYPE any.
l_string = 's_uname' && '[]'.
ASSIGN (l_string) TO <dyn>.
CLEAR <dyn>.
‎2015 Jun 30 12:29 PM
Thanks,solved my problem.
Just curious to know, can the same be achieved from FM RS_SELECTIONSCREEN_UPDATE .If yes then how?
‎2015 Jun 30 12:57 PM
It is used only for F4 events on selection screen. According to FM documentation and where-used list:
This function module allows you to supply values to any fields of the
standard selection screen in the
AT SELECTION-SCREEN ON VALUE REQUEST.... event.