Skip to Content

Wrong amount in calculation in ABAP code.

Dear Friends,

                   Here i am facing one issue on ABAP multiplication code.

for your reference you can see below.

code is:

it_ekpo-netwr = 741.67

dkwert           = 10.00

g_excise1 = ( it_ekpo-netwr / 100 )  * dkwert.

when i execute above line the answer should come  g_excise1  = 74.20 but instead of 74.20 answer coming 7420.00.

.actually all the variables are same data types.  kindly anyone suggest me what is the reason behind this? above program type is executable program.

but  another program ( Type Subroutine pool ) same logic and same block is working well. only Program type is difference.

Regards,

  Thangam.P

error.png (39.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Dec 24, 2014 at 11:04 AM

    Hi Perumal,

    Check you program attributes->Fixed point Arithmetic  Check box should be checked otherwise the calculations will not be accurate.

    I tried an example like below.

    Case1 : Fixed point Arithmetic Checked

    data : lv_netwr TYPE BPREI VALUE '741.67'.

    DATA : lv_drk TYPE BPREI VALUE '10.00'.

    DATA : lv_val TYPE BPREI.

    lv_val = ( lv_netwr / 100 ) * lv_drk.

    WRITE : / lv_val.

    OUTPUT :  74.17

    Case2 : Fixed point Arithmetic UnChecked

    OUTPUT :  7,420.00

    Once check and revert.

    Regards,

    Pavan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 24, 2014 at 10:53 AM

    Hi Thangam,

    Whenever we multiply or divide anything with the Condition value (KWERT) the decimals always behave like this. To overcome this issue, usually it happens in pricing routines, we adjust the value by multiplying/divide with multiples of 10. This adjusts the decimal points correctly.

    Regards,

    Aashika

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 24, 2014 at 11:26 AM

    Hi Pavan,

                  Yeah now working fine.. Thanks for your suggestion.

    Regards,

    Thangam.P

    Add comment
    10|10000 characters needed characters exceeded