cancel
Showing results for 
Search instead for 
Did you mean: 

Drop Down By Key

Former Member
0 Kudos

Hi Experts,

In the init method : -> I have created a dynamic node "FLIGHTS" and assign the sflight structure to it.

In the DOMODIFY Method 😆 I have created a MAtrix layout, and create a element Drop down by key,

In bind_selected_key FLIGHTS.CARRID.

But it is giving the dump

Fehler im DROPDOWN_BY_KEY "_04" des Views "ZSEARCH.MAIN": Context-Bindung des Properties SELECTED_KEY kann nicht aufgelöst werden: The MAIN.1.FLIGHTS node does not contain any elements

Can you please suggest, how to resolve it.

Best regards.

Rohit

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi,

refer to this example wdr_test_events view dropdownbykey

Former Member
0 Kudos

Hi Rohit,

Use a break point inside WDDOMODIFY to check your code for creation is ALWAYS EXECUTED and NOT only for the firsttime. Secondly why dont you place the WDDOINIT & WDDOMODFY code together either in ONE of them.

Greetings

Prashant

former_member402443
Contributor
0 Kudos

Hi Rohit,

The error you got is due to the attribute is not able in the node flight or might be you wrongly refering the node attribute.

Please go thru the WDA Component - DEMODYNAMIC in ur sap system.

This will give u an idea abt the dynamic node creation.

Regards

Manoj Kumar

Former Member
0 Kudos

Hi Manoj,

I have checked at the refernce is ok.

That component is done similarly,

Best regards,

Rohit

former_member402443
Contributor
0 Kudos

Hi Rohit,

Please can you send your code, so that I can check why the error is occured.

Regards

Manoj Kumar

Former Member
0 Kudos

hi,

in doint

DATA : lr_root_node type ref to if_wd_context_node_info,

lr_flights_node type REF TO if_wd_context_node_info,

lt_value_set type table of wdr_context_attr_value,

ls_value_set type wdr_context_attr_value.

  • Attribute data

DATA : lr_element_info TYPE wdr_context_attribute_info.

lr_root_node = wd_context->get_node_info( ).

lr_root_node->add_new_child_node(

EXPORTING

name = 'FLIGHTS' " Web Dynpro: Name of Context Node

RECEIVING

child_node_info = lr_flights_node

).

lr_element_info-name = 'CARRID'.

lr_element_info-type_name = 'S_CARR_ID'.

call METHOD lr_flights_node->add_attribute

EXPORTING

attribute_info = lr_element_info " ATTRIBUTE_INFO

.

ls_value_set-value = 'KN'.

ls_value_set-text = 'Karnataka'.

append ls_value_set to lt_value_set.

ls_value_set-value = 'MH'.

ls_value_set-text = 'Maharashtra'.

append ls_value_set to lt_value_set.

lr_flights_node->set_attribute_value_set(

EXPORTING

name = 'CARRID' " Web Dynpro: Name of Context Element

value_set = lt_value_set " All Fixed Values of an Attribute with Texts

).

in womodify

lr_dropdown_by_key = cl_wd_dropdown_by_key=>new_dropdown_by_key(

bind_selected_key = 'FLIGHTS.CARRID'

width = '70'

).

lr_matrix_head_data = cl_wd_matrix_head_data=>new_matrix_head_data(

element = lr_dropdown_by_key

v_align = '01'

).

lr_tr_container->add_child(

EXPORTING

the_child = lr_dropdown_by_key " THE_CHILD

).

if you need more info please let me know

Best regards,

Rohit

Former Member
0 Kudos

Set Cardinality of your NODE Flight as 1..N

Hopefully this should fix.

Greetings

Prashant

Former Member
0 Kudos

No Prashant,

it has solved the issue.

it is giving the dump that it does not have any element in 'FLIGHTS.CARRID'. do i am missing something or this is the wrong way to bind the drop down by key.

Best regards,

Rohit

Former Member
0 Kudos

Hi Rohit,

well you can try this...in your wddomodify first try to read your flights data.

node_flight = wd_context->get_child_node( name = if_componentcontroller=>wdctx_node_flight ). elem_flight = node_flight->get_element( ).

Put break point on these two lines & debug. some how you FLIGHTS node to me , appears is not created or is destroyed as soon as you enter WDDOMODIFY. Once you debug you will have a clearer picture ...

Greetings

Prashant