How to create Java Mapping in SAP PI / PO
This blog will complement other blogs on ‘Java Mapping’ in SCN.
Direct link: How to create Java Mapping in SAP PI PO – YouTube
Sample Java Mapping used in the video: –
package com.map; import java.io.*; import com.sap.aii.mapping.api.*; public class Test_JavaMapping extends AbstractTransformation { @Override public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException { try { InputStream inputstream = transformationInput.getInputPayload().getInputStream(); OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream(); // Copy Input content to Output content byte[] b = new byte[inputstream.available()]; inputstream.read(b); outputstream.write("Prefixing this line to input. Test_JavaMapping. ".getBytes()); outputstream.write(b); } catch (Exception exception) { getTrace().addDebugMessage(exception.getMessage()); throw new StreamTransformationException(exception.toString()); } } }
Sample text file used in the video:-
Name,ID,Phone AAAA,11,123456789 世界,22,987654321 BBBB,33,777777777
Helpful links: –
NWDS Download Links – Java Development – SCN Wiki
SAP Support Portal S user id is required to download NWDS.
Not well-formed XML – & issue
JAVA Mapping – Managing Services in the Enterprise Services Repository – SAP Library
PI Mapping and Lookup API – SAP Javadocs
Trail: Java API for XML Processing (JAXP) (The Java Tutorials)
Dynamic file name for pass-through scenario – Process Integration – SCN Wiki
Multi-Mapping using Java Mapping – Process Integration – SCN Wiki
Reading Binary File Using ICO
Java Mapping in Exchange Infrastructure (download the mwv file).
New NetWeaver Information at SAP.com
Very Helpfull