cancel
Showing results for 
Search instead for 
Did you mean: 

XML Message to multiple IDocs using java mapping program

Former Member
0 Kudos

Hello,

I am receiving data in an XML file, where are several records, and i want each such record to produce a singe IDoc.

I know it can be done using graphical mapping, but i need to use a java program to convert the data. Is there a way to do this?

Thanks in advance,

Gershon.

Example:


Source

<file>
  <record>
    Some data 1
  </record>
  <record>
    Some data 2
  </record>
</file>
        ||
   Java mapping program
        ||
        \/
Target

<idoc>
  Some data 1
</idoc>

And

<idoc>
  Some data 2
</idoc>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks, but i know that.

What i want to know is, what the output XML has to be, to create multiple idocs from a single message?

Regards,

Gershon

Edited by: Gershon Osmolovski on Dec 9, 2009 8:00 AM

Former Member
0 Kudos

Hi,

Using java mapping you have to create the IDOC node based on the Record node occurrence.

Shabarish_Nair
Active Contributor

Answers (3)

Answers (3)

Former Member
0 Kudos

It works with the graphical mapping, but when i try to use java, i recieve an error message in the queue saying

*Comparison error during execution of a simple *.

I found no info on this message, and i cannot even see the whole message.

Regards,

Gershon.

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi,

Yu can genarate multiple message for one single message,but it depends on how you are going to write logic in JAVA Mapping.

I had done different requirement genarating multiple message for one CIDX message.

check you logic once again and debug in NWDS.it will defineltly works,no need to add split merge name space also...

Regards,

Raj

Former Member
0 Kudos

It worked!

The problem was that i set the target message cardinality in the operation mapping to 0..unbounded.

When i set the the carinality to 1, everything worked, and i recieved multiple IDocs in the target system.

Thanks to everyone for the help.

Best regards,

Gershon

Former Member
0 Kudos

Thanks, can you expain some more please?

Regards,

Gershon.

Shabarish_Nair
Active Contributor
0 Kudos

you can easily use a SAX parser to parse the input xml and create your target XML IDoc

http://wiki.sdn.sap.com/wiki/display/Snippets/FILEtoIDOCusingJava+Mapping

http://wiki.sdn.sap.com/wiki/display/XI/JavaMappingConcepts%28DOMand+SAX%29