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: 

how to remove .000 in the filed

Former Member
0 Kudos

Hi,

Can any one please let me know i have a filed having 13 characters.in that 3 are decimals.

now my requirement is that i need to remove dot as well as 3 decimals from the value.

For ex: user is giving the width as 50 but while displaying it is showing 50.000.

and another possibility is that user may give 50.50 then 50.50 only to be displayed in the output.

Please any one suggest me the solution.

Regards,

Koti

5 REPLIES 5

Former Member
0 Kudos

HI Koti

if it's classical output then use

WRITE <value> NO ZERO.

If alv then put no_zero in field catalog as 'X'

Pushpraj

former_member222860
Active Contributor
0 Kudos

Hi,

Check this logic:

data: val type p decimals 3.
data: val1 type i.

val = '234.000'.

move val to val1.

write:/ val1.

thanks\

Mahesh

Former Member
0 Kudos

Hi Koti Reddy

Refer this link somebody faced same issue

Thanks

Syfulla

Former Member
0 Kudos

Hi Kotireddy,

You can use round if its a packed number and give your decimal places as 2.

Much Regards,

Amuktha.

Former Member
0 Kudos

Hi,

This works for sure.

Try this.

DATA w_p TYPE p DECIMALS 2 VALUE '123.00'.( take ur packed with ur decimals needed )

DATA w_c(30) TYPE c.

DATA w_temp TYPE i.

w_c = w_p.

CONDENSE w_c.

SEARCH w_c FOR '...'.

IF sy-subrc EQ 0.

w_temp = sy-fdpos.

ENDIF.

ADD 1 TO w_temp.

IF w_c+w_temp EQ 0.

subtract 1 from w_temp.

WRITE 😕 w_c+0(w_temp).

ELSE.

WRITE 😕 w_c.

ENDIF.