on 05-09-2010 8:48 AM
Hi SAP Guru's
Can somebody please tell me how to write UDF in SAP PI 7.11 because I am new to PI and struggling in regards to UDF
I want to write the UDF which counts from right hand side and display the output if find any "/" symbol
Example
"........./MARK" or "........xyz/TESTING"
I want to extract the data MARK or TESTING so can somebody please write a code or alteast tell me how to write it in 7.11
and I am also looking for counter UDF , if anyone already wrote a code before then please forward it to me.
Thanks,
Iqbal
Hi,
Ucan try this:
Execution type: Single values.
Under Signature variable:
Argument var1 string
Code:
String str = var1.toString();
String a[] = str.split("/");
int len = a.length;
return a[len-1];
(len-1 is under brackets).
UDF IN PI7.1:
/people/william.li/blog/2008/01/02/sap-pi-71-mapping-enhancements-series-share-user-defined-functions
How to write UDF:
You can find so many useful links on SDN.
/people/rohit.kalugade/blog/2009/02/09/context-and-queue-in-message-mapping-udf-150-part2
http://wiki.sdn.sap.com/wiki/display/XI/UDFExecutionType-ContextandQueue.
Thanks
Amit
Edited by: AmitSri on May 9, 2010 12:51 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
Thank you for your reply but the code is not working and I am getting this error
Please reply me back urgently
com/sap/xi/tf/_mm_payext2002_to_iso20022_CustomerCreditTransferInitiationCiti_.java[1972] cannot find symbol symbol : method a(int) location: class com.sap.xi.tf._mm_payext2002_to_iso20022_CustomerCreditTransferInitiationCiti_ return a(len-1);
^
Note: /usr/sap/DGX/DVEBMGS66/j2ee/cluster/server0/./temp/classpath_resolver/Map78bd50805c0c11df942c7a3a33adcd0c/source/com/sap/xi/tf/_mm_payext2002_to_iso20022_CustomerCreditTransferInitiationCiti_.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error
I believe we need to define return as well please check below is the code which I wrote on 7.11
String str = var1.toString();
String a[] = str.split("/");
int len = a.length;
return a(len-1);
Can somebody please write 3 UDF's for me.
1. From right hand side of the field E1IDKU3-INSTEXT1, all characters upto reaching of special character "/". This is because the field may appear like "/ /MAIL" or simply "/ /". In the first case it is expected to take data MAIL and in second case blank.
Amit you resolved my issue, Full Marks to you for this one.
2. E1EDKA1-STRAS & STRS2, E1EDKA1-ORT01, PSTLZ (Qualifier : AG) . Split the full data into three lines of 35 characters each
not sure whether I need to write UDF or Splitbyvalue will work for this.
3. Count the total number of Idocs that are going to be included into the file as one idoc represents one payment instruction
not sure whether I need to write UDF or count function of Arithmetic will work.
Can somebody please reply me urgently.
Ucan also try this:
Execution type: Single values.
Under Signature variable:
Argument var1 string
Code:
String s = var1
return (s.substring(s.lastIndexOf("/")+1));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi guys.
Last month i had a tour to Uk and i got my checkin from http://www.checkmein.eu/, Its service is really good.
Earlier i faced many problems like standing for long time in queues and not getting my preferd seat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
make use of the java split string function.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#split(java.lang.String)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
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.