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

Deep structure to XML using STRANS

Former Member
0 Likes
5,784

All,

I have to convert a deep structure into an XML document. The deep structure  contains repeating elements inside the top element.

I created table types with linetypes as the structure whcih inturn have table types. When i use the main strucutre in STRANS to generate the transformation, an additional element is cretaed for everylinetype i specified for the tabletype which I donot want.

For ex.

ZTAB IS TABLE TYPE WITH LINE TYPE as ZLINETYPE.

Desired output.

<PAGE>

<FIELDA></FIELDA>

<FIELDB></FIELDB>

   <ZTAB>

          <FIELD1> </FIELD1>

          <FIELD2> </FIELD2>

   </ZTAB>

<ZTAB>

     <FIELD1> </FIELD1>

     <FIELD2> </FIELD2>

   </ZTAB>

</PAGE>

But in the STRANS while creating the transformation, I get

<PAGE>

<FIELDA></FIELDA>

<FIELDB></FIELDB>

   <ZTAB>

          <ZLINETYPE>

             <FIELD1> </FIELD1>

             <FIELD2> </FIELD2>

          </ZLINETYPE>

   </ZTAB>

<ZTAB>

      <ZLINETYPE>

         <FIELD1> </FIELD1>

         <FIELD2> </FIELD2>

     </ZLINETYPE>

   </ZTAB>

</PAGE>

How do i avoide this additional element of linetypes ?

Am I missgin anything here ?  Any pointers will be very helpful.

Thanks

BR

NIlesh Puranik

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,455

Can you share the ABAP and STRANS codes?

6 REPLIES 6
Read only

Former Member
0 Likes
3,456

Can you share the ABAP and STRANS codes?

Read only

0 Likes
3,455

HI Manish,

There is no ABAP code as I didnt call the transformation yet. I created the table types and line types in the ABAP data dictionary in SE11 and used it in the STRANS.

In the STRANS i see following

If you see LEVERINGADRES is a table of linetype ZLEV_ADRES which has fields like STRAAT and so on but i don't want ZLEV_ADRES to appear as an element in the XML file to be generated.

Same goes to element ZCMETER as well.

Any idea about this or may be my XML hierarchy is logically not correct ?

Thanks in advance.

BR

Nilesh

Read only

0 Likes
3,455

So it is a simple transformation.

I opened DEMO_ST_TABLE in STRANS and saw something similar.

Output would have table tag, and n number of tr tags.

It is possible to drag every node under tr tag on tr tag so that they come directly under table icon, and then tr tag can be deleted. Looking at below screenshot, it won't have n number of tr tags because everything under it has been moved one level up, directly under table icon.

You can try something similar.

Read only

0 Likes
3,455

Hello Manish,

Exactly what i was looking for. Thanks a lot for sharing the trick !

-Nilesh

Read only

Former Member
0 Likes
3,455

Hi Nilesh,

You can modify the tag names as per your requirement.

There are lot of blogs if you search...

©: Generate Simple Transformation for XML in ABAP - Part II:Careerless Whispers about SAP

Also run the transformation to see the output then make amendments accordingly.

Regards

Read only

0 Likes
3,455

Hello Mohammed,

Thanks for the answer but I dont wish to modify the tag names but I want that element NOT to be present in the XML file. This element is coming of the linetype i specify in the table type while creating the structure.

Thanks

BR

Nilesh