on 11-13-2009 5:26 AM
Hi,
I have a view in which there are fields with the dropdown(Year, month and date). I have to populate them , please let me know how to do that. Any pointers will be of great help.
Regards,
Ashutosh
hi,
You can also refer Standard Component : wdr_test_events.
This shows the usage of various commonly used UI elements.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
if u r using drop down by index , than proceed like this :
1 declare a context node of cardinality 0..n
2 declare attribute of type string under it . The attribute name should be exactly the same as that in database table '
eg if u want to poulate values for a field ' SYS' from table , than giv the attribute name as 'SYS' in context attribute
3 declare internal table of type standard table
4 populate internal table with values
5 take the refernce of the node , u have created
6 bind it with the internal table
the dropdown by index wud nw contain app values
this sample code wud help u
suppose I have created a node CN_SYSTEM with att SYS_DESC ( this is field name in my table z2ts_systems )
->DATA : it_sys TYPE STANDARD TABLE OF z2ts_systems .
-> SELECT *
-> FROM z2ts_systems
-> APPENDING TABLE it_sys.
->DATA lo_nd_cn_system TYPE REF TO if_wd_context_node.
->* navigate from <CONTEXT> to <CN_SYSTEM> via lead selection
-> lo_nd_cn_system = wd_context->get_child_node(
-> name = wd_this->wdctx_cn_system ).
-> lo_nd_cn_system->bind_table( it_sys ).
regards
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Ashutosh ,
if u r using drop down by key , than proceed like this :
1 declare a context node of cardinality 0..1
2 declare attribute of type string under it . The attribute name should be exactly the same as that in database table '
eg if u want to poulate values for a field ' SYS' from table , than giv the attribute name as 'SYS' in context attribute
3 declare internal table of type standard table
4 populate internal table with values
5 take the refernce of the node , u have created
6 bind it with the internal table
here is one code as an example for ur reference
u can look for ur code in the similar lines
TYPES: BEGIN OF str_roles,
-> role TYPE z0cz_roles-role_id,
-> END OF str_roles.
->DATA: it_role TYPE TABLE OF str_roles,
-> wa_role TYPE str_roles.
->DATA: value1 TYPE wdy_key_value,
-> set TYPE wdy_key_value_table.
-> SELECT role_id FROM z0cz_roles INTO TABLE it_role.
->SORT IT_ROLE DESCENDING BY ROLE.
-> LOOP AT it_role INTO wa_role.
-> value1-key = sy-tabix.
-> value1-value = wa_role-role.
-> APPEND value1 TO set.
-> ENDLOOP.
-> DATA : node_info TYPE REF TO if_wd_context_node_info.
-> node_info = wd_context->get_node_info( ).
-> node_info = node_info->get_child_node('CN_DROPDOWN').
->node_info->set_attribute_value_set( name = 'CA_ROLE' value_set = set ).
regards,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
You can either have Drop down by key or dropdown by index.
Following are the ways to populate them :
DropDownBy Key :
Here we have two things Value and a Key. Value is shown in the Drop down.
Node used is For_Drop and Attribute is u2018Drop_Keyu2019.
method WDDOINIT .
DATA : node_info TYPE REF TO if_wd_context_node_info,
value1 TYPE wdy_key_value,
set TYPE wdy_key_value_table,
k1 type string value 'M',
v1 type string value 'MAGO',
k2 type string value 'S',
v2 type string value 'Saurav'.
*
value1-key = k1.
value1-value = v1.
APPEND value1 to set.
value1-key = k2.
value1-value = v2.
APPEND value1 to set.
node_info = wd_context->get_node_info( ).
node_info = node_info->get_child_node('FOR_DROP').
node_info->set_attribute_value_set( name = 'DROP_KEY' value_set = set ).
endmethod.
DropDown By Index:
Value passed into internal table.
Internal table is finally binded with the corresponding node(Context)
method WDDOINIT .
data : it_table type STANDARD TABLE OF sflight.
DATA lo_nd_cn_drpindex TYPE REF TO if_wd_context_node.
DATA lo_el_cn_drpindex TYPE REF TO if_wd_context_element.
DATA ls_cn_drpindex TYPE wd_this->element_cn_drpindex.
navigate from <CONTEXT> to <CN_DRPINDEX> via lead selection
lo_nd_cn_drpindex = wd_context->get_child_node( name = wd_this->wdctx_cn_drpindex ).
select carrid from sflight into CORRESPONDING FIELDS OF TABLE it_table.
lo_nd_cn_drpindex->bind_table( it_table ).
endmethod.
Dropdown is binded with CN_DRPINDEX context node.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.