cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Division of Currency field with Quantity in User Exit?

0 Kudos
1,410

Hi ,

In the User Exits i have to perform division but the value to not populating correct.

DATA : LV_RESULT TYPE P DECIMAL 2.

LV_RESULT = VBAP-KZWI1 / VBAP-KWMENG

VBAP-KZWI1 has the data type CURR with decimal 2

VBAP-KWMENG has the data type QUAN with decimal 3

so let say VBAP-KZWI1 = '200' & VBAP-KWMENG = '20'

then result i expect is to 10 but the value i get in the result is 0.01

please suggest me

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi sandra,

i'm doing code in the user-exit MV45AFZB if we externalize the code then we need to enable fixed-point artihmetic of Main program.

0 Kudos

Hi Andrea,

my code is in the User-exit not able to do fixed-point arithmetic.

Below code in the program with out enabling fixed-point.

cap2.png

in the result i want 5.06

abo
Active Contributor
0 Kudos

This looks like a pricing formula and those normally run with fixed-point arithmetic enabled.

In this situation, your basic unit is 1/100 and you should multiply accordingly.

Sandra_Rossi
Active Contributor

Disabled or enabled? (ABAP documentation says that it's enabled in new programs, and disabling it is now impossible)

When it's disabled (the OP case), 200.00 / 20.000 will give 1 because the decimal point is ignored (20000 / 20000), and 1 will be stored 0.01 because the decimal point is ignored too (1).

The most easy solution is to externalize the code in a new program where fixed-point arithmetic is enabled.