‎2007 Jan 29 8:26 PM
I have 2 internal tables with header line . I am doing the following operation.
itab2-amt = itab2-amt + itab-amt .
itab2-amt1 = itab2-amt1 + itab-amt1.
amt and amt1 are defined as 9 characters each .
In Debug mode itab amt and amt 1 show as 1110.34 and 2222.22 .
But when I do the above operation
itab2-amt = 111034
itab2-amt1 = 222222
Please advise .
Thanks ,
Hari
‎2007 Jan 29 8:28 PM
See if the check box for fixed point arithmetic is chosen in the program attruibutes section.
Regards,
Ravi
‎2007 Jan 29 8:52 PM
I checked it looks good . But why is that in one internal table it is different from the other .
Thanks ,
Hari
‎2007 Jan 29 10:10 PM
Because in the first table, the character value is assigned literally ('1110.34'). But as soon as you perform a caclulation with fixed point arithmetic turned off, it treats all numbers as integers.So the results are ijntegers.
Press F1 on the fixed point arithmetic checkbox in the attributes.
And Subramanian is correct. It's best not to do arithmetic on character fields. At best, performance is compromised; at worst, it can dump.
Rob
Message was edited by:
Rob Burbank
‎2007 Jan 29 9:27 PM
Hi,
Do not perform arithmetic operations on character fields.
Check if the field is referring to NUMC, if yes try to define as a packed decimal and do the operations.
After all your operations are done, and you want it to be stored into a character data type, you may move it to another variable.
Regards
Subramanian
‎2007 Jan 29 9:55 PM
Hi Hari,
If both the fields of internal tables are character types then it should be working fine. You can do arithmetic operations also on characters fields. Can you copy paste your code containig internal table declaration aslo.
Ashven
‎2007 Jan 30 1:53 AM
hi hari,
why dont u declare amt fields in both the itabs as type WRBTR
e.g. amt1 type wrbtr.
or you can use currency option to format the amount field in your write statement.
e.g. write itab-amt currency USD.
cheers,
vikram
pls reward for helpful replies!!
‎2007 Jan 30 4:14 AM
I THINK YOU DINT ASSIGN YOUR AMT FIELD AS
DATA : AMT TYPE P DECIMALS 2.
OR ASSIGN LIKE ANY CURRENCY FIELD.
I THINK YOU ASSIGNED IT AS NUMERIC SO THE PROBLEM IS THERE PLS CORRECT ME IF I AM WRONG.
REGARDS
SHIBA DUTTA
‎2007 Jan 30 5:01 AM
Hi,
Kinldy check the Check box for Fixed Point arthemetic.
It is availble in the attributes of the program.
REgards
Nagaraju
‎2007 Jan 30 5:18 AM
Hi,
You try to declare AMT.
Ex.
DATA: amt TYPE i DECIMALS 2
Reward if useful