cancel
Showing results for 
Search instead for 
Did you mean: 

Importing java code in UDF of XI

Former Member
0 Kudos

Can anyone tell me how we can import a .class file written in NDS into the import parameters of User Defined Functions in XI ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

for importing if your class name is Abc

in the package com.company then type

import com.company.Abc;

While importing in the Imported Archives make sure the jar created by you has the .project and .classpath files also in it..

Reward if useful.

Edited by: Fariha Kazi on Mar 4, 2008 11:23 AM

Answers (2)

Answers (2)

Former Member
0 Kudos

Prashanth,

First ensure that ur .class file is getting compiled and executed fine.

Check if there r any syntax errors in the file.

Then add it to a .zip file.

Import it to ur imported archives in IR.

After that call it from ur UDF using ur package and the class name.

Eg: Packagename.classname;

justin_santhanam
Active Contributor
0 Kudos

Prashant,

First of all you need to zip the class file and import it into Imported Archives. Now in the UDF you can call it. If it has class name say MyownClass

then in UDF import section give it as MyownClass

raj.

agasthuri_doss
Active Contributor
0 Kudos

Hi,

Adding to Raj Post,

ZIP all the Files including Class files.

Regards

Agasthuri Doss

Former Member
0 Kudos

Hi guys,

i created a zip file of all the files alon with the class file...

imported it in Imported Archive ...

the file name is "writesplit.zip".

In the UDF i imported it as writesplit; and am getting the following error.

Source code has syntax error: D:/usr/sap/PI7/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map7b55e690e96811dca799000e7f303916/source/com/sap/xi/tf/_MM_CannonicalToWRITE6Split_.java:3: '.' expected import com.sap.aii.mappingtool.tf3.;import com.sap.aii.mappingtool.tf3.rt.;import java.util.;import java.io.; import java.lang.reflect.;import writesplit;import java.io.; ^ 1 error

justin_santhanam
Active Contributor
0 Kudos

Prashant,

What is the name of your class file? I asked u to give the class file name in import section, not the Imported archives name.

To make it more clear, let say you create java program whose name is MyFirstClass.java , after you compiled it you might have got MyFirstClass.class file.

Now zip the MyFirstClass.class file and name it as your wish, let say StringSplit.zip. Import into ImportedArchives.

Now in the UDF you need to give. - MyFirstClass that's it.

Not import MyFirstClass

raj.

prateek
Active Contributor
0 Kudos

In addition, make sure that u r using package.classname for the import purpose and not only the classname.

Then u can access the method as classname.methodName

Regards,

Prateek

Former Member
0 Kudos

Hi,

I am getting below error,

D:/usr/sap/PI7/DVEBMGS03/j2ee/cluster/server0/./temp/classpath_resolver/Map1a6bf613eeb011dc9b6200137254e21e/source/com/sap/xi/tf/_MM_RFCLookUP_Material_.java:3: '.' expected

import com.sap.aii.mappingtool.tf3.;import com.sap.aii.mappingtool.tf3.rt.;import java.util.;import java.io.; import java.lang.reflect.*;import LookupHandler;

even after uploading corresponding class file.

Any inputs?

Thanks,

Vijay Kuma T.

agasthuri_doss
Active Contributor
0 Kudos

Hi,

Check Whether > import java.util.;import java.io.; import java.lang.reflect.*;import LookupHandler;

are imported

Regards

Agasthuri Doss

ravi_raman2
Active Contributor
0 Kudos

Vijay,

You should NOT import class files, Class files should be part of a Jar that should be in the XI classpath..thats where it loads it from,

Find out what Jar that import is from and add that jar to your classpath.

Regards

Ravi Raman

Former Member
0 Kudos

How can we check this?

Thanks,

Vijay Kumar T.

Former Member
0 Kudos

Hi,

How did you resolve this issue? Please provide inputs as i am facing similar problem.

Thanks,

Vijay Kumar T