2007 Aug 27 1:51 PM
HI Friends,
i fetch some fields from database table.. and i load into intenal table...
now i want to do caliculation on those fields...
for example : i want to caliculate Total currecncy / Quantity so, i will get unit cost...
for this what can i write the syntax..
what i wrote is i define one variable as ZRESULT that data type as I
after fetch the data i use this syntax : Zresult = ITAB - TotalCost / ITAB - Quantity
but data was not caliculated.. based on these... PLZ CORRECT ME..
give me the correct syntax..
thanks
Babu
2007 Aug 27 1:57 PM
BABU ,
what is the type of Zresults ?
it should be like this
data: zresults(15) type p decimals 3
Zresult = ( ITAB - TotalCost / ITAB - Quantity ).
Regards
Peram
2007 Aug 27 1:55 PM
try this,
data : Zresult type p decimals 2.
loop at itab.
if not ITAB-Quantity eq 0.
Zresult = ITAB-TotalCost / ITAB-Quantity.
endif.
endloop.
2007 Aug 27 1:57 PM
BABU ,
what is the type of Zresults ?
it should be like this
data: zresults(15) type p decimals 3
Zresult = ( ITAB - TotalCost / ITAB - Quantity ).
Regards
Peram
2007 Aug 27 2:00 PM
hi,
ur internal table is with header line then try like this as
loop at itab.
itab-tot = iITAB - TotalCost / ITAB - Quantity.
update itab.
endloop.
or if ur internal table is without hedaer line then
loop at itab into wa.
wa-tot = wa - TotalCost / wa - Quantity.
modify itab from wa.
endloop.
if useful reward some points.
with regards,
Suresh Aluri.
2007 Aug 27 2:07 PM