cancel
Showing results for 
Search instead for 
Did you mean: 

the returned value of BAPI call

Former Member
0 Kudos

Hi, experts,

I have a question about returned value of BAPI call.

when the returned value is mapped as an attribute and this return value itsself is of the type: table of a certain structure. Is there any possibility that the value of this table still can be extracted from the mapped attribute? If it is possible, how?

If not, how should this kind of situation be handled:

when the returned value of the function at the backend has more one layer structure?

Thanks and best regards,

Fan

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

In my experience you shouldn't use the service wizard to generate the context of such deeply nested structures. They don't generate or map correctly because it tries to put the table type as the type of the context attribute.

Instead you should propery model the relationship in the context using nested nodes. Here is an example of address <-> address text where you can have multiple address texts per address. From the service this was a returned nested table.

****BP Address and Address Text
  data lo_nd_bp_addr type ref to if_wd_context_node.
  data lo_nd_bp_addr_text type ref to if_wd_context_node.
  data lo_el_bp_addr type ref to if_wd_context_element.
* navigate from <CONTEXT> to <BP_ADDR> via lead selection
  lo_nd_bp_addr = wd_context->get_child_node( name = wd_this->wdctx_bp_addr ).
  lo_nd_bp_addr->bind_table( wd_this->gt_bp_addr ).
****Add the Address Text Table as Child of each Address Context Record
  data element_set type wdr_context_element_set.
  field-symbols <wa_set> like line of element_set.
  field-symbols <wa_bp_addr> like line of wd_this->gt_bp_addr.
  element_set = lo_nd_bp_addr->get_elements( ).
  loop at element_set assigning <wa_set>.
    read table wd_this->gt_bp_addr index sy-tabix assigning <wa_bp_addr>.
    lo_nd_bp_addr_text = <wa_set>->get_child_node( name = if_componentcontroller=>wdctx_bp_addr_text ).
    lo_nd_bp_addr_text->bind_table( <wa_bp_addr>-t_text ).
  endloop.

Answers (4)

Answers (4)

Former Member
0 Kudos

problem resolved.

Former Member
0 Kudos

Hi, Thomas

Thank you very much for your reply.

You have definitely answered a long existing question of mine.

Wish you a happy weekend.

Best regards,

Fan

Former Member
0 Kudos

basically it is not possible to bind a deep structure to the context.

you have to do the node->subnode thing manually

Former Member
0 Kudos

some one happens to know it?