on 09-03-2009 1:18 PM
HI, in PI7.1 message mapping , I create 2 UDF, myfuntion1, myfunction2.
I want to call myfunction2 from myfunction1.
myfunction1 () {
myfunction2();
}
or
myfunction1() {
Local.myfunction2();
}
All of above compile failed with syntax error, ??? any help
HI.
You can try this.
Generated your function in .jar and import your jar in the section Mapping -importedArchives and after that you can you in your UDF
use reference like
Seccion import test1.Functions;
return Functions.returnVal(value);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks, but cann't we call one UDF directlly from one UDF as mentioned in
http://help.sap.com/saphelp_nwpi711/helpdata/en/43/991c1f7ee225b3e10000000a1553f7/content.htm
Hi,
You can follow luis options if you use xi or pi 7.0. But if you use 7.1 then you can put your udf in a shared folder and then you can access from any mapping. Please check this bills blog on this:
/people/william.li/blog/2008/01/02/sap-pi-71-mapping-enhancements-series-share-user-defined-functions
Regards,
---Satish
thank you Luis and all.
I did a silly mistake, I missed to pass the container parameter to funtion2.
NOTICE, it does not need a "$" end of the function name.
The following code work now.
UDF1:
function1(para1, container) {
function2(para2, para3, container);
}
UDF2:
function2(para2, para3, container) {
}
Hi shiwudao,
You do not have any problem to call a UDF from other UDF. I think when are calling the second UDF you are not passing the correct parameters. Pls, see which parameter are required in the second UDF, then go to first UDF and call it correclty. Take care about UDF`s scope, you are not able to call a "context" UDF" from a "value" UDF.
Regards
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Here is the solution:
1. You make sure that the second UDF is being used in the mapping('cause, PI message mapping generator, only compile the used functions).
2. Add to your function the prefix "$".
public string udf1(String value, Container container){
return udf2$(value,container);
}
public string udf2(String value, Container container){
return "Hi:"+value;
}
Regards
Ivan
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.