Home > database >  ABAP Packed number multiplication - differents results
ABAP Packed number multiplication - differents results

Time:11-26

I am missing a part to solve my problem.
If I do this operation :

TYPES: ty_p2 TYPE p DECIMALS 2.
DATA: lv_test TYPE ty_p2.

lv_test = '100.00' * '3.00'.

I got this result in a program (specific program) on debugger view :

enter image description here

this is the actual result I expect.

I got this result in a program (enhancement of a standard) on debugger view :

enter image description here

it's not the right result it's as if it were 100*3000 and it doesn't take into account the comma of the right hand operator of the multiplication.


How do you explain this ?

Is there an instruction which applies to the context of the ABAP session and which can modify the interpretation of the packed number during a multiplication? Or do you know where it comes from?

Thanks !

CodePudding user response:

Fixed point arithmetic is not checked for the program.

When you are in change mode in SE38 (or SE80), use Menü Goto => Attributes enter image description here

A popup comes up the checkbox for "Fixed point arithmetic" has to be checked (bottom-right corner of the popup window): enter image description here

Using F1 Help on the field gives detailed explanation: enter image description here

  • Related