‎2010 Dec 03 3:56 PM
Hi,
Suppose I have a variable A type ref to data which refers to variable B type some_itab
Calling call transformation id source root = a would give an empty XML. The id transformation seem to be able to resolve elementary types, defined structures and references, but it somehow can't resolve generic references to structures.
Any ideas?
‎2010 Dec 04 2:37 AM
Not at the system now but I think you should do this using a field symbol:
DATA: gr_a TYPE REF TO DATA.
FIELD-SYMBOLS: <lt_a> TYPE STANDARD TABLE.
* Assuming table is already created and referenced by GR_A...
ASSIGN gr_a->* TO <lt_a>.
CHECK sy-subrc = 0.
CALL TRANSFORMATION id SOURCE = <lt_a>...
‎2010 Dec 03 8:09 PM
It seems like the variable 'B' has to be created such that 'some_itab' is in the heap instead of the stack (ie, B type ref to some_itab. create B. instead of B type some_itab.)
Anyone know if this is an actual restriction of call transformation and why?
‎2010 Dec 04 2:37 AM
Not at the system now but I think you should do this using a field symbol:
DATA: gr_a TYPE REF TO DATA.
FIELD-SYMBOLS: <lt_a> TYPE STANDARD TABLE.
* Assuming table is already created and referenced by GR_A...
ASSIGN gr_a->* TO <lt_a>.
CHECK sy-subrc = 0.
CALL TRANSFORMATION id SOURCE = <lt_a>...
‎2010 Dec 06 6:05 PM
Hi Alejandro,
Thanks for the solution. I have a potentially n00b follow up question.
We may not be able to dereference the variables because we would like to assemble a bunch of these generic reference variables into another internal table on which the call transformation will be called. The challenge for us is not to transform a single internal table but to transform an internal table of tables. Building the second internal table with reference variables made in my previously mentioned method works. I'm not sure if it's possible to construct a table of field symbols.
Am I on wrong assumptions? Thanks!
‎2010 Dec 09 8:50 PM
If I get it right, you have an internal table with line type: TYPE REF TO data. Each of those references point to an "item" internal table.
You can´t "construct" an internal table of field symbols. A solution I see is to transform one "item" table at a time, looping the wrapping internal table. And finally group the resulting XMLs into a single one, using the iXML library (this shouldn't be too difficult).
Regards
‎2010 Dec 09 8:58 PM
Thanks for the info. We ended up building a internal table of strings (XML) because we needed other info to be associated with the XMLs so it suited our needs.