sapdev logo background
sapdev logo sapdev logo
Comments

GET_STATIC_ATTRIBUTE_TABLE method to return all rows of a context table node




The GET_STATIC_ATTRIBUTE_TABLE method simply retrieves all values within a context node table (i.e. cardinality 0..n or 1..n) into an internal table. You can then process this like any other itab.

The code below shows you how to retrieve the values, process them within a loop and then write the changes back to the context node.

* Set single value within context structure
Data: it_scarr type standard table of if_MAIN=>element_CARRIERS, "view name = MAIN, context = CARRIERS
      wa_scarr like line of it_scarr,
      context_node type ref to if_wd_context_node,
      lr_element TYPE REF TO if_wd_context_element.


  context_node = wd_context->get_child_node( name = 'CARRIERS').
*                   CARRIERS' is the name of the context node

* Get context table into internal table
  context_node->get_static_attributes_table(
    importing
      table = it_scarr ).

*Process data
  loop at it_scarr into wa_scarr.
*  Update fields of wa_scarr
    modify it_scarr from wa_scarr.
  endloop.


* Update context: bind updated data to the table context
  context_node->bind_table( it_scarr ).


Also see here for how to use set_attribute to set individual value of a context attribute.

See all Methods of IF_WD_CONTEXT_NODE interface




comments powered by Disqus