cancel
Showing results for 
Search instead for 
Did you mean: 

dropdown by key

Former Member
0 Kudos

Hye techies..

I am learning webdynpro Abap.. i have implemented the UI dropdown by key using WDR_TEST_EVENT.

When i have implemented exactly it is working fine.

I have created a node from data dictonary SBOOK. binded the value SMOKER whcih is the attribute to the dropdown key.. the cardinality of the node is set to 0..1. The smoker has 2 values in its value range. when using the node-> attribute bidning it is giving an error

*Context Path SBOOK.SMOKER Cannot Be Resolved (Last Node Is Empty) *. Please help.

Also help me to fill the dropdown values, through code by using dropdown by key.

Regards,

imran.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Have you bound the selectedkey property of drp key to the context attribute smoker.

Create a context attribute somker type S_SMOKER. BInd the selected key proeprty to this attribute. Automatically the values will be made available in dropdown. No explicit coding is required.

This works fine.

Regards,

Lekha.

Edited by: Lekha on Sep 24, 2009 3:16 PM

Former Member
0 Kudos

hye lekha,

S.. all the bindings are done. Only difference from the example and this is the attribute binded is under the node.

Please help me understand the problem.

Regards

imran.

Former Member
0 Kudos

hi,

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 ).

I hope it wud help u

rgds,

amit

Former Member
0 Kudos

Hi,

I have also created the SMOKER attribute type S_SMOKER under DEMO node with cardinality (1:1) and bound this attribute to the selectedKey property of the drp key.

Everything is working fine. No explicit coding is requried to have the dropdown values as S_SMOKER has fixed values.

Check the cardinality...

Edited by: Lekha on Sep 24, 2009 3:37 PM

Former Member
0 Kudos

hye lekha..

It is working.. after setting the cardinality to 1:1.. Can you please let me know why it should be 1:1.. as i have tried with 0:1 also before this.

Regards.

Imran.

Former Member
0 Kudos

Hi,

The probable reason could be, the context attribute SMOKER has already some values in it. There are no cases

where the node has no element in it.

Former Member
0 Kudos

Thnks lekha.. Solved my problem..looking forward for more help in future.

Answers (0)