cancel
Showing results for 
Search instead for 
Did you mean: 

Get values from selected row of a table

Former Member
0 Kudos

Hi all,

I am trying to get the selected row values from my table.

I know in webdynpro java, you can get it in the leadselection using

String <myattribute> = wdcontext.current<TestTableElement>.get<attributeName>;

How can I get it in webdynpro ABAP.I am pretty new to Webdynpro ABAP.

It would be really great if you can help me with any documentation comparing webdynpro java and web dynpro ABAP syntaxes.

Thanks

Kukku

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

It must be easy for you to understand how it happens in Web Dynpro ABAP

In Web Dynpro ABAP, you have to use API

Every Node is of type IF_WD_CONTEXT_NODE

Every Element is of type IF_WD_CONTEXT_ELEMENT

you have to get the reference of the Node first

to get a child node you have to call GET_CHILD_NODE method of IF_WD_CONTEXT_NODE

you have an Attribute called WD_CONTEXT just like wdContext in Web Dynpro Java

WD_CONTEXT->GET_CHILD_NODE( '<name of the child node>' ) will return you the child node reference directly under your root context node.

GET_LEAD_SELECTION of IF_WD_CONTEXT_NODE will return the lead selected element which is of type IF_WD_CONTEXT_ELEMENT

use GET_ATTRIBUTE method of IF_WD_CONTEXT_ELEMENT to read a particular context attribute

Hope it is clear

Abhi

Former Member
0 Kudos

Hi Abhimanyu,

Thanks for your immediate response.

It was really helpful in speeding up with webdynpro ABAP.

Thanks

Kukku

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

data:lt_elements TYPE wdr_context_element_set,

lo_elements TYPE REF TO if_wd_context_element,

lo_node type ref to if_wd_context_node.

lt_elements = lo_node->get_selected_elements( ).

CHECK NOT lt_elements[] IS INITIAL.

LOOP AT lt_elements INTO lo_elements.

  • Get Contents of selected Lines............

CALL METHOD lo_elements->get_static_attributes

IMPORTING

static_attributes = ls_user_entities.

ENDLOOP.

Former Member
0 Kudos

Hi Sridevi,

I appreciate your valuable inputs!

Could you please tell me why a LOOP is required to get the input values.

(I am refering to line --- LOOP AT lt_elements INTO lo_elements.)

Is lt_elements an internal table? What is this type wdr_context_element_set.

I dont have much idea of type wdr_context_element_set.

If possible can you provide a brief description of the steps here.

Thanks

Kukku

Former Member
0 Kudos

Hi

you can use the following code


NODE_CO = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_COM).
 ELEM_CO = NODE_COM->GET_ELEMENT(  ).
 ELEM_CO->GET_STATIC_ATTRIBUTES(
    IMPORTING
      STATIC_ATTRIBUTES = STRU_CO ).
 

Get_element will give you lead selection .

Regards

Naresh

Former Member
0 Kudos

Hi Naresh,

Thanks for your response.

What is the structure of context in your example mentioned.

I mean what is the name if your context node and attributes in this example.

I didnt undertand STRU_CO.

Thanks

Kukku

Former Member
0 Kudos

HI

here context node is CO

see the following


data:
NODE_CO                    TYPE REF TO IF_WD_CONTEXT_NODE,
      ELEM_CO                    TYPE REF TO IF_WD_CONTEXT_ELEMENT,
      STRU_CO                     TYPE WD_THIS->ELEMENT_CO ,

NODE_CO = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_CO).
 ELEM_CO = NODE_CO->GET_ELEMENT(  ).
 ELEM_CO->GET_STATIC_ATTRIBUTES(
    IMPORTING
      STATIC_ATTRIBUTES = STRU_CO ).