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

how to remove zero after decimal point.

Former Member
0 Likes
19,358

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
Read only

Former Member
0 Likes
5,953

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
Read only

Former Member
0 Likes
5,953

hi..

Use..keyword: SHIFT

ex:

SHIFT varb1 RIGHT DELETING TRAILING '0'.

regards,

Padma

Read only

0 Likes
5,953

hi sir.

it print same value.

Read only

0 Likes
5,953

Its Print same Value

Read only

Former Member
0 Likes
5,953

Hi,

write: gv_variable decimals 0.

Darren

Read only

0 Likes
5,953

hi

i need only remove the zero after decimal points only.

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

Read only

Former Member
0 Likes
5,953

Hi,

do this way


 SHIFT VALUE LEFT DELETING LEADING '0'.

Thanks,

Chidanand

Read only

Former Member
0 Likes
5,954

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

Read only

Former Member
0 Likes
5,953

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

Read only

Former Member
5,953

hi,

try with CEIL command....

Regards,

Shankar.

Read only

Former Member
0 Likes
5,953

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.

Read only

0 Likes
5,953

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

Read only

Former Member
0 Likes
5,953

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