cancel
Showing results for 
Search instead for 
Did you mean: 

file to idoc using java

Former Member
0 Kudos

Hi i have a file to idoc scenarion in XI and i am new to java mapping. i am getting the source file using content conversion with a structure like

material

plant

value1

value2

i cannot use graphical mapping as i need to generate a nested structure.

if i want to use java then do i need to give the exact xml structure as my file and idoc has in my java code as the source and target.

how would the code identify the surce and target xml tags

regards

sorabh

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi sorabh,

If you want to achieve a specific nested structure thru java mapping, you need not write a code wich identifies the position of the tags, instead you should code in such a way that the target structure is created based on the name of the tag and the value for that tag.

You can use DOM/SAX-based parsing if you are comfortable with it.

Also, if the IDoc is not having a very complicated nested structure and if you dont have to map many fileds/segments, i suggest you make optimum use of the functions provided in graphical mapping.

Regards,

Sushumna

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

For a tutorial on the methods of SAX and DOM http://java.sun.com/webservices/docs/1.1/tutorial/doc/

Regards,

Bhavesh

Former Member
0 Kudos

Hi,

Some more info in these threads:

Regards

Vijaya

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Sorabh,

<i>if i want to use java then do i need to give the exact xml structure as my file and idoc has in my java code as the source and target.</i>

You do not have to create the Input ( File ) structure as , you will receive the Input strucuture in XML format as as InputStream.

You will have to create the corresponding Output XML strucutre in your Code for JAVA MAPPING.

Also, JAVA mapping uses 2 types of parsing SAX and DOM. SAX parser is not processor intensive , but is difficult to implement. while DOM is processor intensive as the entire XML is loaded into the memory, but it is comparitively easier.

Java Mapping

http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm

DOM parser API

http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html

Regards,

Bhavesh