Skip to Content
0
Former Member
Jun 09, 2009 at 09:53 AM

Same calculation producing two differing results

57 Views

Hi All

I have some code in a user exit on save of a delivery (VL02N) that calculates the number of bags/pallets required to furnish that delivery.

I am now adding the same code to a user exit on save a sales order (VA02) to calculate the number of bags/pallets again but when run it is producing differing results.

the code is as follows:

DATA: bag_weight(12) TYPE p DECIMALS 4.
DATA: pallet_weight TYPE marm-umrez.
DATA: bag_denominator TYPE i.

...

bag_weight = pallet_weight / bag_denominator.

Assuming pallet_weight = 1000 and bag_denominator = 40.

On save of a delivery it is calculating bag_weight as 25.0000 (correct):

On save of a sales order it is calculating bag_weight as 0.0025 (incoorect).

All data declaration, code etc is the same. Does anybody have any clue as to why it would give two differing answers, I would not like to have to add a additional multiplication step to correct the result otherwise.

Thanks in advance

David