Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

String Value output.....

Former Member
0 Likes
1,283

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.

9 REPLIES 9
Read only

arpit_shah
Contributor
0 Likes
1,112

try to convert in to ch type,

may be it is helpful to u.

Regards,

Arpit

Read only

former_member156446
Active Contributor
0 Likes
1,112

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

Read only

Former Member
0 Likes
1,112

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.

Read only

0 Likes
1,112

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

Read only

Former Member
0 Likes
1,112

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

Read only

Former Member
0 Likes
1,112

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

Read only

Former Member
0 Likes
1,112

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

Read only

Lakshmant1
Active Contributor
0 Likes
1,112

Hi Yusuf,

Try using DECIMALS formatting option,

WRITE:/ <FIELD NAME> DECIMALS 0.

Thanks

Lakshman

Read only

0 Likes
1,112

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