cancel
Showing results for 
Search instead for 
Did you mean: 

Get Value from LeadSelect in table Row

Former Member
0 Kudos

Hello Everyone,

Could anyone give me the code to get the value of a field depending on the Leadselect in a table please. I would greatly appreciate your help.

I hope you can understand my question. Please let me know if you need more clarification.

Regards,

Gopal.

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You can use the code wizard to generate this for you. Here is the code that is generally generated by the wizard.

To read a single attribute from the leadSelection Element:

DATA lo_nd_sales_orders_sel TYPE REF TO if_wd_context_node.
  DATA lo_el_sales_orders_sel TYPE REF TO if_wd_context_element.
  DATA ls_sales_orders_sel TYPE wd_this->element_sales_orders_sel.
  DATA lv_so_id TYPE wd_this->element_sales_orders_sel-so_id.
* navigate from <CONTEXT> to <SALES_ORDERS_SEL> via lead selection
  lo_nd_sales_orders_sel = wd_context->get_child_node( name = wd_this->wdctx_sales_orders_sel ).
* get element via lead selection
  lo_el_sales_orders_sel = lo_nd_sales_orders_sel->get_element( ).
* get single attribute
  lo_el_sales_orders_sel->get_attribute(
    EXPORTING
      name =  `SO_ID`
    IMPORTING
      value = lv_so_id ).

To Read the Entire structure of a leadSelection Element:

DATA lo_nd_sales_orders_sel TYPE REF TO if_wd_context_node.
  DATA lo_el_sales_orders_sel TYPE REF TO if_wd_context_element.
  DATA ls_sales_orders_sel TYPE wd_this->element_sales_orders_sel.
* navigate from <CONTEXT> to <SALES_ORDERS_SEL> via lead selection
  lo_nd_sales_orders_sel = wd_context->get_child_node( name = wd_this->wdctx_sales_orders_sel ).
* get element via lead selection
  lo_el_sales_orders_sel = lo_nd_sales_orders_sel->get_element( ).
* get all declared attributes
  lo_el_sales_orders_sel->get_static_attributes(
    IMPORTING
      static_attributes = ls_sales_orders_sel ).

Answers (1)

Answers (1)

Former Member
0 Kudos

hi Gopal ,

u must have created a context node in the context tab of ur view and different context attributes under it.

1 Go to code wizard or Press CONTROL + F7

2 Select the radio butto read context node/attribute

3 to read a single context attribute under ur context node , choose the attribute and press enter

4 to read the entire context node / structure , seect the context node and press enter

thus u wud get the value from LeadSelect in ur table row .

in ur case , u need to select the context node and press enter



** reading context node cn_table
  DATA : lo_nd_cn_table TYPE REF TO if_wd_context_node ,
        lo_el_cn_table TYPE REF TO if_wd_context_element ,
        ls_cn_table    TYPE wd_this->element_cn_table.
*
**   navigate from <CONTEXT> to <CN_TABLE> via lead selection
 lo_nd_cn_table = wd_context->get_child_node(
                  name = wd_this->wdctx_cn_table ).
***    get element via lead selection
 lo_el_cn_table = lo_nd_cn_table->get_lead_selection(  ).
  lo_el_cn_table->get_static_attributes( IMPORTING
            static_attributes = wa_table ).

for my specific example , I am reading the context node cn_node , and the values are stored in the corresponding work area

wa_table. I have declared wa_table like this :


DATA : wa_table type str_table .
// str_table is a structure which contains variable as like context attributes under my node cn_node

regards,

amit