cancel
Showing results for 
Search instead for 
Did you mean: 

Add XML Tag to XML File (Idoc to XML File)

Former Member
0 Kudos

Hi there.

Just a question regarding the addition of a tag header in an XML file please?

Idoc - > XI -> file (XML File)

We have a need to add something like this below in bold to XML Tag Header in the inbound file:

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

<?POSTEN SND="SE03220037090" SNDKVAL="1" REC="SE03220669500"

MSGTYPE="ORDERS"?>

Any ideas on how this can be managed would be apreciated please?

Thank you.

Mick.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Michael,

With some knowledge of java you can create an adapter module and change whatever you want in xml file! You can for example insert new information in header!

In addition, inside adapter module you can log and monitor what happens!

If you need any help contact me I can send you an example! It's very easy !!!

Regards!

Former Member
0 Kudos

Hi Michael,

You can go for User defined funcion in mapping and read the XML document and provide the value to be entered in that.

Thanks,

Tiny

Former Member
0 Kudos

Hi Carlos.

Thanks for your reply. I like what you are suggesting, however, I have no knowledge of Java and how to implement this Java addition to the mapping interface.

I would appreciate any hints you may have. The value that I am trying to add to the tag header is exactly as it is below(the value in bold) and it can in fact be fixed, i.e. I am not looking to dynamically determine the values in the additional tag but just add the value as it is below...

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

<?POSTEN SND="SE03220037090" SNDKVAL="1" REC="SE03220669500"

MSGTYPE="ORDERS"?>

I would appreciate any input from you on that.

Thanks in advance Carlos.

Mick.

stefan_grube
Active Contributor
0 Kudos

Use following XSLT mapping. If you have already a maping, put that XSLT in a sequence mapping as second mapping step.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" /> 


  <xsl:template match="/">
 <!--  add processing instruction --> 
  <xsl:processing-instruction
name="POSTEN">SND="SE03220037090" SNDKVAL="1" REC="SE03220669500" MSGTYPE="ORDERS"</xsl:processing-instruction> 
 <!--  copy payload --> 
  <xsl:copy-of select="." /> 
  </xsl:template>
  </xsl:stylesheet>

Regards

Stefan

Answers (5)

Answers (5)

Former Member
0 Kudos

....Just wonderring would it be a big deal / change on the XSLT if I was required to pass say the IDoc number of file into the REC field of the Tag Header or have XI pass a unique ID into this field if it were required?

(The term "Give an inch...take a mile" comes to mind when I am asking this so do not worry if this is not an easy question to answer, then leave it..)

Thanks again for the original solution...

Former Member
0 Kudos

Hi MIchel,

I had a similar issue.

Please help how you solved this one.

Thanks

Srinivas

Former Member
0 Kudos

Thanks Stefan / Carlos.

Solution works like a dream.

Lifesavers!!!

Former Member
0 Kudos

Hey Michael,

As you can see, XI provide many ways to solve the same problem !!!

I don't know if you already solved the problem but Stefan posted a perfect solution for you!

Just upload the xslt mapping file and add a new mapping step in your message mapping!

Quick and easy !!!!

Regards!

stefan_grube
Active Contributor
0 Kudos

Within PI there is no support for so-called Processing instructions in XML.

You have to add them with help of a Java/ABAP mapping or XSLT mapping.

udo_martens
Active Contributor
0 Kudos

Hi Mick,

XML has no format..

You could create a html with tag &lt;b&gt; for bold.

Regards,

Udo

Edited by: Udo Martens on Feb 5, 2009 2:35 PM