on 01-16-2009 1:47 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
problem resolved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
basically it is not possible to bind a deep structure to the context.
you have to do the node->subnode thing manually
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
some one happens to know it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.