cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with a simple UDF

Former Member
0 Kudos

Dear SDN,

I wrote a very simple UDF which just return the value null during mapping.

public String test(String value,Container container){

return null;

}

but i don' know, why i get the follwing errors:

/usr/sap/PID/DVEBMGS20/j2ee/cluster/server0/./temp/classpath_resolver/Map90523a300c5e11dd8d06001a64a7b546/source/com/sap/xi/tf/_MM_WTADDI01_EtikettenAenderungsInfo_.java:130: illegal start of expression public String test$(String value,Container container){ ^ /usr/sap/PID/DVEBMGS20/j2ee/cluster/server0/./temp/classpath_resolver/Map90523a300c5e11dd8d06001a64a7b546/source/com/sap/xi/tf/_MM_WTADDI01_EtikettenAenderungsInfo_.java:139: ';' expected } ^ /usr/sap/PID/DVEBMGS20/j2ee/cluster/server0/./temp/classpath_resolver/Map90523a300c5e11dd8d06001a64a7b546/source/com/sap/xi/tf/_MM_WTADDI01_EtikettenAenderungsInfo_.java:140: '}' expected ^ 3 errors

Could u help me plz? Maye im blind and don't see a very Simple problem.

Thanks in advance.

Accepted Solutions (0)

Answers (16)

Answers (16)

Former Member
0 Kudos

I think also that there is a problem with java. But i don't know, what. If I try it with another UDF I get similar errors.

stefan_grube
Active Contributor
0 Kudos

The error is not inside the UDF, it happens before, in another UDF or in the Java sections of the mapping.

A ";" is missing at the end of any line.

Former Member
0 Kudos

Yes. But I didn't write anything else in Java. That means there is a Problem in the java code, before the execution of the methode execute. The Question is how can i fix the errors? Where should I look at for it?

stefan_grube
Active Contributor
0 Kudos

Do you have Java 1.4 or Java 1.5? Java 1.6 won't work.

Go inside the mapping, on the lower part and press ctrlshift0 (zero)

Export the message mapping, extract the xim file with inzip two times, check the Java code.

Post that code here.

Regards

Stefan

Former Member
0 Kudos

thank you Stefan. I think, I have it.

Former Member
0 Kudos

Hi

I put your code in a same UDF and it works. I think it is not the UDF wrong. It seems to be a general problem with java ,

test an other piece of code in a new UDF if it works...

nikhil_bose
Active Contributor
0 Kudos

try

public String test(String value,Container container){

return new String("");

}

nikhiL

Former Member
0 Kudos

@ shibani:

I tried it already with blanc. the same problem.

Former Member
0 Kudos

@ Parveen:

that was a good try. But unfortunately the problem is still there.

We have got XI installed a couple of days ago. Could it be a problem from the installation and configuration activities?

Thanks

Ehsan

former_member181985
Active Contributor
0 Kudos

Then its really strange.

Do one thing create new message mapping and withing that create a new UDF with the same functionality.

Thanks,

Praveen Gujjeti

Former Member
0 Kudos

Hi Eshan,

May be you are facing this problem because in ur code the return type is 'String'.

Where as your code returns a "null" which is considered as a literal in Java.

Refer this : "In Java(tm), "null" is not a keyword, but a special literal of the null type. It can be cast to any reference type, but not to any primitive type such as int or boolean. The null literal doesn't necessarily have value zero. And it is impossible to cast to the null type or declare a variable of this type."

So, you can jst replace null with a blank space (as " " )which will be considered as a string or you may adjust the return type accordingly.

Hope this helps you.

Regards,

Shibani

    • Reward with points if helpful**

Former Member
0 Kudos

@ Parveen: I did it more than 10 times. But still the same problem. Very Strange.

former_member181985
Active Contributor
0 Kudos

Close the repository framework. And reopen and test again.

There might be some internal communication problem between client framework and XI server.

Thanks,

Gujjeti

Former Member
0 Kudos

I Know, that i don't have to write the Head of the method twice. I just wrote return null in the body and nothing else, but i get the decribed errors.

Former Member
0 Kudos

but just write return null in my body. just RETURN NULL

former_member181985
Active Contributor
0 Kudos

Means you are not saving it properly. Reopen the UDF code in the mapping editor and check again.

Former Member
0 Kudos

yes. exactly.

Former Member
0 Kudos

Hi Ehsan

I found u problem

U r getting this error because u r aagin wriiitng you method again

-


public String test(String a,Container container){

-


public String test(String a,Container container){

return null;

}

-


}

See when I write this I am also getting this error/also check ur barackets.

Source code has syntax error: /usr/sap/XS1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapb75c82f00c6011dd9b0c00145ec5a6a0/source/com/sap/xi/tf/_MM_Orders05_To_File_.java:2283: illegal start of expression public String test(String a,Container container){ ^ /usr/sap/XS1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapb75c82f00c6011dd9b0c00145ec5a6a0/source/com/sap/xi/tf/_MM_Orders05_To_File_.java:2286: ';' expected } ^ 2 errors

In case u write----


public String test(String a,Container container){

-


return null;

-


}

It will not prompt u any error.

Thanks

Abhishek

********please reward points if helpful*****

Former Member
0 Kudos

But the braces are created by PI. I can just modify the body of the Method and not the the Head,

former_member181985
Active Contributor
0 Kudos

Hi,

You mean you added only return null; statement and still you are getting the error.

thanks

gujjeti

stefan_grube
Active Contributor
0 Kudos

Do you have another UDF? Check the other one.

Former Member
0 Kudos

Yes I did. but i get the same errors.

former_member181985
Active Contributor
0 Kudos

Hi

Remove braces as those are implicit.

Also this one public String test(String value,Container container)

only there should be return null;

thanks,

Gujjeti

Edited by: Praveen Gujjeti on Apr 17, 2008 11:34 AM

Former Member
0 Kudos

Hi,

Well there is nothing seems to be wrong in your code...

Instead of Null have you tried with "", or anyother values...is it your code working fine...

Thanks

Swarup

stefan_grube
Active Contributor
0 Kudos

It is a bracket { } too much or too less.