cancel
Showing results for 
Search instead for 
Did you mean: 

negative sign mapping handling for amount field

Former Member
0 Kudos

hi Experts,

From SAP ecc to PI we are receiving - negative sign after the amount value 1000 - . can you please suggest the suitable graphical mapping or UDF whenever amount value in -ve should give the ouput result as -1000. .

Regards,

Krushi.

Accepted Solutions (1)

Accepted Solutions (1)

former_member463616
Contributor
0 Kudos

Hi Krushi,

In your case let's try with below UDF:

for(int count=0;count<input.length;count++)

{

    if(input[count].endsWith("-"))

     {

    result.addvalue("-"+input[count].substring(0,input[count].length()-1));

     }

    else

        {

    result.addValue(input[count]);

        }

}

AMOUNT_PAID  --> UDF --> AmountPaid

Regards,

P.Rajesh

Answers (1)

Answers (1)

former_member184720
Active Contributor
0 Kudos

Hi Krushi - I don't see any complexity in it..

Use graphical function "endswith" to check if the amount has "-"

If yes then use replace function to replace "-" and then again conact it with "-"

amount                              then amount->replacevlaue "-"-> concat + "-",amount

          endswith          if

-                                        else amount

For graphical function look at the below blog-

Standard Functions in PI 7.0 - Process Integration - SCN Wiki

Former Member
0 Kudos

hi

the above mapping logic not giving the right result. plesae see below and it would be great if you re-look the logic.

Harish
Active Contributor
0 Kudos

Hi Krushi,

Please modify the logic as below

Amount -- ends with -- input to if

then replace in amout with blank -- concat with in the start

else pass as it is

please do not add the logic after if.

regards,

Harish

former_member184720
Active Contributor
0 Kudos

You are replacing and appending the "-" in both the cases (+ve or -ve)

As i suggested earlier, just do the replace and concat both in "THEN" case.. and map the if then else function directly to your target field..