Skip to Content
Author's profile photo Former Member

PI.DOC – How to call an external written Java Program into SAP PI UDF.

Landscape / System Details:

SAP PI Version: SAP Netweaver 7.11    & Dual Stack

Focused Area : Message Mapping and UDF

Target Audiance : SAP PI Consultant.                

Document Objective:

In this Document, I am going to explain the steps to call an Externally written Java Program into SAP PI UDF.

From externally written i mean say a Java Class writen in NetBeans , Eclipse.

         

Say If you have a requirement, where we want to use externaly written Java code inside SAP PI – UDF to full fill some requirement in message mapping.

    

This can be useful where you have somecode written in external Java Program , and there is a need of calling same program in Java UDF  then in that case you dont have to write the Code again in UDF. You can simple import the same old code in UDF.

    

Steps are following :-

    

Step 1: Save .java and .class file into folder according to package name assigned in JAVA Program.

Step 2: Covert it into compressed zipped folder.

Step 3: Create imported archives Object in SAP PI.

Step 4: Import zip file with import archive option.

Step 5: Now go to message mapping, open Functions tab.

Step 6: Now on down left hand side, you will find archives Used, open this tab.

Step 7: Add the above created imported archive into this.

Step 8: And in import instructions add the package name, you have given in above used JAVA program.

Step 9. Now enjoy using the classes and method of Java Program in your scenario (Message Mapping) through UDF.

    

    

Please find the Example Below for reference :-

    

Step 1: a.java and a.class are the two files under Prabhat\test\   package.

Capture 1.JPG

    

Step 2: So Package name  = prabhat.test 

            It has one class = a 

            Class has one method = methoda

Capture 2.JPG

    

Step 3: Compress those file into compressed zipped folder.

Capture 3.JPG

    

Step 4: Import zip file into SAP PI with import archive option.

Capture 4.JPG

    

Step 5: Now go to message mapping, open Functions tab..

    

Step 6: Now on down left hand side, you will find archives Used, open this tab.

    

Step 7: Add the above created imported archive into this.

    

Capture 5.JPG

    

Step 8:  And in import instructions add the package name, you have given in above added Java program.

Capture 6.JPG

         

Step 9: Now you have leverage to use the classes and method of added Java Program in your scenario (Message Mapping).

Capture 7.JPG

    

Step 10: See below Screenshot, Here Nokia660 is returned by Java PROGRAM.

Capture 8.jpg

    

Hope above doc would be productive to some one.

    

Thanks and Regards

Prabhat Sharma

    

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sathish S
      Sathish S

      Hi Prabhat Sharma,

      I tried - calling an external written Java Program into SAP PI UDF the same way you have mentioned. All are working fine, except that last step(Step 8). After adding the package name in IMPORT INSTRUCTIONS, when i save & activate, I am getting below error:

      has syntax errors:

      I don't know where I went wrong. Please help me.