cancel
Showing results for 
Search instead for 
Did you mean: 

Need help on java mapping

former_member191435
Contributor
0 Kudos

Hi,

I am new to java mapping. Please explain me how would I write java code in eclipse to create an import archive.

I searched many blogs but all are related to sap pi 7.0

Please explain me how would I use abstract transformation in java mapping. Please provide step bystep in java code how would I read a data from a input file and how would i create target structure.

Your help is highly appreciated.

Thanks,

Enivas

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

check this Beginners guide to Java mapping

http://wiki.sdn.sap.com/wiki/display/XI/BeginnersguidetoJavamappingusingDOMparserinSAPXI

Regards,

Aravind

former_member191435
Contributor
0 Kudos

Hi Aravind,

Thanks for ur reply.

I know how to use java mapping in Pi but I want to know for the given xml structure how we will do the java mapping in sap PI 7.1

Thanks,

Enivass

Former Member
0 Kudos

Hi Enivass,

In the java mapping to handle an xml file you normally use parsers like Dom or Sax parsers. Using which you can easily read an xml and do the needed mapping logic in java and create the target xml structure.

the wiki link which I had mentioned has the explanation for the Dom parser with a example xml structure. It even consists a example code for the Dom parser.

Some more links on Dom and Sax parser used in java mapping:

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

http://wiki.sdn.sap.com/wiki/display/XI/JavamappingwithDOMandSAXparsersinnewmappingAPI%28PI+7.1%29

Hope this helps.

Regards,

Aravind

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>>Please explain me how would I use abstract transformation in java mapping. Please provide step bystep in java code how would I read a data from a input file and how would i create target structure.

Please refer this link for SAP PI 7.1 java mapping ....

https://wiki.sdn.sap.com/wiki/display/XI/SampleJAVAMappingcodeusingPI7.1+API

For PI 7.0

http://wiki.sdn.sap.com/wiki/display/Snippets/Java%2bMapping%2b-%2bConvert%2bthe%2bInput%2bxml%2bto%...

main difference between pi7.0 and 7.1 is the method signature.

Pi 7.0 -


> public void execute(InputStream in, OutputStream out)

throws com.sap.aii.mapping.api.StreamTransformationException {

whereas PI 7.1

public void transform(TransformationInput arg0, TransformationOutput arg1) throws StreamTransformationException {

So, in your case follow the code snippet of pi 7.0 and make sure to use the transform method instead of execute in pi 7.0 code snippet and accordingly reference input and output argument parameters in the method implementation.

Hope this helps.

former_member191435
Contributor
0 Kudos

H Bhaskar,

Really thanx for ur reply. please explain me with example.

How would i write java code based on input structure. Please tell me is DOM parse or SAX Parser which one is bettter on which cases.

How would I test my java code in eclipse

Thanks,

Enivass

Edited by: enivas on Mar 12, 2011 3:14 PM

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Enivass,

First you should some good programming skills in JAVA , then only you can write JAVA mapping with good programming standards.

coming understaindg about SAX/DOM parser just simple search in Google will give plenty of examples.

My Advice take help from JAVA guy,,he will do it for you.

Regards,

Raj