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: 

suppress the zeros after decimal point

Former Member
0 Kudos

Hi ppl,

Is there any FM available to suppress the unnecessary zeros after the decinal point in a value?

eg. 123.500 -> 123.5

Thanks,

Dawood.

4 REPLIES 4

Former Member
0 Kudos

Please try FM FTR_CORR_SWIFT_DELETE_ENDZERO . This will solve your problem but it is supressing in case when there is no decimals also.

eg:- 123.500 -> 123.5

1235600 -> 123456

Please try if you able to call this FM in case of decimal value only.

Regards,

Mamta Gupta

Former Member
0 Kudos

Be more specific, is this a write, an alv, a table control?

Former Member
0 Kudos

Hi,

You are saying it as a value. The value belongs to which data type?

float or decimal or Packed?

The function module FTR_CORR_SWIFT_DELETE_ENDZERO works when the import parameter is of type C.

So do like this, copy the input variable into a temp variable of type c. then pass temp variable to function module's changing parameter.

Then, copy the temp variable value to the actual variable.

Best Regards,

Suresh

Former Member
0 Kudos

DATA: a(10) TYPE c ,

lv_num1(10) TYPE c,

lv_num2(10) TYPE c,

lv_num3(10) TYPE c.

a = '22.500'.

SPLIT a AT '.' INTO lv_num1 lv_num2.

SPLIT lv_num2 AT '0' INTO lv_num3 lv_num2.

concatenate lv_num1 '.' lv_num3 into a.

WRITE:/ a.

o/p : a = 22.5

Edited by: BrightSide on May 8, 2009 2:55 PM