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 zero after decimal point.

Former Member
0 Kudos

hi friends

how to remove the zero after decimal points.

example :

123.450 -- if print only 123.45

45.600 - 45.6

any body help me.

thanks

pauldhama

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hii

use FM

FTR_CORR_SWIFT_DELETE_ENDZERO

this FM will remove all the zeros from decimal values

like

value - 234.8000000

output - 234.8

regards

twinkal

12 REPLIES 12

Former Member
0 Kudos

hi..

Use..keyword: SHIFT

ex:

SHIFT varb1 RIGHT DELETING TRAILING '0'.

regards,

Padma

0 Kudos

hi sir.

it print same value.

0 Kudos

Its Print same Value

Former Member
0 Kudos

Hi,

write: gv_variable decimals 0.

Darren

0 Kudos

hi

i need only remove the zero after decimal points only.

decimal 0 -- this statement obmit the all decimals value.

former_member598013
Active Contributor
0 Kudos

Hi,

do this way


 SHIFT VALUE LEFT DELETING LEADING '0'.

Thanks,

Chidanand

Former Member
0 Kudos

hii

use FM

FTR_CORR_SWIFT_DELETE_ENDZERO

this FM will remove all the zeros from decimal values

like

value - 234.8000000

output - 234.8

regards

twinkal

Former Member
0 Kudos

go through this example

it may help u

DATA: T(14) VALUE ' abcdefghij',

STRING LIKE T,

STR(6) VALUE 'ghijkl'.

STRING = T.

WRITE STRING.

SHIFT STRING LEFT DELETING LEADING SPACE (or use 0 to detete 0).

WRITE / STRING.

STRING = T.

SHIFT STRING RIGHT DELETING TRAILING STR or 0.

WRITE / STRING.

Output:

abcdefghij

abcdefghij

abcdef

former_member182426
Active Contributor

hi,

try with CEIL command....

Regards,

Shankar.

Former Member
0 Kudos

Hello

Try this logic:


data: var1 type p decimals 3,
      var2 type p decimals 2,
      var3 type p decimals 1.
move '12345.100' to var1.
move var1 to var2.
move var1 to var3.

if var2 = var1.
  if var3 = var1.
    write var3.
  else.
    write var2.
  endif.
else.
  write var1.
endif.

0 Kudos

hi,

i think this is the corect way..

FM.

FTR_CORR_SWIFT_DELETE_ENDZERO

but we can not how many zero will be at last...

Regards,

Bharani

Former Member
0 Kudos

Hello

Tryt his code :


data amt(6) type p decimals 3 value '123.450'.
data amt1(6) type p decimals 2.
data amt_c(6) type c.
unpack amt to amt_c.
shift amt_c right deleting trailing '0'.
pack amt_c to amt1.

write amt1.

regards,

Advait

Edited by: Advait Gode on Oct 10, 2008 3:16 PM