sapdev logo background
sapdev logo sapdev logo
Comments

BIND_STRUCTURE method of interface IF_WD_CONTEXT_NODE to assign structure to context




The BIND_STRUCTURE method Binds a flat structure of fileds to a context element. If using this ensure that your context element has been declared as a flat context by assiging the Cardinality to 0..1 or 1..1

The abap code below selects an entry from the sap database table scarr into a local work area structure(wa_scarr). It then assigns this to the 'CARRIES' context where all values in the context structure will be updated with those in wa_scarr.

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.

* Retrieve new data
select single *
  from scarr
  into wa_scarr
 where CARRID = 'AA' .

* bind this data to the context of the flat structure
  if sy-subrc eq 0.
    context_node = wd_context->get_child_node( name = 'CARRIERS').
*                   CARRIERS' is the name of the context node
    context_node->bind_structure( wa_scarr ).
  endif.

Also see here for how to use set_attribute to see how to set an invidual field within a context structure.
See all Methods of IF_WD_CONTEXT_NODE interface




comments powered by Disqus