cancel
Showing results for 
Search instead for 
Did you mean: 

Negitive value format

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

First replace "-" with blank and then give neg function to the output.

Hope this might help...

Regards,

Xier.

Former Member
0 Kudos

Hi XIer,

Can you please give me more detail.

which function to use replace "-" with blank.

Kind Regards,

Kiran

iprieto
Contributor
0 Kudos

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

Answers (3)

Answers (3)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

iprieto
Contributor
0 Kudos

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á