cancel
Showing results for 
Search instead for 
Did you mean: 

webdynpro ABAP. read context TABLE

Former Member
0 Kudos

Hi,

i am trying to read a context in an webdynpro for ABAP where the context is an table. if I try to read a single attribute there is no problem:

  • get single attribute

elem_ex_mat_data->get_attribute(

EXPORTING

name = `MATNR`

IMPORTING

value = item_matnr ).

Now I see my value in the variable item_matnr.

But how can I get the whole context table EX_MAT_DATA into a internal table. I tried the the wizard with reading the context of this table EX_MAT_DATA and I get the following coding:

DATA:

node_changing TYPE REF TO if_wd_context_node,

node_ex_mat_data TYPE REF TO if_wd_context_node,

elem_ex_mat_data TYPE REF TO if_wd_context_element,

stru_ex_mat_data TYPE if_tree=>element_ex_mat_data .

  • navigate from <CONTEXT> to <CHANGING> via lead selection

node_changing = wd_context->get_child_node( name = if_tree=>wdctx_changing ).

  • navigate from <CHANGING> to <EX_MAT_DATA> via lead selection

node_ex_mat_data = node_changing->get_child_node( name = if_tree=>wdctx_ex_mat_data ).

  • @TODO handle not set lead selection

IF ( node_ex_mat_data IS INITIAL ).

ENDIF.

  • get element via lead selection

elem_ex_mat_data = node_ex_mat_data->get_element( ).

  • @TODO handle not set lead selection

IF ( elem_ex_mat_data IS INITIAL ).

ENDIF.

  • alternative access via index

  • Elem_Ex_Mat_Data = Node_Ex_Mat_Data->get_Element( Index = 1 ).

  • @TODO handle non existant child

  • if ( Elem_Ex_Mat_Data is initial ).

  • endif.

  • get all declared attributes

elem_ex_mat_data->get_static_attributes(

IMPORTING

static_attributes = stru_ex_mat_data ).

While debugging I find in node_ex_mat_data (CLASS=CL_WDR_CONTEXT_NODE_VAL) a attribute collection with 55 values (thats the number of values the context table should have) but I have no idea how to get the values for my internal table.

Please help.

regards

stefan

Accepted Solutions (1)

Accepted Solutions (1)

thomas_szcs
Active Contributor
0 Kudos

Hi Stefan,

You could call method get_static_attributes_table(). It returns the content of a node as an internal table. Only static attributes are considered of course.

Best regards,

Thomas

Former Member
0 Kudos

Hello Thomas,

it worked, thanks a lot.

regards

stefan

Answers (0)