03-17-2015 1:27 PM
Hi Experts,
I have to change the listbox values based on the other parameters value in the selection screen.like in my report there is two parameters in the selection screen as p_whr ( parameter) and p_query (Parameter as list box).When we change the value of p_whr then the logic should trigger automatically and get display the corresponding values in the list box
Could you please help what even I have to use to changes the listbox values based on the other parameter or share any examples for the same scenario.
Thanks in advance
Krishna
03-18-2015 2:33 PM
Hi Ram,
By using AT SELECTION-SCREEN ON VALUE REQUEST event it is possible. You can change p_whr
value by clicking on F4 function key. Based on p_whr vale you can change p_query list box values.
An SAP Consultant: ABAP - F4 help - DYNP_VALUES_READ
http://www.saptechnical.com/Tutorials/ABAP/F4/Page2.htm
Hopes it helps you.
Thanks,
Ashok.
03-18-2015 3:03 PM
Hi Krishna,
Here is a code piece for it:
Listbox parameter P_LB is filled up with values from 1 up to X, where X is the value what you specified in other parameter P_NUM.
The important thing is setting MODIF ID for P_NUM, so in case of change selscreen PAI (AT SELECTION SCREEN event), an afterwards PBO will be triggered.
Then, in AT SELECTION SCREEN OUTPUT event, you can use FM VRM_SET_VALUES to fill the listbox with the proper values.
DATA:
gt_status_values TYPE TABLE OF vrm_value,
gs_status_value TYPE vrm_value.
PARAMETERS:
p_num TYPE i MODIF ID mod,
p_lb AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT.
CLEAR gt_status_values.
DO p_num TIMES.
gs_status_value-key = sy-index.
gs_status_value-text = sy-index.
APPEND gs_status_value TO gt_status_values.
ENDDO.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_LB'
values = gt_status_values
EXCEPTIONS
OTHERS = 1.
AT SELECTION-SCREEN.