cancel
Showing results for 
Search instead for 
Did you mean: 

Numbers with negative sign

Former Member
0 Kudos

Hi,

SAP send value to XI as 100.00-

In XI, I send this to standard subtract function where it expect this as -100.00

Which is the good way to move the negative sign to the left ?

Please do note there coould be situation where this value can come as positive so I have to take care of both situations.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Check with the below mapping


src--------------\
  Constant[-]-----| replaceString-----neg------
  Constant[]----/                             |
                                              |
                                             then
src---------------\endswith-------------->if         --------->tgt
Constant[-]-------/                          else  <---------src

Answers (3)

Answers (3)

Former Member
0 Kudos

hi,

[;

wll help u also try using Function Module CLOI_PUT_SIGN_IN_FRONT

Regards.

Sid

Former Member
0 Kudos

write a UDF

int indexNeg = str1.indexOf("-"); //str1 is input to UDF
if (i == -1)
	return str1;
else {
	str1 = str1.replace('-','');
	str1 = "-" + str1
        return str1;
}

prateek
Active Contributor
0 Kudos

Check if indexOf "-" is not -1. If it is -1, then it means that no - sign is present. If its present, you may replace it with blank "" and concat it in the front. This would also work for positive numbers.

Regards,

Prateek