Application Development 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: 

deleting zero after point

Former Member
0 Kudos

<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

eddy_declercq
Active Contributor
0 Kudos

Hi,

Check this forum thread:

Eddy

Former Member
0 Kudos

Hi,

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

former_member223537
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

guys

i get the value in alv---itab

the data is change all the time

sorry i didnt mantion.

0 Kudos

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

at 2. i want only numbers

Former Member
0 Kudos

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

0 Kudos

Hi,

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

Eddy