Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

A different problem with nested tables in an ABAP to XML transformation

johnm16
Participant
0 Likes
4,852

Hi Folks,

got a problem with an ABAP to XML simple transformation. It's similar to other questions that have been asked (and answered), but they haven't helped. This isn't a 'no data' issue, it's a 'some missing lines issue'.

I'm serializing an ABAP deep structure that contains both nested structures and tables (invoice header and items). The structures work, but the tables don't; however, the table tags aren't empty - they just have a single item record instead of multiple items. So it looks as though the transformation is treating the nested table as a nested structure.

(Explanation: I have defined types as follows: data elements are ZDE_, structures are ZSTY_, and table types are ZTTY_. Sorry about the long field/tag names. NB The transformation was generated from the ABAP structure, and the tag names exactly match the field names in the structure) .

In the XSLT_TOOL transaction, the critical part of the ABAP structure looks like this:

This shows a structure type (DatiBeniServizi) which contains a table type (DettaglioLinee). The graphic representation of the same section looks like this:

I have debugged the code, and when the main structure is being passed to the transformation, the DettaglioLinee table definitely contains 4 entries. The resulting XML output only shows the first entry.

For the same section of data, this is the actual transformation code:

Each reference (in green) is the name of the ABAP table, structure or field.

Everything works (no errors or exceptions), except that only one entry from the DettaglioLinee table appears.

I really don't want to have to rewrite this as a manual field by field output - there are a heck of a lot of them. Besides, the transformation should work.

If anyone has any ideas, I'd be most grateful.

Thanks,

John

Hi Folks,

got a problem with an ABAP to XML simple transformation. It's similar to other questions that have been asked (and answered), but they haven't helped. This isn't a 'no data' issue, it's a 'some missing lines issue'.

I'm serializing an ABAP deep structure that contains both nested structures and tables (invoice header and items). The structures work, but the tables don't; however, the table tags aren't empty - they just have a single item record instead of multiple items. So it looks as though the transformation is treating the nested table as a nested structure.

(Explanation: I have defined types as follows: data elements are ZDE_, structures are ZSTY_, and table types are ZTTY_. Sorry about the long field/tag names. NB The transformation was generated from the ABAP structure, and the tag names exactly match the field names in the structure) .

In the XSLT_TOOL transaction, the critical part of the ABAP structure looks like this:

This shows a structure type (DatiBeniServizi) which contains a table type (DettaglioLinee). The graphic representation of the same section looks like this:

I have debugged the code, and when the main structure is being passed to the transformation, the DettaglioLinee table definitely contains 4 entries. The resulting XML output only shows the first entry.

For the same section of data, this is the actual transformation code:

Each reference (in green) is the name of the ABAP table, structure or field.

Everything works (no errors or exceptions), except that only one entry from the DettaglioLinee table appears.

I really don't want to have to rewrite this as a manual field by field output - there are a heck of a lot of them. Besides, the transformation should work.

If anyone has any ideas, I'd be most grateful.

Thanks,

John

5 REPLIES 5
Read only

Former Member
0 Likes
4,358

Not an answer - just a muse.....

What you're seeing seems to imply that the tables have header lines and that possibly only the header line of the table is being processed.

Can you supply the definition of one of your table types ?

Are you perhaps calling a function or a procedure that casts a table into a table with header ???

Rich

Read only

Sandra_Rossi
Active Contributor
4,358

Inside <tt:loop> you must always have exactly one "superior" element (any name is valid). This is not the case in your Simple transformation.

For instance, you should have something like that :

<tt:loop ...>
  <superior>
    <NumeroLinea.../>
    <TipoCessionePrestazione.../>
    ...
  </superior>
</tt:loop>
Read only

0 Likes
4,358

Maybe, in your case, the element <DettaglioLinee> is the superior element and must be moved inside the <tt:loop> block.

Read only

johnm16
Participant
4,353

Hi Folks,

re. question from Richard: the table types are defined in the Workbench, and the tables don't have headers; but it crossed my mind too.

Sandra: thank you for your answer. I tried swapping the <tt:loop> tags to enclose the table name (you were right, it is DettaglioLinee), and lo and behold, it works like a dream. Can't tell you how happy that makes me.

As I mentioned, the transformation was auto-generated from the ABAP structure, so I didn't decide on the logic of the layout - I just renamed the tags in XSLT_TOOL. I'm not sure if SAP regard that as a feature or a teensy weensy bug-ette.

Anyway, thanks again for providing a solution to a 'transformation Newbie'. You weren't to know but the Italian government were about to start levying fines on my company for late resubmission of the correct XML files - as of tomorrow morning. Now we'll get them sent off in time!

Best regards,

John

Read only

janewar
Participant