Reputation: 655
I am using call transformation to convert XML to ABAP structure.
call transformation demo_id_upper_lower "id
parameters mode = 'UP'
source xml asxml_str
result paymentrequest = abap_out.
This works as expected and the data is mapped to ABAP structure successfully. paymentrequest
is the root tag ins this example.
Is there a way to specify a variable containing the tag name instead of the tag directly in the result?
data(my_var) = 'paymentrequest'.
call transformation demo_id_upper_lower "id
parameters mode = 'UP'
source xml asxml_str
result my_var = abap_out.
In this case there's no exception but variable is not resolved to value and I think it reads it literally.
Note: I have also tried assigning the element name to a field symbol. But that too didn't work.
Upvotes: 1
Views: 2476
Reputation: 13629
There's this answer to your question, in this other ABAP forum.
data(res_tab) = value abap_trans_resbind_tab( ( name = root value = ref #( abap_out ) ) ).
call transformation demo_id_upper_lower "id
parameters mode = 'UP'
source xml asxml_str
result (res_tab).
if result_tab is not initial.
read table result_tab into data(result_wa) index 1.
if sy-subrc = 0.
assign result_wa-value->* to field-symbol(<abap_out>).
if <abap_out> is assigned.
abap_out = <abap_out>.
endif.
endif.
endif.
Note, that the code given in this forum implements my very first "comment" two days ago, cf RESULT (rtab) in the ABAP documentation of CALL TRANSFORMATION.
Upvotes: 3