‎2008 Jan 05 5:35 AM
Hi Experts,
I have written a classical report in which i defined variables string and it contains values.
When i am given output with write statement it is displaying with 1234.000 and i want to remove decimals.
And even i also tried to convert in integer type i but the output is comming like 1,234. I want 1234 only, no comma.
Pl. give solution for both string and integer for output i want is without decimals.
Yusuf.
‎2008 Jan 05 5:38 AM
try to convert in to ch type,
may be it is helpful to u.
Regards,
Arpit
‎2008 Jan 05 5:41 AM
price = 1234.050
split price at '.' into lv_n lv_dec.
lv_n ill be 1234 , lv_dec ill be 050 <<<<<<<<<
clear price.
concatenate lv_n lv_dec into price.
write:/ price >>>>>>>> 1234050
if you need the whole number only
declare price like type i. or N
price = lv_n .
price will be 1234 only.
Edited by: Jay Raj on Jan 5, 2008 12:42 AM
‎2008 Jan 05 5:43 AM
Hi friend,
if ur using write statement
try write <fld> decimals 0.
if ur using ALV
in field catalog of that field
<fcat table>-decimals_out = 0.
‎2008 Jan 05 5:46 AM
Hi Will,
I tried the string with decimals 0 but it is comming same 1234.000 also i convert into integer type i gave decimals 0 then it is showing 1,234.
Yusuf
‎2008 Jan 05 5:47 AM
Check this code.
DATA : aa(10) TYPE p DECIMALS 3 VALUE '1234'.
DATA : bb(10), cc(10).
WRITE: aa.
bb = aa.
WRITE: bb.
SPLIT bb AT '.' INTO bb cc.
WRITE: bb.
awrd points if useful
Bhupal
‎2008 Jan 05 5:49 AM
Hi Yusuf,
Try to use like this.
Data: a type i.
Data: b(13) type c.
a = '12345.00'.
then convert it into char.
b = a.
b = b.
write: b.
output will be 12345
If it usefull pls do reward.
Regards
Srimanta
‎2008 Jan 05 5:50 AM
Hi yousuf,
write the code below,
Ex: we have a value in string(v_str) like 1234.000.
if we wants to print only 1234. we needs take it in char type field.
Ex:
data: v_sample(20) type c,
v_test(10) type c,
v_tmp(10) type c.
write:/ v_str -
> output 1234.000
v_sampe = v_str.
split v_str at '.' into v_test v_tmp.
write:/ v_test.----
> output 1234.
I hope this will solve your issue.
Thanks,
Murali
‎2008 Jan 05 6:16 AM
Hi Yusuf,
Try using DECIMALS formatting option,
WRITE:/ <FIELD NAME> DECIMALS 0.
Thanks
Lakshman
‎2008 Jan 05 7:51 AM
Hi ,
There Are Two way to do the thing.
1. Either change the fields in Character Type , by adding a new column in your internal table.
issue: your performance may be affected because you have to run a loop for each record.
2. Use the following Way.
Write 😕 <Fields Name want to display> Decimals 0.
Hope it help you.
Regards
Swati Namdeo