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

SAP TABLE TO XML

Former Member
0 Likes
889

Hi Gurus,

I am converting a tabletype into xml simple structure and i am following this tutorial Generate Simple Transformation for XML in ABAP - Part II | © Passionate about SAP - A Blog.

I followed the tutorial and it works fine but I want that the field name of the data elements must be used as element name generated in xml and not the field name defined in the structure of the tabletype,

I have uploaded an image for clearification.

*** GENERATED CURRENTLY

    <TABLETYPE_RBKP>

      <tt:loop ref=".TABLETYPE_RBKP">

        <ZARCH_RBKP>

           <BELNR tt:value-ref="BELNR"/>

***** THE WAY I WANT IT TO BE GENERATED

    <TABLETYPE_RBKP>

      <tt:loop ref=".TABLETYPE_RBKP">

        <ZARCH_RBKP>

          <Doc.No. tt:value-ref="Doc.No."/>

any kind of help or suggestion is appericiated.

Thanks

Message was edited by: Thea Hillenbrand Hi, I deselected the category ABAP Trials and Developer Editions. This category should be used in the context of ABAP systems in the Cloud Appliance Library. Kind regards Thea

Hi Gurus,

I am converting a tabletype into xml simple structure and i am following this tutorial Generate Simple Transformation for XML in ABAP - Part II | &amp;#169; Passionate about SAP - A Blog.

I followed the tutorial and it works fine but I want that the field name of the data elements must be used as element name generated in xml and not the field name defined in the structure of the tabletype,

I have uploaded an image for clearification.

*** GENERATED CURRENTLY

    <TABLETYPE_RBKP>

      <tt:loop ref=".TABLETYPE_RBKP">

        <ZARCH_RBKP>

           <BELNR tt:value-ref="BELNR"/>

***** THE WAY I WANT IT TO BE GENERATED

    <TABLETYPE_RBKP>

      <tt:loop ref=".TABLETYPE_RBKP">

        <ZARCH_RBKP>

          <Doc.No. tt:value-ref="Doc.No."/>

any kind of help or suggestion is appericiated.

Thanks

Message was edited by: Thea Hillenbrand Hi, I deselected the category ABAP Trials and Developer Editions. This category should be used in the context of ABAP systems in the Cloud Appliance Library. Kind regards Thea

3 REPLIES 3
Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
858

You can change each element text manually after you generate Simple Transformation.

It can be done in both graphical or source code view of XSLT_TOOL.

In graphical view - doubleclick element in Simple Transformation (right side) and edit element text in edit field in upper right part of window.

In source code view - change this text from:

<BELNR tt:value-ref="BELNR"/>

to:

<Your_element_text tt:value-ref="BELNR"/>

But check XML Elements - naming rules and practices. Because <Doc.No.> is not good XML element name, and it cannot contain space (SAP data element short text can).

-- Tomas --
Read only

0 Likes
858

thanks for reply,

In your case i have to change every element manually.

Is there a possibiliy to do this automatically. for example using a program which changes it automatically.

The problem is: i am working with big data, and changing things manually is not a real solution.

Thanks in advance

Read only

0 Likes
858

I do not think there is any standard solution to do it automatically. Because:

- SAP short texts of elements can result in wrong XML element name

- some short texts can be empty

Maybe you can create program to generate Simple Transformation source code (as text). To copy&paste it to XSLT_TOOL after. But still it will need manual changes...

-- Tomas --