Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Total Amount

Former Member
0 Likes
586

Hello experts ,

I have 2 variables : kbetr type CURR ( 2 decimals )

ekpo-menge type QUAN ( 3 decimals )

lv_kbetr type CURR ( 2 decimals ).

For example: kbetr = 3.000

ekpo-menge = 111.00

When i was to multiply like this : kbetr * ekpo-menge ( 3.000 * 111.00) the result that i get is

lv_kbetr = 333000.00 , and this is wrong.

How i should define the variable lv_kbetr such that the answer will be 333.00 ?

Thanks for the help,

AVI.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
519

lv_kbetr = 333000.00 / 1000 = 333.00

3 REPLIES 3
Read only

Former Member
0 Likes
520

lv_kbetr = 333000.00 / 1000 = 333.00

Read only

RaymondGiuseppi
Active Contributor
0 Likes
519

You cannot use an operation between two special fields like CURR or QUAN if they don't have the same Currency or Unit. You must first convert one of the factor into a number without dimension or into a field of the same currency of unit than the other one. (Look at documents like [Currency Fields |http://help.sap.com/abapdocu/en/ABENCURRENCY_FIELD.htm] for "Handling in ABAP Programs" and [Quantity Fields |http://help.sap.com/abapdocu/en/ABENQUANTITY_FIELD.htm] for "Handling in ABAP Programs ")

The Currency you use should be a price per unit, so convert the quantity in a number using the conversion between the unit of the quantity and the unit of the price per unit. Then you may multiply the price by the dimensionless number.

Here :

- MENGE = 111.00 quan field

- 1 UNIT = 1.00 quan field

- ratio = 111 floating, packed field or decimal floating numbers:(this must not be a QUAN field!)

- MULTIPLY Curr field by ratio should give the good result if the result field has the same currency that the original price field

Regards

Read only

Former Member
0 Likes
519

Hi,

In pricing procedure, you will need to divide such fields.

-Maharshi