2010 Sep 16 4:23 PM
I have 2 selection-screen options :
s_region and
s_state .
Here Region would mean North,South,East,West
I have At selection-screen on value request for both of these selection options.
But when I click F4 for s_state, I want to capture the selection made by user on s_region so that I only query for states under region. For eg: if South was chosen, I only want to bring up states in South Region.
I have both at selection-screen on and at selection-screen on value-request. But when I type South for s_region and press F4 for s_state, the internal table s_region[] is not filled in 'At selection-screen on value request for s_state-low . This is because at selection-screen on value-request is called before at selection-screen on - event. Only at selection-screen on s_region populates s_region.
How would I get around it ? I want to access entries in s_region during on selection-screen on value request for s_state, (without me having to hit enter key after first selection).
2010 Sep 16 4:28 PM
I have 2 selection-screen options :
s_region and
s_state .
Here Region would mean North,South,East,West
I have At selection-screen on value request for both of these selection options.
But when I click F4 for s_state, I want to capture the selection made by user on s_region so that I only query for states under region. For eg: if South was chosen, I only want to bring up states in South Region.
I have both at selection-screen on and at selection-screen on value-request. But when I type South for s_region and press F4 for s_state, the internal table s_region[] is not filled in 'At selection-screen on value request for s_state-low . This is because at selection-screen on value-request is called before at selection-screen on - event. Only at selection-screen on s_region populates s_region.
How would I get around it ? I want to access entries in s_region during on selection-screen on value request for s_state, (without me having to hit enter key after first selection).
2010 Sep 16 4:28 PM
2010 Sep 16 4:41 PM
Hi Shareen,
Check this online help link, it has a nice example
[Input Help in Dialog Modules|http://help.sap.com/saphelp_nw70/helpdata/en/9f/dbaac935c111d1829f0000e829fbfe/content.htm]
Regards
Abhii
2010 Sep 16 6:58 PM
Shareen,
The best option would be to use 'DYNP_VALUES_READ' FM.
For eg: You've S_Region and S_state as two Selection-option fields.
After user selecting the Region, when click F4 in S_state, use this.
Data: I_SCR_FIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE.
At selection-screen on value-request for s_state-low.
Perform: Get_state.
At selection-screen on value-request for s_state-high.
Perform: Get_state.
FORM GET_STATE .
move 'S_REGION-LOW' to I_SCR_FIELDS-fieldname.
append I_SCR_FIELDS.
move 'S_REGION-HIGH' to I_SCR_FIELDS-fieldname.
append I_SCR_FIELDS.
*--- Get the screen values
call function 'DYNP_VALUES_READ'
exporting
dyname = Sy-cprog
dynumb = Sy-dynnr
tables
dynpfields = I_SCR_FIELDS
exceptions
invalid_abapworkarea = 04
invalid_dynprofield = 08
invalid_dynproname = 12
invalid_dynpronummer = 16
invalid_request = 20
no_fielddescription = 24
undefind_error = 28.
*
*----Read the return value-
Read table I_SCR_FIELDS index 1.
*----Or you can read table I_SCR_FIELDS with the key, depends on your req.
I_SCR_FIELDS-FIELDVALUE will have the value for the region.
Once you have the Region value, you can build the logic to get the relevant states.
ENDFORM. " GET_STATE
Hope this helps.
Best Regards,
Gopakumar
Sr.SAP Tech.Lead