on 06-07-2011 9:46 AM
Hi experts,
My Requirements is
In 1st Drop Down i have 2 values( 1)Cost Center 2) WBS element ).
If i select Cost center, 2nd Drop Down should contain Its corresponding Values
If i select WBS, 2nd Drop Worn Should Contain its Corresponding Values
Please guide me how can i achieve this
Regards,
Farooq
Any Futher suggestions Please
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Farooq,
I am guessing you are getting values for second drop down based on some sql query or FM. You can do the following:
1) Create dropdown1 and bind it with an attribute say attr1.
2) create an action and bind it with the onSelect event of dropdown1.
3) Goto Action tab and select the action that you have created.
4) Read the value selected from Dropdown1.
Data: context_node type ref to if_wd_context_node.
data: it_ddvalue type STANDARD TABLE OF if_view1=>element_DROPDOWN1,
wa_ddvalue like line of it_ddvalue,
index type i.
context_node = wd_context->get_child_node( name = 'DROPDOWN1').
Get index of currectly selected value
index = context_node->GET_LEAD_SELECTION_INDEX( ).
Use index to get actual details of currently selected value
context_node->GET_STATIC_ATTRIBUTES(
exporting index = index
importing STATIC_ATTRIBUTES = wa_ddvalue ).
5) Now based on the value selected i.e. Cost Center or WBS execute the SQL query to populate second dropdown2.
Data: context_node type ref to if_wd_context_node.
Data: it_values type STANDARD TABLE OF if_view1=>element_DROPDOWN2,
wa_values like line of it_values.
<Select query> into table it_values.
context_node = wd_context->get_child_node( name = 'DROPDOWN2').
context_node->BIND_TABLE( it_values).
Hope this helps. You can refer [Dropdown tutorial|http://www.sapdev.co.uk/sap-webapps/sap-webdynpro/wdp-ddretrieve.htm]
Regards
Abhinav Sharma
Hi,
You can use onSelect event of the drop down box. Create an action for First drop down and then bind it with the onSelect event. Now write your business logic to populate the second drop down box.
onSelect event is common for Dropdown by index or by key. You can read more about this event [here|http://help.sap.com/saphelp_nw04s/helpdata/en/c5/e4884180951809e10000000a155106/content.htm]
Regards
Abhinav Sharma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi abinav,
My 2nd Drop Down will change as per values in 1st drop down say Cost Center and WBS.
For Cost Center hear we maintain 2 values and for WBS we have Dynamic Values its change as per project so how i make 2nd drop down change as per selection of 1st drop down
Length of the field at database level is different for Cost Center and WBS.
Please guide me with some code.
Regards,
Farooq
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.