cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown in Abap Webdynpro

Former Member
0 Kudos

Hi friends,

How to have custom dropdown list for field in abap webdynpro.

It is possible in general abap with FM 'VRM_SET_VALUES' how it's possible in abap webdynpro.

Please reply.....

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Take a Drop down by index UI Element.

Bind it with a Node.

Write Below mentioned Code in Wd do init so as to put values inside drop down.

In the below mentioned case, you are taking Values from Sflight and inserting into the DropDown.

DropDown By Index:

 Value are passed into internal table.

 Internal table is finally binded with the corresponding node(Context)

 The Context can be of Table or Drop down.

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.

Thanx.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

go thru this thread it might help you a lot.

or

.

thru this u can get your problem solved.

regards,

anand

former_member40425
Contributor
0 Kudos

Hi,

Create a context node having attribute field whose values you want to see in the dropdown.

i you are using ui element as dropdownby key then follow the following code.

DATA : node_info TYPE REF TO if_wd_context_node_info.

DATA : it_zinsp TYPE TABLE OF zinsp. " here zinsp is the name of table

FIELD-SYMBOLS : <tablezinsp> TYPE zinsp.

DATA : value TYPE wdy_key_value,

value_set TYPE wdy_key_value_table.

DATA : zlandx TYPE string.

  • Inserting the countries into the destination drop down

value-key = lc_key.

value-value = lc_select.

INSERT value INTO TABLE value_set.

node_info = wd_context->get_node_info( ).

node_info = node_info->get_child_node( 'CN_DESTINATION' ). " CN_DESTINATION is name of node

CALL METHOD cl_wd_dynamic_tool=>get_table_data

EXPORTING

tab_name = 'ZINSP'

row_count = 0

IMPORTING

data = it_zinsp.

LOOP AT it_zinsp ASSIGNING <tablezinsp> .

SELECT landx FROM t005t INTO zlandx

WHERE land1 EQ <tablezinsp>-zland1

AND spras = sy-langu.

ENDSELECT.

value-key = <tablezinsp>-zland1.

value-value = zlandx.

INSERT value INTO TABLE value_set.

ENDLOOP.

node_info->set_attribute_value_set( name = 'CA_DESTINATION'

value_set = value_set ). " CA_DESTINATION is the name of attribute.

I hope it helps.

Regards,

Rohit

Former Member
0 Kudos

thanks friends.It's solved my problem.......rewarded.

arjun_thakur
Active Contributor
0 Kudos

Hi Hosmath,

In WDA you need to use either DropDownByKey or DropDownByIndex UI element.

Refer the online help: http://help.sap.com/saphelp_nw70ehp1/helpdata/en/dd/b0884118aa1709e10000000a155106/content.htm and also refer the standard component: WDR_TEST_EVENTS.

Regards

Arjun