Implementing a Java Mapping in SAP PI
Introduction
This blog explain you how to develop a java mapping class for using it in your Interface Mapping in SAP PI. It’s a tutorial for beginers.
Implements a Java class for mapping purpose require the next steps:
1.- Development Tool like SAP Netweaver Developer Studio, NetBeans, Eclipse ….
2.- Import aii_map_api.jar library.
3.- Write the Source code for the mapping program. (We need to know DOM or SAX parsing proccesing)
4.- Generate .jar file with the compiled class.
5.- Import Jar File in SAP PI.
6.- Use the program mapping in Interface Mapping.
1.- Open a Development Tool.
Firstly, we are going to open the SAP Netweaver Developer Studio for create a new project.
2.- Next, we must to import the aii_map_api.jar library. The file aii_map_api.jar is located in j2ee\cluster\server0\apps\sap.com\com.sap.xi.services directory.
3.- Write Java Source.
package com.xi.test;
import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; import com.sap.aii.mapping.api.AbstractTrace; public class NameMerge implements StreamTransformation { private Map param = null; public void setParameter(Map param) { public void execute(InputStream input, OutputStream output) AbstractTrace trace = null; trace = try { //Parse input to create document tree //Map the elements for (int item = 0; item < children.getLength(); item++) { } trace.addInfo(RESULT); } catch (Exception e) { //Return the output document try { } } |
4.- Generate JAR file.
Go to File->Export in SAP Netweaver Developer Studio a choose the project where you have developed the mapping program and you must export it to a file.
5.- Import JAR File.
Go to Integration Repository, Mapping Object -> Imported Archives. You must to create a new Imported Archives and import the file that you had generated in SAP NDS.
6.- Use the program mapping in Interface Mapping
Finally, you have to use the java class in an Interface Mapping.
The XML used for creating the java test class are:
Ivan |
ivan prieto
|
New NetWeaver Information at SAP.com
Very Helpfull