Skip to Content

Help needed with arithmetic equation in pricing routine

Dear experts,

I have a problem on an arithmetic equation that looks simple, but still ends up in an incorrect value. This arithmetic equation is written in a routine at VOFM -> Formulas -> Condition base value.

DATA: lv_scale_base_new TYPE p LENGTH 16 DECIMALS 3.
DATA: lv_whole_num      TYPE i.
DATA: lv_new_kawrt      TYPE kawrt.

* Values:-
* XKAWRT = '3117.00'
* LV_SCALE_BASE_NEW = '3.333'
* LV_WHOLE_NUM = '3'

lv_new_kawrt = xkawrt / lv_scale_base_new * lv_whole_num.
xkawrt = lv_new_kawrt.

* Values:-
* LV_NEW_KAWRT = '2.82'
* XKAWRT = '2.82'

What could I be doing wrong here? Any insights to this, please?

How can I resolve this issue?

The value of LV_NEW_KAWRT and XKAWRT should actually be '2805.58'.

P/S:-

When I ran the exact same codes separately in a new local program, the results are correct instead:- screen-2.jpg

REPORT z_qty_test.
DATA: lv_new_kawrt      TYPE kawrt.
DATA: lv_xkawrt         TYPE kawrt.
DATA: lv_scale_base_new TYPE p LENGTH 16 DECIMALS 3.
DATA: lv_whole_num      TYPE i.
lv_xkawrt         = '3117.00'.
lv_scale_base_new = '3.333'.
lv_whole_num      = '3'.
lv_new_kawrt = lv_xkawrt / lv_scale_base_new * lv_whole_num.
WRITE:/ lv_new_kawrt.
screen-2.jpg (44.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 08, 2017 at 03:48 PM

    Seems that the fixed point arithmetics flag is switched off in the first program.

    Add comment
    10|10000 characters needed characters exceeded