2007 May 21 11:34 AM
Hi
I have V1 Type QUAN Length = 10 ,Decimal = 3
And V2 as type Character 10.
The requrement is Suppose V1 contains V1 = 1234.732
then V2 must contain V2 = '0000001235' (i.e Rounded Integer with Zeros padded at start)
Suggest a simple code ..
Reward will be given for good ones.
Thanks
2007 May 21 11:57 AM
Hi
See This Code
You have V1 And V2...... Declare two integers v3 and v4. And v5 as c.
data:v3 type i, v4 type i,v5 v6(11).
Split V1 at '.' into v3 v4.
v5 = v4+0(1).
if v5 >= 5.
concatenate '000000' v3 into V6.
else.
"" Do according to your requirment, you didnt mention in the above code..""
endif.
Try this and revert back in case of any errors..
Reward All The Helpfull Answers....
2007 May 21 11:42 AM
hi tulip,
try this code, it will work
*********
data : t1 TYPE pc207-betrg,
t2(10) TYPE n.
t1 = '12345.23'.
t2 = t1.
write 😕 t2.
with Regards,
S.BArani
2007 May 21 11:45 AM
hi Tulip ,
make use of the function module for rounding up numeric values :
FIMA_NUMERICAL_VALUE_ROUND
Regards,
Ranjita
2007 May 21 11:48 AM
Hi
Read the requirement carefully..
And then come back with the Code.
Regards..
Tulip
2007 May 21 11:51 AM
hey tulip,
hav u tried the code which i send...
tel me clearly that u need code for rounding off also ?
2007 May 21 11:57 AM
Hi
See This Code
You have V1 And V2...... Declare two integers v3 and v4. And v5 as c.
data:v3 type i, v4 type i,v5 v6(11).
Split V1 at '.' into v3 v4.
v5 = v4+0(1).
if v5 >= 5.
concatenate '000000' v3 into V6.
else.
"" Do according to your requirment, you didnt mention in the above code..""
endif.
Try this and revert back in case of any errors..
Reward All The Helpfull Answers....
2007 May 21 12:00 PM
I am trying below code..
DATA l_int type I.
if frac( V1 ) >= '0.5' .
V1 = ceil( V1).
else.
V1 = floor( V1 ).
endif.
l_int = trunc( V1 ).
V2 = l_int.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = V2
IMPORTING
OUTPUT = V2.
Regards
Message was edited by:
Tulip Shah
2007 May 21 12:01 PM
Hi
One Small Change in The Above Code..
Before The Concatenation just add one line,....
V3 = V3 + 1.
2007 May 21 12:05 PM
Hi Tulip
write V1 to V2 round 2 decimals 0 .
move the character variable to integer variable . it will add automatically leading zeros .
2007 May 21 12:07 PM
unsing roundoff the value will rounded ....then use SHIFT key work so that your quesry will be solved .
SHIFT text UP TO 'you' LEFT/RIGHT .
OR
CONCATENATE 'ZEERO' WOTH V1 INTO V1 .
LEFT-JUSTIFIED|CENTERED|RIGHT-JUSTIFIED
For removing decimals ...
DATA pack TYPE p VALUE '12345678'.
WRITE pack NO-GROUPING ROUND 2 DECIMALS 4.
girish
Girish
2007 May 21 12:12 PM