How to Edit Java Mapping Using NWDS

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,

  1. Find the Java Mapping which needs to be changed.

  2. Download the .jar or .zip files.

  3. Create new Java Project in NWDS

  4. Import .zip or .jar files to Java Project.

  5. Edit Java code.

  6. Export Java Project as .jar.

  7. 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
Java Mapping attached to Operation Mapping

 

Access Java Mappings under Imported Archives of SWCV
Access Java Mappings under Imported Archives of SWCV

 

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
Click export option to download the Imported Archive Java Mapping

 

Edit Post ‹ SAP Integration Hub — WordPress.html
Download Imported Archive Java Mapping as .Jar

 

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
Create new Java Project

 

Set a name of the new Java Project and assign other properties in NWDS
Set a name of the new Java Project

 

Import XPi library to your Java Project.

add library XPI to new Java Project
Add library XPI

 

add XPI library
Add XPI library

 

Java Project created using wizard in eclipse NWDS
Java Project created

 

Step 4: Import .zip or .jar file of Imported Archive to Java Project.

Import Archive File to Java Project in NWDS
Import Archive File to Java Project

 

Select the .Jar file to be imported to NWDS
Select the .Jar file

 

Select content of Archive file to be imported in NWDS
Select content of Archive file

Sample Java mapping simply copies the input payload to output.

Java Archive File imported to Java Project in NWDS
Java Archive File imported to Java Project

 

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
Edit Java Class

 

Step 6: Export Java Project as .Jar

Export edited Java Class as .jar
Export edited Java Class as .jar

 

Export edited Java Mapping as .jar
Select .jar as the export type

 

Select the Java Project content for export as .jar
Select the Java Project content for export

 

Step 7: Imported Edited .Jar File to Archives.

Re Import the Edited Archive
Re Import the Edited Archive

Save edited Imported Archive and activate it.

 

Step 8: Test the Java Mapping Changes.

Test Java Mapping in SAP PI
Test Java Mapping

 

If you have any questions on how to edit an existing Java Mapping program, please leave a comment below.

10 thoughts on “How to Edit Java Mapping Using NWDS

  1. Simha says:

    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

  2. Ahmet says:

    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?

  3. Samantha Jones says:

    Dear Isuru,

    where do I download the XPi Library?

    I can’t find it on the SAP marketplace

    Thanks and Regards

  4. Naveen says:

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *