‎2008 Mar 04 5:59 AM
I am a newbie in SAP.
I have a variable declared like this:
DATA y_dots(6) TYPE c.
I performed some mathematical operation on this variable and it ends up as 56.5.
So do I round up this variable so that it becomes 57 or 56?
Please help and I will reward you.
Thanks
‎2008 Mar 04 6:11 AM
Hi,
Just do like this,
define one local variable with type p then move your field (type c field) into this variable and display this.
sample code shows here how to do that,
DATA: data(5) TYPE c VALUE '12.60',
data1 type p.
data1 = data.
WRITE: data1, data.
it'll solve your problem.
seshu.
‎2008 Mar 04 6:05 AM
Hi,
DATA N TYPE P DECIMALS 2.
DATA M TYPE P DECIMALS 2 VALUE '5.55',
DATA c_var TYPE I.
N = FRAC( M ).
IF N GE 0.5.
c_var = FLOOR( M ). WRITE: / 'FLOOR:', c_var.
ELSE.
c_var = CEIL( M ). WRITE: / 'CEIL: ', c_var.
ENDIF.
‎2008 Mar 04 6:11 AM
Hi,
Just do like this,
define one local variable with type p then move your field (type c field) into this variable and display this.
sample code shows here how to do that,
DATA: data(5) TYPE c VALUE '12.60',
data1 type p.
data1 = data.
WRITE: data1, data.
it'll solve your problem.
seshu.