cancel
Showing results for 
Search instead for 
Did you mean: 

calling an external written Java program into UDF.

0 Kudos

Hi All,

Steps involved in calling an external written Java program into UDF :

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.


I did all these steps successfully, but after I entered package name in import instructions(Step 8),  when I activate the mapping, I got the below error.


has syntax errors: Java Area import, Line 7: package firstpackage does not exist
import firstpackage.*;
^
1 error


Please help me in this regard.

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sathish,

Sorry about that, here is what we have in our system:

Imported archive:

Archives used

Import instructions:

PS: They are on the same SWCV but different namespacse.

Hope this helps,

Mark

0 Kudos

Hi Mark,

Thank you for the reply.

I tried with different namespace for Imported Archive and Message Mapping under same SWCV. But still getting same error.

Error :

Source text of object Message Mapping: MM_Test | urn:Test_test has syntax errors:
markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sathish,

Can you also post a screenshot of the imported Archive like I did in the thread?

Regards,

Mar

0 Kudos

Hi Mark

Please find the screenshot of Imported Archive

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sathish,

Thank you, can you also include the path in the Imported Archive screenshot?

Regards,

Mark

0 Kudos

Hi Mark,

Sorry I don't understand which path you are mentioning. I gave you the screen shot of Imported Archive with entire content and configurations in that window.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sathish,

The path is the other column in the display imported archive.

Regards,

Mark

0 Kudos

Hi Mark,

Sorry for that.

Path is empty.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sathish,

It does not look like the program you exported has a package or rather was created under the default package. Can you create a new package and place your class there and export it as a jar or zip file?

Regards,

Mark

0 Kudos

Hi Mark,

This is the package.

I created in notepad and compile in command prompt. Then the java file and class files are zipped and included in Imported Archived.

I tried this 3 times, but still getting the same error.

Note : I have tested this package by creating a main class program and importing that package. It executed successfully in command prompt.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sathish,

This would be easier if you would be using an IDE such as Eclipse. You can include the classpath in javac by using the -cp option see this link for more information

http://www.ntu.edu.sg/home/ehchua/programming/java/j9c_packageclasspath.html

Hope this helps,

Mark

Answers (1)

Answers (1)

deviprasad_pothireddy
Active Participant
0 Kudos

Hi all,

   use static method in the class and try, it worked for me like this


Thanks and Regards

Deviprasad.

http://pdpsappireference.blogspot.in/2015/10/facing-problem-while-importing-external.html