cancel
Showing results for 
Search instead for 
Did you mean: 

Add a value that is selected row's field of a table To DropDownByIndex

Former Member
0 Kudos

Hi,

When i selected a row of table, the value which is of selected row, is adding to dropdownbyindex but other values of dropdownbyindex is deleting.

How can i add a value that is selected row's field of a table to dropdownbyindex? (as a javascript method that object.additem('value')).

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Get the lead selection row of the table using the GET_LEAD_SELECTION (check for other related methods) and read the value of the field that you want.

Using this value, first try to add this to a other table and try to bind this table to the DropDownByIndex.

Regards

Lekha

Former Member
0 Kudos

Hi,

Thanks for your reply, i m taking the value of selected row with the method is Get_Child_Node.

And this value is binding to dropdownbyindex, but when another selected row's value is binding, other values of dropdownbyindex is deleting.

What do i need to do?

Former Member
0 Kudos

Hi,

Everytime you select the row, append the selected value to the internal table then Bind the table to the dropdown to show that new value.

Regards

Lekha

Former Member
0 Kudos

Hi,

Thanks again,

i've already appened the value of selected row into internal table.

i'm writing my codes if you want to research .

DATA lo_nd_gt_orders TYPE REF TO if_wd_context_node.
  DATA lo_el_gt_orders TYPE REF TO if_wd_context_element.
  DATA ls_gt_orders TYPE wd_this->element_gt_orders.
  DATA lt_sel_items TYPE STANDARD TABLE OF
wd_this->element_gt_sel_items.
  DATA ls_sel_items TYPE wd_this->element_gt_sel_items.

* navigate from <CONTEXT> to <GT_ORDERS> via lead selection
  lo_nd_gt_orders = wd_context->get_child_node( name =
wd_this->wdctx_gt_orders ).

* @TODO handle not set lead selection
  IF lo_nd_gt_orders IS INITIAL.
  ENDIF.

* get element via lead selection
  lo_el_gt_orders = lo_nd_gt_orders->get_element(  ).

* @TODO handle not set lead selection
  IF lo_el_gt_orders IS INITIAL.
  ENDIF.

* alternative access  via index
* lo_el_gt_orders = lo_nd_gt_orders->get_element( index = 1 ).
* @TODO handle non existant child
* IF lo_el_gt_orders IS INITIAL.
* ENDIF.

* get all declared attributes
  lo_el_gt_orders->get_static_attributes(
    IMPORTING
      static_attributes = ls_gt_orders ).

data:
Node_order type REF TO IF_WD_CONTEXT_NODE.

ls_sel_items-vbeln = ls_gt_orders-vbeln.
APPEND ls_sel_items to lt_sel_items.

* navigate from <CONTEXT> to <SFLIGHT> via lead selection
Node_order = wd_Context->get_Child_Node( Name = `GT_SEL_ITEMS` ).
*Node_order->Bind_Table( lt_sel_items ).
Node_order->BIND_STRUCTURE( ls_sel_items ).

Former Member
0 Kudos

Hi,

Check the cardinatliy of the Table once.

In the deugging were you able to find all the values in the Ls_items and the lt_orders table.

Check out this PDF for more help -

http://www.sap-press.de/download/dateien/1079/sappress_web_dynpro_for_abap.pdf

Regards

Lekha

Former Member
0 Kudos

Hi Nurulla,

This is where your problem lies: You are binding a new internal table to the node GT_SEL_ITEMS. This will take away all the old values



* get all declared attributes
  lo_el_gt_orders->get_static_attributes(
    IMPORTING
      static_attributes = ls_gt_orders ).
 
data:
Node_order type REF TO IF_WD_CONTEXT_NODE.
 
ls_sel_items-vbeln = ls_gt_orders-vbeln.
APPEND ls_sel_items to lt_sel_items.
 
* navigate from <CONTEXT> to <SFLIGHT> via lead selection
Node_order = wd_Context->get_Child_Node( Name = `GT_SEL_ITEMS` ).
*Node_order->Bind_Table( lt_sel_items ).
Node_order->BIND_STRUCTURE( ls_sel_items ).

Your algorithm should actually be

Retrieve lt_sel_items from node GT_SEL_ITEMS first at the beginning of the code.

and then append ls_sel_items to this lt_sel_items .

So your code should now be.


DATA lo_nd_gt_orders TYPE REF TO if_wd_context_node.
  DATA lo_el_gt_orders TYPE REF TO if_wd_context_element.
  DATA ls_gt_orders TYPE wd_this->element_gt_orders.
  DATA lt_sel_items TYPE STANDARD TABLE OF
wd_this->element_gt_sel_items.
  DATA ls_sel_items TYPE wd_this->element_gt_sel_items.
 
* navigate from <CONTEXT> to <GT_ORDERS> via lead selection
  lo_nd_gt_orders = wd_context->get_child_node( name =
wd_this->wdctx_gt_orders ).
 
* @TODO handle not set lead selection
  IF lo_nd_gt_orders IS INITIAL.
  ENDIF.
 
* get element via lead selection
  lo_el_gt_orders = lo_nd_gt_orders->get_element(  ).
 
* @TODO handle not set lead selection
  IF lo_el_gt_orders IS INITIAL.
  ENDIF.
 
* alternative access  via index
* lo_el_gt_orders = lo_nd_gt_orders->get_element( index = 1 ).
* @TODO handle non existant child
* IF lo_el_gt_orders IS INITIAL.
* ENDIF.
 
* get all declared attributes
  lo_el_gt_orders->get_static_attributes(
    IMPORTING
      static_attributes = ls_gt_orders ).
 
data:
Node_order type REF TO IF_WD_CONTEXT_NODE.
 
ls_sel_items-vbeln = ls_gt_orders-vbeln.

 
* navigate from <CONTEXT> to <SFLIGHT> via lead selection
Node_order = wd_Context->get_Child_Node( Name = `GT_SEL_ITEMS` ).

*Retrieve the table from GT_SEL_ITEMS and then add the ls_sel_items to it
  Node_order->get_static_attributes_table(
    IMPORTING
      static_attributes = ls_gt_orders ).
APPEND ls_sel_items to lt_sel_items.
Node_order->Bind_Table( lt_sel_items ).


Former Member
0 Kudos

Bind lt_sel_items to table.

Former Member
0 Kudos

Corrections to the last chunk


*Retrieve the table from GT_SEL_ITEMS and then add the ls_sel_items to it
  Node_order->get_static_attributes_table(
    IMPORTING
      table = lt_gt_orders ).
APPEND ls_sel_items to lt_sel_items.
Node_order->Bind_Table( lt_sel_items ).

Former Member
0 Kudos

Thank you very much everybody,

And Thank you Rashmi, your answer solved my problem.

Thanks.

Former Member
0 Kudos

finally i changed something that,

data:
Node_order type REF TO IF_WD_CONTEXT_NODE.

ls_sel_items-vbeln = ls_gt_orders-vbeln.
APPEND ls_sel_items to lt_sel_items.


* navigate from <CONTEXT> to <SFLIGHT> via lead selection
Node_order = wd_Context->get_Child_Node( Name = `GT_SEL_ITEMS` ).

*Retrieve the table from GT_SEL_ITEMS and then add the ls_sel_items toit
  Node_order->get_static_attributes_table(
    IMPORTING
      table = lt_gt_orders ).


loop at lt_gt_orders INTO ls_gt_orders.
ls_sel_items-vbeln = ls_gt_orders-vbeln.
APPEND ls_sel_items to lt_sel_items.
ENDLOOP.
Node_order->Bind_Table( lt_sel_items ).

Answers (0)