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.

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

 

Add 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

 

Select Archive File as the export type to save edited java mapping
Select Archive File 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.

One Comment

Add a Comment

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