cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Dropdown dynamically

Former Member
0 Kudos

Hello Everyone,

I am facing one senario where i have an input field on the screen where the user enters the structure name or a table name and on button click i need to display the corresponding fields of the table or components of the structure given by the user also if their is domain value exist for that field or component then it should be displayed using dropdown but not F4 help.

I am creating the node dynamically along with the corresponding attributes and also using method cl_wd_dropdown_by_key

but it's nt working since i don't know how to declare the path for the node since i need to pass it to the method in

bind_selected_key parameter.

I hope u gt my question .....

Thanks

Ravi

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member210967
Participant
0 Kudos

Ravi,

lv_bindvalue type string.

CONCATENATE wd_assist->c_node_name is_ref_elem-name INTO lv_bindvalue SEPARATED BY '.'.

wd_assist->c_node is the name of the node on highest level, declared as a fixed value.

is_ref_elem-name is of TYPE wdr_context_attr_info_map.

*&- lt_ref_elem contains the attributes of the context node FDE

lt_ref_elem = lr_node_info->get_attributes( ).

READ TABLE lt_ref_elem INTO wa_ref_elem WITH KEY name = ls_loop_element-sorting_field.

so you will get e.g. FDE.SV1 as node name.

Hope these code snippets helps.

Suc6, John Maas

Former Member
0 Kudos

Hi,

I tried with the following way i am getting this error

Error in MATRIX_LAYOUT "_08" of view "YHDYNAMIC_COPY1.TABLE_DDIC": LayoutData type "GRID_DATA" for child element "_26" is not permitted

now if i use MATRIX_DATA then the error is can't find attrbute CARRID.

i my case i have one root node ROOT1 and attibute structure_name .

now the use enters sflight on the screen .

i need to map all the fields of sflight to my attribute structure_name and sflight to roo1 node.

and pass fields to the method CL_WD_DROPDOWN_BY_KEY=>NEW_DROPDOWN_BY_KEY

i hope u got my point ...

Let me know if i am missing something ....

also whats value_set_list[] and value_list and where it has been declared ..??

Thanks

Ravi

former_member210967
Participant
0 Kudos

Hi Ravi,

In setting up the node we did like this:

IF ls_element-type_format = 06. "list

lr_subnode_info = wd_context->get_node_info( ).

lr_subnode_info = lr_subnode_info->get_child_node( wd_assist->c_node_name ).

CLEAR value_set_list[].

SORT wd_comp_controller->lt_list BY de_id sequence.

LOOP AT wd_comp_controller->lt_list INTO ls_list.

value_list-value = ls_list-list_id.

value_list-text = ls_list-description.

*&- Pickup only values for de_id

READ TABLE wd_comp_controller->lt_element INTO ls_element

WITH KEY sorting_field = ls_attribute-name.

IF ls_element-de_id = ls_list-de_id.

INSERT value_list INTO TABLE value_set_list.

ENDIF.

ENDLOOP.

lr_subnode_info->set_attribute_value_set( name = ls_attribute-name

value_set = value_set_list ).

ENDIF.

ENDIF.

In creating the layout we then added next code:

IF is_element-type_format = wd_assist->c_list.

lr_dropdown = cl_wd_dropdown_by_key=>new_dropdown_by_key(

id = lv_input_id

bind_selected_key = lv_bindvalue

tooltip = is_element-tooltip ).

setup( dropdown = lr_dropdown wa_elem = is_element ).

lr_grid_data = cl_wd_grid_data=>new_grid_data( element = lr_dropdown

v_align = '02' ).

lr_tc_container->add_child( lr_dropdown ).

ENDIF.

Hope this puts you in the right direction.

Kind regards, John