on 07-04-2007 10:21 AM
Hi Gurus,
I am using a internal table, for calling a FM, which require Internal table as its parameter.
e.g. pt_material, its structur is (key, value)
how can i show this Table into a Drop-Down-List, which one is better?
Best Regards
Shuo
Hi,
You can use DropDownBy key... Please refer to the sample code in WDDOINT method...
method WDDOINIT .
data:
Node_Node1 type ref to If_Wd_Context_Node,
Info_Node1 type ref to IF_WD_CONTEXT_NODE_INFO,
value_set type TIHTTPNVP,
wa_value_set TYPE LINE OF TIHTTPNVP.
Node_Node1 = wd_Context->get_Child_Node( Name = IF_MAIN=>wdctx_Node1 ).
Info_Node1 = Node_Node1->get_node_info( ).
wa_value_set-name = `01`.
wa_value_set-value = `Consultant`.
APPEND wa_value_set to value_set.
clear wa_value_set.
wa_value_set-name = `02`.
wa_value_set-value = `Senior Consultant`.
APPEND wa_value_set to value_set.
clear wa_value_set.
wa_value_set-name = `03`.
wa_value_set-value = `Manager Projects`.
APPEND wa_value_set to value_set.
clear wa_value_set.
Info_Node1->set_attribute_value_set( name = 'DESIGNATION'
value_set = value_set ).
endmethod.
Hope this helps,
Best regards,
Ravikiran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Lets say you have a context attribute 'VALUE' whose values you wish to display as a drop down. After you call the function module and get the data in internal table pt_material, include the following code:
data: lr_node type ref to if_wd_context_node,
lt_valueset type table of wdr_context_attr_value,
ls_valueset type wdr_context_attr_value,
lr_nodeinfo type ref to if_wd_context_node_info,
wa_material type pt_material.
lr_node = wd_context->get_child_node('NODE').
lr_nodeinfo = lr_node->get_node_info( ).
loop at pt_material into wa_material.
ls_valueset-value = wa_material-key.
ls_valueset-text = wa_material-value.
append ls_valueset to lt_valueset.
endloop.
lr_nodeinfo->set_attribute_value_set(
exporting
name = 'VALUE'
valueset = lt_valueset
).
This code is for a drop down by key UI element. In your view, for the dropdownby key element, bind the selectedKey property to 'VALUE' attribute of your context node.
I hope this is what you are looking for.
Regards,
Nithya
Hi
Create a node of your internal structure type and bind the values from the internal table to the node using bind_table method of if_wd_context_node.Then bind this node to your dropdown node the UI
Thanks
Anzy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shuo,
Go through the following code.
data:uitab type ref to if_wd_context_node,
roles_map type MYTABLE,
flag type abap_bool.
uitab = wd_Context->get_Child_Node( `DROPDOWN` ).
CALL METHOD UITAB->BIND_TABLE
EXPORTING
NEW_ITEMS = roles_map
SET_INITIAL_ELEMENTS = ABAP_TRUE
.
I am just giving you the an example.here DROPDOWN is a node with the attributes of the table type MYTABLE.And you can get the node instance from the context.
Post if you need some more clarification
Thanks
Anzy
Award points for useful answers
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.