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

Simple Transformation - complicated XML

former_member246634
Active Participant
0 Likes
816

Hi experts,

I am trying to deserialize XML from attachment using Simple Transformation and I've got many questions about it.

1. How should I handle the header:


<?xml version="1.0" encoding="utf-8"?>

<Documents xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Invoice.xsd">

<Document Version="1.0" Name="XML Invoice" Type="Invoice" DocumentReference="" ImageReference="" CertificateReference="">

It should be inserted just like that in ST (Simple Transformation) or should it be parsed to some structure?

2. What to do with fields having attributes instead of elements:


<Field Name="Waluta" Type="invoicecurrency">EUR</Field>

3. Should I create structures for all levels or can I skip header and "System" and "ProcessLog" from the end of file?

I'd be very grateful for every answer.

Hi experts,

I am trying to deserialize XML from attachment using Simple Transformation and I've got many questions about it.

1. How should I handle the header:


<?xml version="1.0" encoding="utf-8"?>

<Documents xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Invoice.xsd">

<Document Version="1.0" Name="XML Invoice" Type="Invoice" DocumentReference="" ImageReference="" CertificateReference="">

It should be inserted just like that in ST (Simple Transformation) or should it be parsed to some structure?

2. What to do with fields having attributes instead of elements:


<Field Name="Waluta" Type="invoicecurrency">EUR</Field>

3. Should I create structures for all levels or can I skip header and "System" and "ProcessLog" from the end of file?

I'd be very grateful for every answer.

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
762

Your structure should for which you are gonna create the Simple transformation should be at the "documents" level.

so it should be something:


ZDOCS (structure)

... ZDOC (structure)

... ... ZINVOICE  (structure)

... ... ... ZSUPPLIER  (structure) - with all fields

... ... ... ZBUYER (structure)

... ... ... ZFIELDS (table type)

... ... ... ... ZFIELD (structure) - with FLD_NAME and FLD_VALUE fields

... ... ... ZTABLES (table Type)

...

To map the field name and the value of the FIELDS, you need to refer to the attributes of the ZFIELD in the transformation. Something similar to this:


          <Fields>

            <tt:loop ref="FIELDS">

              <Field>

                <tt:attribute name="Name" value-ref="FLD_NAME" />

                <tt:value ref="FLD_VALUE" />

              </Field>

            </tt:loop>

          </Fields>

Regards,
Naimesh Patel

Read only

Former Member
0 Likes
762

Hi Bartlomiej,

Your structure can be like below.. You can handle the array table and variable fields separately.

See the screenshot below for table and individual fields. If this is similar to your requirement you can check the link below for more details.

Let’s Web Dynpro. Part ZZ | SAP Yard

Regards,

Raju