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

restrict the length

Former Member
0 Likes
835

hi guru,

i have one value in my output in alv report.

that is fgrand total = 99.8765888% (variable declared in string)

i want to restrict the lenth upto 2 decimals

ex. 99.87%

how to do it ????

give me solution.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
809

Hi,

Add DECIMALS_OUT in the field catalog.

Regards,

Sankar.

Hi,

Add DECIMALS_OUT in the field catalog.

Regards,

Sankar.

5 REPLIES 5
Read only

Former Member
0 Likes
809

Hi

declare one more varible of type p with decilmals 2

data : v_dec type p with decilmals 2

v_dec = fgrand.

otherwise use Floor or round

regards

Shiva

Read only

Former Member
0 Likes
809

Hi,

u can do that with command for string 'REPLACE' .

regards,

paliwal

Read only

Former Member
0 Likes
809

DATA:

total TYPE string VALUE '99.8765888%'.

REPLACE total+5(5) WITH ' ' into total.

CONDENSE total NO-GAPS.

write: total.

you will get the output as 99.87%

If ur string has length as ur example or of same pattern of it will work.

regards,

priya.

Read only

Former Member
0 Likes
809

Hi subhasis,

if you want to restrict and round off the number as well you can use the Function module "ROUND".

Regards,

Goutham.

Read only

Former Member
0 Likes
810

Hi,

Add DECIMALS_OUT in the field catalog.

Regards,

Sankar.