cancel
Showing results for 
Search instead for 
Did you mean: 

testing sum of amounts in body by mapping

Former Member
0 Kudos

hi.

here in my scenario i have to sum all individual amounts in sender file and i have to compare with trailer sum.

for this i have created my sender mtype amount and i have checked with sum(statistical function) and i compared with trailer info.

its working with integers but when there are amounts with decimals then the sum is not showing correct value.

im my scenario the sum is supposed to be 40843.55 but the sum(statistic function) is showing like 40843.555.

can any body tell what changes i have to do for this.

waiting for u r well anser.

regards.

seeta ram.

Accepted Solutions (0)

Answers (4)

Answers (4)

prabhu_s2
Active Contributor
0 Kudos

seeta ram,

adding to the comments you can set the context of the sum field to correspodning parent node and using udf u can addup. lateron using comparssion node u wud be able to take this on

Former Member
0 Kudos

Hi thanks for your help.

bit i think it can be possible if we try the checking of sum of amounts with trailer infoby graphicalmapping using sum(statistic) function i tried it using this graphical mapping but iam getting problem with decimalvalues .

if the amount values are decimals then iam getting difference with sum(statistical) and trailer info.

waiting for u r response.

bye.

regards.

seeta ra,.

Former Member
0 Kudos

Looks like you have not yet checked the OSS note.

As per the OSS note, just change a parameter in Exchange profile and you will have your mapping working correctly

REfer my post above

regards

krishna

Former Member
0 Kudos

sorry krishna.

iam not having any means to raise oss note.

so can u tell me how to change profile briefly.

waiting for your response.

bye.

regards.

seeta ram.

Former Member
0 Kudos

Hi

Here is what you need to do

To perform the switch to BigDecimal instead of float you should go to ExchangeProfile edit page, look for property

com.sap.aii.mappingtool.flib3.bigdecimalarithmetic under the IntegrationBuilder node, and set it to true.

If the property does not exist yet, create it. Set the same property under the node IntegrationServer to true, or create it, if appropriate.

After the property is set, go to AIIProperties view page, and press Refresh button.

regards

krishna

Shabarish_Nair
Active Contributor
0 Kudos

https://websmp205.sap-ag.de/notes goto this link and put in the note number provided by krishna. There it will give you the description of wht is needed to be done to solve your problem. You dont have to raise a note. the note mentioned above has all the details to solve your issue. Ask your basis to help you in this regard.

Former Member
0 Kudos

Hi,

since i have given you what exactly you need to do by reading the note, you can simply follow the steps i have mentioned in my previous response.

regards

krishna

Former Member
0 Kudos

hi krishna.

sorry i cont find ExchangeProfile edit page, look for property

com.sap.aii.mappingtool.flib3.bigdecimalarithmetic under the IntegrationBuilder .

where we have to go for this eXCHANGE PROFILE.

waiting for your response.

bye.

Former Member
0 Kudos

sorri krishna.

i cont acess this one can u tell mein words please.

iam waiting for u.

bye.

seetaram.

Former Member
0 Kudos

Hi

http://<Message server>:<Port>/exchangeProfile/index.html

You can change the option only if you are on SP 18 in XI 3.0

regards

krishna

Former Member
0 Kudos

Here is the fix for you

The reason for the error is that arithmetic and statistic functions in Message-Mapping use Java's primitive type float to perform calculations, which can yield incorrect results because of the nature of binary floating point computations.

Starting from Support Package 18 of the component XI TOOLS 3.0 and Support Package 09 of the component XI TOOLS 7.0 there is a possibility to switch underlying calculations to class java.math.BigDecimal.

<b>To perform the switch to BigDecimal instead of float you should go to ExchangeProfile edit page, look for property

com.sap.aii.mappingtool.flib3.bigdecimalarithmetic under the IntegrationBuilder node, and set it to true.

If the property does not exist yet, create it. Set the same property under the node IntegrationServer to true, or create it, if appropriate.

After the property is set, go to AIIProperties view page, and press Refresh button.</b>

regards

krishna

Former Member
0 Kudos

thanku krishna.

i done all the things in admin by basis guys help.

now its working fine.

ur anser is amazing.

i tried a lot of things but doesnt work.

you and sdn helping sap a lot.

bye.

regards.

seeta ram.

Former Member
0 Kudos

Hi

check OSS note 958486

regards

krishna

former_member192892
Active Contributor
0 Kudos

I think you can use custom function mapping here...

Go about it like this...

Give all your input prices as arguments to a custom function..

Convert into type double by using

double value = Double.parseDouble(argument);

add up all the values and store in into another double varuable say sum

now declare String sumStr = sum.toString()

and return sumStr;

Shabarish_Nair
Active Contributor
0 Kudos

try;

public void chkAmountSum(String[] a,String[] b,ResultList result,Container container){

//write your code here

double tempAmt = 0;

double tempSum = 0;

double tempRes = 0;

double temp = 0;

double count = 0;

try{

for (int j = 0; j<a.length; j++)

{

temp =Double.parseDouble(a[j]);

tempAmt = tempAmt + temp ;

}

for (int j = 0; j<b.length; j++)

{

tempSum = Double.parseDouble(b[j]);

}

tempRes = tempAmt - tempSum;

if (tempRes != 0)

{

a[0] = "Not equal";

result.addValue(a[0]);

}

else

{

a[0] = "Is Equal";

result.addValue(a[0]);

}

}catch(NumberFormatException e)

{

a[0] = "Exception";

result.addValue(a[0]);

}}

Former Member
0 Kudos

helosir.

sorry i tried it but it is too complicated.

so cont we try using graphical mapping like amout->sum(statistical function) and then compare with trailer information idid like this its working but there is only problem when the detailed amounts r like 120.89,340.54 etc like this.

waiting for u r reply.

cheers.

seeta ram.

Former Member
0 Kudos

For that you need to do as per the OSS note i mentioned above

That is the definite fix for your issue

regards

krishna