cancel
Showing results for 
Search instead for 
Did you mean: 

Populating a DropDown Field with the values of a Search Help

Former Member
0 Kudos

Hi all,

i have a node in the context which has a ddic type. Assigned to this ddic type is a search help.

First i displayed the node as an input field. It worked great. The search help was displayed.

But now i have to display the node in a DropDown field. But the drop down field contains no values now.

How can i populate the DropDown field with the values of the search help assigned to the ddic type?

Thanks in advance

Florian

Accepted Solutions (1)

Accepted Solutions (1)

former_member402443
Contributor
0 Kudos

Hi ,

As per your asking to populate the dropdown field with search help

1. if the values are less to display and defined in the value range of the domain that you have defined for your attribute, then you can use drop down by index directly.

2. If the values are to display in a drop down box from a internal table or based on a select statement that its to use a drop down by key. Its easy to manipulate.

For using the drop down list in a table, you have to do the following things.

1. create a node that u want to display in a table

2. set the cardinality to 0...n.

3. create a table UI element in your view.

4. right click on the table element and click create binding.

5. then map the node with the table and in the cell editor select the ui element for the particular column you want to show( here u can select the dropdownbykey).

6. After this the drop down by key element will be avilable in the table UI element.

To fill the values in the dropdownby key, you have to do like this.

You have to set the values for that attribute to whom you have made the column as drop down by key.

Code :

  • Data declaration for the payment table node info

DATA : lo_nd_payment_table TYPE REF TO if_wd_context_node,

lo_el_payment_table TYPE REF TO if_wd_context_element,

lr_nodeinfo TYPE REF TO if_wd_context_node_info,

ls_payment_table TYPE wd_this->element_payment_table.

  • Data declaration for Internal table/workarea

DATA : ls_value_set TYPE wdy_key_value,

lt_value_set TYPE wdy_key_value_table

  • navigate from <CONTEXT> to <PAYMENT_TABLE> via lead selection

lo_nd_payment_table = wd_context->get_child_node( name = wd_this->wdctx_payment_table ).

lr_nodeinfo = lo_nd_payment_table->get_node_info( ).

  • get element via lead selection

lo_el_payment_table = lo_nd_payment_table->get_element( ).

IF im_medium = '0001' OR im_medium = '0003'. "If Medium is Internal Transfer/EFT then proceed

  • getting the disbursement description

CALL FUNCTION '/DMPUI/DB_DISBURSEMENT_INFO'

EXPORTING

iv_prodext = WD_THIS->mst_prod_ext

TABLES

ex_disbursmentdata = lt_description.

REFRESH lt_value_set.

IF lt_description[] IS NOT INITIAL.

LOOP AT lt_description INTO ls_description.

ls_value_set-key = ls_description-disburs_type.

ls_value_set-value = ls_description-description.

  • Inserting the value to a internal table

INSERT ls_value_set INTO TABLE lt_value_set.

CLEAR ls_value_set.

ENDLOOP.

  • Setting the attributes for the value set

lr_nodeinfo->set_attribute_value_set(

EXPORTING

name = `DISBURSEMENT_TYPE`

value_set = lt_value_set ).

ENDIF.

Hopes this will helps you.

Regard

Manoj Kumar

Former Member
0 Kudos

The search help is bound to the domain as an "Prüftabelle (Checktable)". But DropDownByKey and DropDownByIndex are not showing the search help. Only when i bind it to a simple Input Field it is shown.

Anyone knows why, and how i can solve it?

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

try the following code

DATA : value TYPE wdy_key_value,

value_set TYPE wdy_key_value_table.

  • Inserting the countries into the Visa type 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_VISATYPE' ).

  • comment

CALL METHOD cl_wd_dynamic_tool=>get_table_data

EXPORTING

tab_name = 'ZINSP' "give ur ddic table here

row_count = 0

IMPORTING

data = it_zinsp.

LOOP AT it_zinsp ASSIGNING <tablezinsp> .

value-key = <tablezinsp>-zvisaty.

value-value = <tablezinsp>-zvisaty.

INSERT value INTO TABLE value_set.

ENDLOOP.

node_info->set_attribute_value_set( name = 'CA_VISATYPE'

value_set = value_set ).

I hope it helps.

regards,

rohit

Former Member
0 Kudos

hi,

try the following code

DATA : value TYPE wdy_key_value,

value_set TYPE wdy_key_value_table.

  • Inserting the countries into the Visa type 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_VISATYPE' ).

  • comment

CALL METHOD cl_wd_dynamic_tool=>get_table_data

EXPORTING

tab_name = 'ZINSP' "give ur ddic table here

row_count = 0

IMPORTING

data = it_zinsp.

LOOP AT it_zinsp ASSIGNING <tablezinsp> .

value-key = <tablezinsp>-zvisaty.

value-value = <tablezinsp>-zvisaty.

INSERT value INTO TABLE value_set.

ENDLOOP.

node_info->set_attribute_value_set( name = 'CA_VISATYPE'

value_set = value_set ).

I hope it helps.

regards,

rohit