‎2011 Jul 09 7:38 AM
HI all,
I've got this piece of coding:
DATA ls_static_attributes TYPE ztype.
DATA lv_amount TYPE BPREI.
ls_static_attributes-netpr = '123'.
ls_static_attributes-menge = '1'.
ls_static_attributes-bpumn = '1'.
lv_amount = ls_static_attributes-netpr * ls_static_attributes-menge .
well the value of lv_amount is different when the code above is inserted in a report rather than in a method of a class.
In particular, in a report it correctly contains '123,00' whilst in a class I'm getting '123.000,00'.
I tried to debug and I've seen that after the assignment:
ls_static_attributes-menge = '1'.
the variable ls_static_attributes-menge contains (1.000) in a report whilst in a class it contains (0.001).
Could anybody shed more light on this?
‎2011 Jul 09 3:39 PM
Hi,
I think this is due to a different "fixed-point arithmetic" program attribute. It is set by default, which means decimals of packed fields are taken into account. When unchecked, system considers every packed field as an integer (except when it is output). More info: [SAP Library: ABAP - business calculations|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb333d358411d1829f0000e829fbfe/frameset.htm]
BR
Sandra
‎2011 Jul 09 3:39 PM
Hi,
I think this is due to a different "fixed-point arithmetic" program attribute. It is set by default, which means decimals of packed fields are taken into account. When unchecked, system considers every packed field as an integer (except when it is output). More info: [SAP Library: ABAP - business calculations|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb333d358411d1829f0000e829fbfe/frameset.htm]
BR
Sandra
‎2011 Jul 09 5:58 PM
Hi Themis,
probably the ztype has amount or qauntity field which are by default connected to a currency key or unit field. Check the respective currency key or unit fields.
I don't think the code behaves different in class an report context, check also Sandra's suggestion about fixed-point arithmetic flag - actually I don't know any reason to change that default.
Regards,
Clemens
‎2011 Jul 09 6:55 PM
Hi Clemens,
probably the ztype has amount or qauntity field which are by default connected to a currency key or unit field. Check the respective currency key or unit fields.
quantities and units are only used for output, not for internal calculations, it's why I think the fixed-point arithmetic is the only possibility. Usually people don't change it but some standard programs are provided without this option checked, developers are usually getting screwed when they implement the "userexit" subroutines of these programs.
Sandra
‎2011 Jul 11 8:57 AM
Thank you Sandra,
I've given you full points, you've solved my problem.
Regards