‎2008 Jul 01 11:39 AM
hi,
i have a variable whose value is 4.73 which is of type packed
and my requirement is to split this value into 2 parts
say variable 1 should 4 and variable 2 should hold 0.73.
can anyone tell me is there any function module to split 4.73 into 4 and 0.73 ?
plz suggest ... ur help will be appreciated
Edited by: Ajantha Ratnakumar on Jul 1, 2008 4:09 PM
‎2008 Jul 01 11:42 AM
No need of Fun.module..
DATA : TEMP TYPE P DECIMALS 3.
I = TRUNC( TEMP ). " integer part
D = FRAC( TEMP ). " decimal part
‎2008 Jul 01 11:41 AM
hi,
u can use arthematic operations.
CEIL
Smallest integer value that is not less than x
FLOOR
Largest integer value that is not greater than x
TRUNC
Interger part of x
FRAC
Decimal part of x
‎2008 Jul 01 11:42 AM
No need of Fun.module..
DATA : TEMP TYPE P DECIMALS 3.
I = TRUNC( TEMP ). " integer part
D = FRAC( TEMP ). " decimal part
‎2008 Jul 01 12:51 PM
hi,
can u tell me are there any other function of that sort available ?
like trunc and frac ?
‎2008 Jul 01 12:54 PM
Hi,
press F1 on TRUNC or FRAC and you get more Informations.
Regards, Dieter
‎2008 Jul 01 11:45 AM
Try this ...
data : v_char(10).
v_char = '4.73 '. <-- pass your value ..
split v_char at '.' into v_1 v_2.
‎2008 Jul 01 11:51 AM
data: test type p decimals 2 value '4.73',
test3(15),
test1 type c,
test2(3) .
test3 = test.
test1 = test3+10(1).
test2 = test3+12(2).
write:/ test1, test2 .
‎2008 Jul 01 11:53 AM
Hi,
i'm not quite sure if you mean this:
DATA: p1 type p decimals 2.
DATA: p2 type p decimals 2.
*
p1 = 471 / 100.
*
write: / p1, p2.
*
p2 = p1 mod 1.
p1 = p1 - p2.
*
write: / p1, p2.
Try it.
Regards, Dieter
‎2008 Jul 01 11:55 AM
Hi,
data: a(5),
c(5) value '4.73',
d(5),
b(5).
write:/ 'c', c.
Split c at '.' into a d.
write:/ 'a', a.
write:/ 'd', d.
concatenate '0' '.' d into b.
write:/ 'b', b.
Regards
VIjay