If you are new to Java mapping in SAP PI/PO you will be wondering how to edit an existing Java mapping. If you haven’t done it before it could become a complex task. This article aims to provide a step-by-step guide on how to edit an existing Java mapping using Netweaver Developer Studio (NWDS). If you have never worked with NWDS read my previous post on how to configure NWDS for PI/PO developments.
Overview of steps to edit Java Mapping using NWDS,
-
Find the Java Mapping which needs to be changed.
-
Download the .jar or .zip files.
-
Create new Java Project in NWDS
-
Import .zip or .jar files to Java Project.
-
Edit Java code.
-
Export Java Project as .jar.
-
Re-import the .jar file to SAP PI.
Netweaver Developer Studio should be installed and configured for PI/PO development before you can follow these steps. If you have not installed it, then read my previous post on how to configure NWDS for PI/PO development.
SAP Versions used in the illustration:
- SAP PO 7.5
- NWDS 7.5 SP 11
Step 1: Identify Java Mapping (Imported Archive) to be Edited.
Find the Java Mapping you want to edit either by operation mapping or directly accessing Imported Archives under Software Component Version. In this example, we will edit the Imported Archive “Java_copyPayload” which contains the java class “copyPayload”.
![find Java Mapping attached to Operation Mapping](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-operation-mapping-sap-pi-po.png)
![Access Java Mappings under Imported Archives of SWCV](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-imported-archives-sap-pi-po.png)
As an example, I have created a simple Java Mapping named JAVA_copyPayload to copy input to output.
Step 2: Download Imported Archive as .Jar or .Zip file.
Download the Imported Archive as a .Jar file or .Zip file to local machine.
![Click export option to download the Imported Archive Java Mapping](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-download-jar-zip-file-imported-archive-sap-pi-po.png)
![Edit Post ‹ SAP Integration Hub — WordPress.html](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-save-jar-zip-file-imported-archive-sap-pi-po.png)
Step 3: Create New Java Project in NWDS.
Open NWDS and create a new Java Project. Assign a suitable name for your Java Project.
![Create new Java Project using NWDS menu path new, new Java Project](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-new-java-project-nwds-sap-pi-po.png)
![Set a name of the new Java Project and assign other properties in NWDS](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-new-java-project-wizard-nwds-sap-pi-po.png)
Import XPi library to your Java Project.
![add library XPI to new Java Project](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-new-java-project-add-library-nwds-sap-pi-po.png)
![add XPI library](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-new-java-project-add-xpi-library-nwds-sap-pi-po.png)
![Java Project created using wizard in eclipse NWDS](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-new-java-project-wizard-complete-nwds-sap-pi-po.png)
Step 4: Import .zip or .jar file of Imported Archive to Java Project.
![Import Archive File to Java Project in NWDS](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-import-jar-nwds-sap-pi-po.png)
![Select the .Jar file to be imported to NWDS](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-import-jar-select-arcive-file-nwds-sap-pi-po.png)
![Select content of Archive file to be imported in NWDS](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-import-jar-select-archive-file-nwds-wizard-sap-pi-po.png)
Sample Java mapping simply copies the input payload to output.
![Java Archive File imported to Java Project in NWDS](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-nwds-java-code-sap-pi-po.png)
Step 5: Edit java Code.
Every Java Mapping should implement the ‘transform’ method of extended ‘AbstractTransformation’ class. Java mapping in the example copies the input payload to the output. I have edited the mapping to copy new string to the output.
![Edit Java Class of the Imported Archive in NWDS](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-nwds-java-code-edited-sap-pi-po.png)
Step 6: Export Java Project as .Jar
![Export edited Java Class as .jar](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-export-edited-java-class-jar-sap-pi-po.png)
![Export edited Java Mapping as .jar](https://sapintegrationhub.com/wp-content/uploads/2018/06/edit-java-mapping-nwds-export-jar-file-sap-pi-po.png)
![Select the Java Project content for export as .jar](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-export-select-jar-file-nwds-sap-pi-po.png)
Step 7: Imported Edited .Jar File to Archives.
![Re Import the Edited Archive](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-imported-archive-re-import-sap-pi-po.png)
Save edited Imported Archive and activate it.
Step 8: Test the Java Mapping Changes.
![Test Java Mapping in SAP PI](https://sapintegrationhub.com/wp-content/uploads/2018/05/edit-java-mapping-test-operation-mapping-sap-pi-po.png)
If you have any questions on how to edit an existing Java Mapping program, please leave a comment below.
Excellent blog…
Please provide some more blog on complex topic of SAP PO.
Good blog
please post any stuff on AS2 scenarios inbound and outbound.
nice blog
please post any stuff on AS2 scenarios inbound and outbound.
Nice blog, could you please post how to write java mapping code in NWDS with one oe two exampales to help to get improve coding knowledge
Nice blog and very helpful.
I’ve a question. What I’ can do if the java file doesn’t exist in jar file?
I mean if there are only class files and xls files in it. Is there any possibility to edit the mappings if the java doesn’t added to the file?
Hello Ahmet,
Let me know which step you are referring to.
Cheers!
Isuru
Dear Isuru,
where do I download the XPi Library?
I can’t find it on the SAP marketplace
Thanks and Regards
Hello Samantha,
This should be included in the installation. No need to add it separately.
Cheers!
Isuru
Hello Isuru,
Thank You for all your blogs. I do follow them blindly to solve my problems.
In my recent configs, I want to update an existing java Mapping. Since we are now using Temurin inour client PCs, I installed Eclipse IDE on my system. However, while trying to add XPI libraries, I donot see this option at all. Can you helpme with this!
Regards,
Hi Fernadez,
I am working in sap process integration middleware. I should process emojis in sap pi 7.31 single stack using java mapping. I don’t know which emoji jar files will support java mapping in the sap process integration 7.31. So please could you suggest me which java jars required to achieve this functionality.
Thank you very much Isuru!! It has helped me a lot to be able to modify Java Mappings