cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Webdbynpro Dropdown by Key

Former Member
0 Kudos

Hi Gurus,

I have creaed multiple dropdowns ( for skill1, skill2, skill3), but all got bound with one attribute in context (I did this as I have to show the same values in all dropdowns ). Once the user fill all dropdowns and click on update, they should get updated in one table. I'm trying to read all given values in the dropdowns, with get_static_attributes_table, but it is capturing only the last dropdown filed. Can you please explain me how can I hold all my dropdowns values into an internal table and process to update a standard table.

Thanks,

David.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

For multiple dropdowns, make separate context attributes. Bind these attributes with the dropdwon by key.

Now populate each attribute binded to dropdown with values.

when you have to read the vlaues of all the dropdown , just read the node .

Former Member
0 Kudos

Hi,

Thanks for your reply.

I know how to achieve this with separate context attributes. Do you know how I can achieve this with single attribute.

Thanks,

Edited by: david santi on Dec 16, 2009 5:38 PM

Former Member
0 Kudos

hi

this is how , u can populate the values in ur fropdown by key

1 declare a context node of cardinality 0..1/1..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


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

and using code wizard u can use the method get_static_attributes_table , read the context node



DATA lo_nd_po_items TYPE REF TO if_wd_context_node.
DATA lo_el_po_items TYPE REF TO if_wd_context_element.
DATA itab TYPE standard table of wd_this->element_po_items.
DATA last_row type I.
DATA ls_po_items TYPE wd_this->element_po_items.
DATA lv_po_item LIKE ls_po_items-po_item.
* navigate from <CONTEXT> to <PO_ITEMS> via lead selection
lo_nd_po_items = wd_context->get_child_node( name = wd_this->wdctx_po_items ).

CALL METHOD lo_nd_po_items->get_static_attributes_table
IMPORTING
table = it_role .

reagrds,

amit

anandprakash_rai2
Participant
0 Kudos

Hi david,

go thru this thread

hope it helps