on 01-22-2008 10:37 AM
Hi all,
I am getting from SAP side the negitive value like this "164.00-", i need to translate to
"-164.00".
Can any one tell me how can we achive this?
Kind Regards,
Kiran
Hi,
First replace "-" with blank and then give neg function to the output.
Hope this might help...
Regards,
Xier.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this class:
public class StringTransformation extends SimplePolicyTest {
public static String transform(String a)
{
String b = null;
if(a.indexOf('-')!=0)
b = new String ('-' + a.substring(0, a.indexOf('-') ));
return b;
}
public static void main (String args[]){
System.out.println("Result : " + transform("192-"));
}
}
Best regards,
Iván
Edited by: Carlos Ivan Prieto Rubio on Jan 22, 2008 12:26 PM
Hi Kiran,
you can acheive this with graphical mapping....
Check your source field by using the function endWith this function having the two inputs, one is u r source field, second one is Constant with the value of -. By using If with else in true part use replacestring function and replace - with space( ).Then your source value would be like 164.00 and mulitply with -1. Else map with Source field dircetly.You will get the value like -164.00.
If you didn't get this logic give u r mail id i will send you a screnn shot of mapping
Hope it will solve u r problem and let me know u r proceedings
Cheers
Veera
"If it is needful, reward with points.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Long back I also had the similar problem.
I had resolved it as below,
If the negative value is comming from SAP then you know the exact output length of the field. For e.g If its amount field from SAP with Output length of 12 then the value 164.00- will be added with blank spaces as prefix.
so the value in XI will be always " 164.00-"
No use the APIs to convert it to -164.00 as follow,
field amount >substr(11-12) i.e. last cell-> equals to "-" -(true)> then pass amount -->substr(0 -11) --->Neg(Arithmatice API) --> FormatNumber(##.00) --> target field.
If the
field amount >substr(11-12) i.e. last cell-> equals to "-" -(false)> then pass the value as it is to target field
Thanks
Swarup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can create a User Defined Function in mapping editor and create a java function for translate this value as you like.
Regards Ivá
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.