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 Simple Transformation

paisitp
Explorer
934

Hello expert. I need help about SAP simple transformation.

1. User need the XML file contains header like this:
    

<?xml version="1.0" encoding="utf-8"?><Document xmlns ="xxx" xmlns:xsi="http://www.abc.com/yyy">

    and this is what I coded in my transformation program

  <?sap.transform simple?>

  <tt:transform xmlns:tt="http://www.sap.com/transformation-templates"

                     xmlns:xsi="http://www.abc.com/yyy">

<tt:template>
        <Document>
           <tt:namespace name="xsi"/>

           <tt:attribute name="xlmns">xxx</tt:attribute>
         </Document>

   But what I got is 

               <?xml version="1.0" encoding="utf-8"?><Document xmlns:xsi=http://www.abc.com/yyy"  xmlns ="xxx" >

    The sequence is missed. How can I fix it?

2. When the ref value in each node has no value, it return in XML like <tag name />

    For example:

    Transformation program

          <Name>

            <tt:value ref="Nam"/>

         </Name>

          <NumTx>

            <tt:value ref="nuoftx"/>     <== This field is null
          </NumTx>

    Result in XML

          <Name>TEST NAME</Name><NumTx />

    I know this tag is readable in XML, but the XML file should always has opening tag with ending tag, ortherwise it should be removed.
   

    I use command  

         

<tt:cond check="not-initial(value ref.)">

    to exclude null value node, but I have more than 30 fields.

   Do I need to check them explicitly every field??

    Or any idea to force "opening tag" and "ending tag" if it's value is null?

Hello expert. I need help about SAP simple transformation.

1. User need the XML file contains header like this:
    

<?xml version="1.0" encoding="utf-8"?><Document xmlns ="xxx" xmlns:xsi="http://www.abc.com/yyy">

    and this is what I coded in my transformation program

  <?sap.transform simple?>

  <tt:transform xmlns:tt="http://www.sap.com/transformation-templates"

                     xmlns:xsi="http://www.abc.com/yyy">

<tt:template>
        <Document>
           <tt:namespace name="xsi"/>

           <tt:attribute name="xlmns">xxx</tt:attribute>
         </Document>

   But what I got is 

               <?xml version="1.0" encoding="utf-8"?><Document xmlns:xsi=http://www.abc.com/yyy"  xmlns ="xxx" >

    The sequence is missed. How can I fix it?

2. When the ref value in each node has no value, it return in XML like <tag name />

    For example:

    Transformation program

          <Name>

            <tt:value ref="Nam"/>

         </Name>

          <NumTx>

            <tt:value ref="nuoftx"/>     <== This field is null
          </NumTx>

    Result in XML

          <Name>TEST NAME</Name><NumTx />

    I know this tag is readable in XML, but the XML file should always has opening tag with ending tag, ortherwise it should be removed.
   

    I use command  

         

<tt:cond check="not-initial(value ref.)">

    to exclude null value node, but I have more than 30 fields.

   Do I need to check them explicitly every field??

    Or any idea to force "opening tag" and "ending tag" if it's value is null?

2 REPLIES 2
Read only

Former Member
0 Likes
608

I have the same issue as number 1 about the xml header. Did you find any solutions for this?

Read only

Former Member
608

Hello Paisit,

Try the following

  <?sap.transform simple?>

  <tt:transform xmlns:tt="http://www.sap.com/transformation-templates"

                     xmlns:xsi="http://www.abc.com/yyy">

<tt:template>
        <Document xmlns ="xxx">
           <tt:namespace name="xsi"/>
         </Document>

Best regards,