cancel
Showing results for 
Search instead for 
Did you mean: 

How to get context from a table back into an internal table

Former Member
0 Kudos

Hello,

I am new with working WD ABAP. I achieved to build a table with some data.

But now I want to get the data back from the view table to an internal table,

to update for example a sap table.

How can ik do this? With the node->bind_table I achieved to give the data to

the view . But what must I do to render it back to an internal table.

For a normal field I know how to this, with the get_attribute method of an element.

Thanks in advance.

Harrie

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Harrie.

You can read the data from the context node directly.


data:
          Node_Po_Data     type ref to If_Wd_Context_Node,
          Node_Po_Items    type ref to If_Wd_Context_Node.

    data:
          lt_items         type table of bapimepoitem.

    data:
          Stru_Po_Items    type If_V_Po_Data=>Element_Po_Items,
          ls_item          type bapimepoitem.

    field-symbols:
                   <items> type any table.

*   navigate from <CONTEXT> to <PO_DATA> via lead selection
    Node_Po_Data = wd_Context->get_Child_Node( Name = IF_V_PO_DATA=>wdctx_Po_Data ).

*   navigate from <PO_DATA> to <PO_ITEMS> via lead selection
    Node_Po_Items = Node_Po_Data->get_Child_Node( Name = IF_V_PO_DATA=>wdctx_Po_Items ).

*   @TODO handle not set lead selection
    if ( Node_Po_Items is initial ).
    endif.

   assign lt_items to <items>.

*   get actual content
    node_po_items->GET_STATIC_ATTRIBUTES_TABLE(
      importing
        table = <items>
     ).
    move <items> to lt_items.

Hope this helps.

Cheers,

Sascha

Former Member
0 Kudos

Thanks sascha for the coding it is clear for me what todo!

Former Member
0 Kudos

Hi Harrie.

I just found out that it is much more easier.

Assume that your context structure is bapimepoitem.

 data:
          lt_items         type table of bapimepoitem.
 
*   navigate from <CONTEXT> to <PO_DATA> via lead selection
    Node_Po_Data = wd_Context->get_Child_Node( Name = IF_V_PO_DATA=>wdctx_Po_Data ).
 
*   navigate from <PO_DATA> to <PO_ITEMS> via lead selection
    Node_Po_Items = Node_Po_Data->get_Child_Node( Name = IF_V_PO_DATA=>wdctx_Po_Items ).
 
*   @TODO handle not set lead selection
    if ( Node_Po_Items is initial ).
    endif.
 
*   get actual content
    node_po_items->GET_STATIC_ATTRIBUTES_TABLE(
      importing
        table = lt_items
     ).

You do not need to handle it with field symbols.

Cheers,

Sascha

Former Member
0 Kudos

Hi Sascha,

Thanks, I already found it in another forum!

Harrie

Former Member
0 Kudos

Hi Harrie Prinsen

You can use GET_DATA_SOURCE() method of the class CL_WD_TABLE.

Regards

Rakesh

Former Member
0 Kudos

Thanks rakesh,

I will try to getr it work!

Harrie