cancel
Showing results for 
Search instead for 
Did you mean: 

Scenarion on JAVA mapping

Former Member
0 Kudos

hi,

Can anybody suggest some basic scenarios to be developed using JAVA mapping. And why to opt for JAVA mapping in that paricular scenario?

Need urgent help

Thanks & Regards,

Loveena

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos
Former Member
0 Kudos

3.0 Pre-requisites for Java Mapping

For Java mapping there is no development tool support in XI. It is expected that they are developed using external development tools like Eclipse, Jdeveloper, etc. To make the mapping available for the integration server, they have to be imported into the integration repository as JAR files (JAR: Java Archives).

To be able to write a mapping program in your Java development environment, the Java runtime environment (JRE) of the SAP J2EE server must be consistent with the JRE version of your Java development environment. The developer should also be aware of the java APIs which are to be used within a mapping program. Since the program has to deal with an XML input, it should understand and parse the data within the XML InputStream so that it could manipulate it as per the requirement. Currently the most popular parser APIs available for manipulating the XML Documents are SAX and DOM.

The java APIs which are to be used within a mapping program are;

3.1 Mapping API

The runtime environment for Java mappings has a mapping API. To use Java mapping, you must define a Java class that implements the Java interface com.sap.aii.mapping.api.StreamTransformation. This interface is available in aii_map_api.jar. It has two methods:

...

● public void execute(java.io.InputStream in, java.io.OutputStream out)

At runtime, the Integration Engine calls this method to execute a mapping. This method contains an input stream for the source document and an output stream for the target document as parameters. These streams are usually XML documents.

● public void setParameter(java.util.Map param)

The Integration Engine transfers parameters to the mapping program with this method. It evaluates these parameters at runtime in the method execute(). This enables you to control the process flow of the mapping.

The transferred object that implements the Java interface java.util.Map contains seven key/value pairs as parameters. These correspond to corresponding fields in the message header. Apart from the MAPPING_TRACE constant, the value objects are of type java.lang.String. The key objects are defined in the class com.sap.aii.mapping.api.StreamTransformationConstants:

import java.io.*;

import org.xml.sax.*;

import javax.xml.parsers.SAXParserFactory;

import javax.xml.parsers.SAXParser;

public class JSAXMapping extends DefaultHandler

{

...

}

To setup the Parser, following steps are to be carried out.

DefaultHandler handler = this;

SAXParserFactory factory = SAXParserFactory.newInstance();

try {

out = new OutputStreamWriter (System.out, "UTF8");

SAXParser saxParser = factory.newSAXParser();

saxParser.parse(in, handler);

} catch (Throwable t) {

t.printStackTrace ();

}

These things have to be followed.

<b>Reward if useful</b>

Former Member
0 Kudos

Hi Loveena

refer these links

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

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

You can go thru these threads,

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom

/people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file

These weblogs would help you

/people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs

/people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio

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

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii

https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/1947. [original link is broken] [original link is broken] [original link is broken]

/people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping

/people/michal.krawczyk2/blog/2005/02/25/simple-java-code-in-graphical-mapping--xi

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/java%20proxies%...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d046c490-0201-0010-84b6-9df523cb...

A very important place where you will use JAVA in XI is while doing your Mapping. There will be cases when JAVA MAPPING is the best solution to go for. There are 2 types of Parsers available for JAVA Mapping. DOM Parser and SAX parser. Just got through the following links to understand more on Java Mapping and the APIs available.

http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/package-summary.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii

If you want you can also send java code as payload to do mapping in XI. For this go through the url:

/people/sap.user72/blog/2005/12/14/sending-java-code-as-payload-to-do-mapping-in-xi

JAVA mapping -


/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii

https://www.sdn.sap.com/irj/sdn/weblogs?

blog=/pub/wlg/1921

/people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping

sample code for java mapping

DOM PARSER API -


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

DOM ---

/people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs

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

SAX AND dom PARSER ( BY thorsten) -


example /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs java mapping example ( testing and debugging) /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio

Thanks !!