on 05-10-2010 9:47 AM
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.
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.
Solved Myself
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Solved Myself
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For your first requirement, try this:
String text = line.substring(line.lastIndexOf('/') + 1);
retrun text.
Regards,
ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> 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.
>
use a UDF.
psedo code is
len = complete length of string
a = last index of ("/")
subString(a+1, len);
> 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.
>
You will need a UDF here
> 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.
http://wiki.sdn.sap.com/wiki/display/XI/CountofRecords-%27Countontheeasiestway+through%27
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sir,
Thank you so much for your quick reply but I am new to UDF and don't know much about it.
One of the guy from sdn wrote a code but when I tried that code, I am getting error
Code
Execution type: Single values.
Under Signature variable:
Argument var1 string
String str = var1.toString();
String a[] = str.split("/");
int len = a.length;
return a(len-1);
Error
com/sap/xi/tf/_mm_xx_to_xx_xx_.java1972 cannot find symbol symbol : method a(int) location: class com.sap.xi.tf._mm_xx_to_xx_xx_ return a(len-1);
^
Note: /usr/sap/DGX/DVEBMGS66/j2ee/cluster/server0/./temp/classpath_resolver/Map78bd50805c0c11df942c7a3a33adcd0c/source/com/sap/xi/tf/_mm_xx_to_xx_.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error
Please reply me urgently and if possible could you also write a code for me for the 2nd one as well.
Thanks
Try this code for your second problem:
Make the UDF Cache selected to "Queue"
int textLen = input.length();
if (textLen > 35) {
int si = 0;
int ei = 35;
while (si < textLen) {
if (ei > textLen) ei = textLen;
result.addValue(input.substring(si, ei));
si = ei;
ei = ei + maxSize;
}
}
else {
result.addValue(input);
}
}
Regards,
Ravi
Hi Ravi,
Thank you for your reply and code but unfortunately it is not working could you please check whether or not I am doing something wrong.
Name:Splitlength
Title:Splitlength
Category: All Values of Queue
Signature Variables: Argument: input : String
Result: result : ResultList
public void Splitlength(String[] input, ResultList result, Container container) throws StreamTransformationException
{
int textLen = input.length();
if (textLen > 35)
{
int si = 0;
int ei = 35;
while (si < textLen)
{
if (ei > textLen) ei = textLen;
result.addValue(input.substring(si, ei));
si = ei;
ei = ei + maxSize;
}
}
else
{
result.addValue(input);
}
Errors
Source text of object Message Mapping: mm_xx
java[2710] cannot find symbol symbol : method length() location: class java.lang.String[] int textLen = input.length(); ^
java[2717] cannot find symbol symbol : method substring(int,int) location: class java.lang.String[] result.addValue(input.substring(si, ei)); ^
java[2719] cannot find symbol symbol : variable maxSize location: class ei = ei + maxSize; ^
java[2719] operator + cannot be applied to int,maxSize ei = ei + maxSize; ^
java[2719] incompatible types found : <nulltype> required: int ei = ei + maxSize; ^ Note:
java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 5 errors
Please solve this problem ASAP if possible.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.