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

deleting zero after point

Former Member
0 Likes
980

<b>1</b>.i have 5.900000

i want to get 5.90

<b>2.</b> i have 5.00 i want to get only 5

how?

thanks..

<b>1</b>.i have 5.900000

i want to get 5.90

<b>2.</b> i have 5.00 i want to get only 5

how?

thanks..

9 REPLIES 9
Read only

eddy_declercq
Active Contributor
0 Likes
955

Hi,

Check this forum thread:

Eddy

Read only

Former Member
0 Likes
955

Hi,

1) define a variable v_1(3) type c. move the value to this variable.

Read only

Former Member
0 Likes
955

Hi,

Use either of the two methods :-

1.

DATA : a(5) TYPE c.

a = '5.14500'.

SHIFT a RIGHT DELETING TRAILING '0'.

CONDENSE a NO-GAPS.

WRITE 😕 a.

2.

DATA : a(5) TYPE c,

b(4) TYPE c.

a = '5.10500'.

SHIFT a RIGHT DELETING TRAILING '0'.

CONDENSE a NO-GAPS.

WRITE 😕 a.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = a

IMPORTING

OUTPUT = b

.

WRITE 😕 b.

Best regards,

Prashant

Read only

Former Member
0 Likes
955

you can use the write variable decimals 0.

DATA: X TYPE P DECIMALS 3 VALUE '1.267',

Y TYPE F VALUE '125.456E2'.

WRITE: /X DECIMALS 0, "output: 1

/X DECIMALS 2, "output: 1.27

/X DECIMALS 5, "output: 1.26700

Read only

Former Member
0 Likes
955

Hi Liat,

Use the option Condense.

For Eg: If u want to print v_field with only two decimals, then write the field like this &V_field(C.2)&

and for 0 decimals use &v_field(C.0)&

This is for scripts.

Thanks,

Vamsi.

Read only

0 Likes
955

guys

i get the value in alv---itab

the data is change all the time

sorry i didnt mantion.

Read only

0 Likes
955

at 1. i want always 2 number after the point.

at 2. i want only numbers

Read only

Former Member
0 Likes
955

Hi,

1. To get only 2 decimlas transfer to a variable of type p decimals 2.

2. Transfer to a variable of type i.

It has worked i have tried it out.

Cheers,

Deepak

Read only

0 Likes
955

Hi,

Pls don't forget to reward points and close the question if you find the answers useful.

Eddy