‎2007 Feb 11 4:06 PM
data:aaa type dec16_3.
...
loop at itab.
aaa = itab-field1.
endloop.
field1 type is dec15_2.
in su01,all my user set is ok.
when i debuging,
i change the value of itab-field1,for exmple, the vlaue is 99(a integer ,without decimal fraction) ,the system change 99 into 0.99 .why?
if i change the value into 99.00(a integer ,with two decimal fraction),the system do not change it.
if itab-field1 = 888 then aaa = 88.8. my god,SAP is so oddness.
‎2007 Feb 11 5:28 PM
Hi Jason,
all dec numbers are stored as binary coded decimals (BCD), dec15_2 means that the last two digits are interpreted as decimals. This is due to automatic type conversion that two digits like 99 without any information about decimals will be stored 'as is' and get interpreted as last two digits for decimals - resulting in .99.
When units and currencies are involved, it gets even worse: In DDIC CURR and QUAN fields are connected to a currency key (CUKY) or unit key. Internal storing is always 3 digits and i.e. CUKY field gives information about number of decimals ( 1 for Japanese Yen, 2 for USD and so on).
Conclusion: Many things in SAP are odd, most of them are caused by the business-orientation of system and programming language. It takes it's time to understand but then it turns out to be useful.
Regards,
Clemens
‎2007 Feb 12 4:34 AM
thank you Li.you have more experience than me .
my msn:meiok1@hotmail.com
My question has been answered.
the way is :
ABAP Edit \main menu\goto\attribute\
check the fixed point arithmetic checkbox.
the checkbox is checked default.
but my program is a copied program.
it has include,and i renamed the include to an exist
include name.So the main program become a include.(Maybe
it's a bug).I change the new main program type from include back to executable program.
the "fixed point arithmetic" checkbox is unchecked.