on 07-16-2014 2:25 PM
Hi experts,
i need you expertise in number formatting. In mapping we need to format negative as per
ex: 123,45- need to be formatted as -00123,450 ( total length should be always 10 including - and , signs and after , 3 digits should be there
PI might receive positive numbers as wel, but only negative numbers have sign at the end.
I tried standard functions but couldn't see required output. Please help me on this
Regards,
Deep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Pass your input string to the below UDF. var1 should be your input string..
String var2,var3;
int a,b;
int c=0;
if(var1.endsWith("-"))
{
var1=var1.replace("-","");
var1="-"+var1;
c=1;
}
var2=var1.substring(0,var1.indexOf(","));
var3=var1.substring(var1.indexOf(","),var1.length());
a=var3.length();
b=var2.length();
while(a<4){
var3=var3+"0";
a++;
}
while(b<6){
var2="0"+var2;
b++;
}
if(c==1)
{
var2 = var2.replace("-","");
var2= "-"+var2;
}
return var2+ var3;
P.S.Have not tested it... Please check for the syntax errors if any..
http://scn.sap.com/docs/DOC-51816
you can deploy this conversion exit anywhere
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 achieve this using normal graphical mapping.
If amount endswith "-", then remove it first and use format number and concat "-" at last.
else normal format number
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.