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 can i remove the zero from decimal ?

carlos_zhang3
Participant
0 Kudos

Dear Guru ,

I am writing an abap program and i want to remove all zero from decimal side .

For instance :

DATA : L_A TYPE MENGE VALUE '333.000' .

DATA : L_A TYPE MENGE VALUE '3335.300' .

.....

.....


OUTPUT :
333
3335.3

Is it possibile to do that ?

Thanks .

Best Regards,

Carlos Zhang

1 ACCEPTED SOLUTION

Former Member
0 Kudos

the easiest way tould be define the variable with the TYPE of a field for which such conversion routine is already defined. conversion routines are assigned at the domain level. the other obvious way is through coding.

Check function modules CONVERSION_EXIT_*

3 REPLIES 3

Former Member
0 Kudos

You can use TRANSLATE or SHIFT statement to remove the zeros

kerem_kayacan
Active Participant
0 Kudos

DATA : l_a TYPE p LENGTH 13 DECIMALS 3 VALUE '333.000' .
DATA : l_b TYPE p LENGTH 13 DECIMALS 3 VALUE '3335.300' .
DATA : l_ax(14).
DATA : l_bx(14).

l_ax = l_a.
l_bx = l_b.

CONDENSE: l_ax, l_bx.

SHIFT: l_ax RIGHT DELETING TRAILING space,
       l_bx RIGHT DELETING TRAILING space,
       l_ax RIGHT DELETING TRAILING '0',
       l_bx RIGHT DELETING TRAILING '0',
       l_ax RIGHT DELETING TRAILING '.',
       l_bx RIGHT DELETING TRAILING '.'.

CONDENSE: l_ax, l_bx.

WRITE: l_ax, / l_bx.

Former Member
0 Kudos

the easiest way tould be define the variable with the TYPE of a field for which such conversion routine is already defined. conversion routines are assigned at the domain level. the other obvious way is through coding.

Check function modules CONVERSION_EXIT_*