‎2009 Aug 20 5:40 AM
Hi All,
I have simple query ...When i do division like 5/2 then answer will be whole number as 3....I am doing division of odd number with 2 but in that case i want answer to appear as earlier number e.g. if i divide 5/2 then i want answer as 2.
Is it possible ???...if yes how??
thnx.
‎2009 Aug 20 5:49 AM
‎2009 Aug 20 5:46 AM
Hi,
Do not take the output field type as type P. Take it as integer type and try.
Thanks,
Sri.
‎2009 Aug 20 5:48 AM
i am taking data type as i only , even i tried num but not getting desired output.
‎2009 Aug 20 5:56 AM
Hi,
Try this,
data : num1 TYPE p VALUE 2,
num2 TYPE p VALUE 5,
num3 TYPE p .
num3 = trunc( num2 / num1 ).
WRITE num3.Thanks,
Sri.
‎2009 Aug 20 6:01 AM
DATA : p1 TYPE i, p2 type p DECIMALS 2.
p2 = 5 / 2.
p1 = floor( p2 ).
WRITE p1.
‎2009 Aug 20 5:49 AM
‎2009 Aug 20 5:54 AM
Hi,
Check this
DATA: a TYPE p DECIMALS 0,
b TYPE p DECIMALS 0.
a = 5 / 2.
b = floor( a ).
WRITE: b.
Or
DATA: a TYPE i,
b TYPE i.
a = 5 / 2.
WRITE: a.
‎2009 Aug 20 5:55 AM
Hi.
Refer this link.
http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3316358411d1829f0000e829fbfe/content.htm
REgards.
jay
‎2009 Aug 20 5:57 AM
Hi,
Check out the code below.
data : num type p value 5 decimals 2.
data : num1 type p value 2 decimals 2,
div type p decimals 2, div1 type i.
div = num / num1 .
div1 = floor( div ).
write div1.
Hope it will solve.
Regards
Raghu