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: 

Amount conversion in ABAP...

Former Member
0 Kudos
122

Hello,

I want the following kind of conversion.

0000000000.53 -> 0.53

0000000123.00 -> 123.00

0000000001.23 -> 1.23

0000000005400 -> 5400

Please help.

Regards,

Rajesh.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
94

Is this what you are looking for.

PROGRAM ztest.
DATA:ts(100) TYPE c VALUE '0000000000.53'.
SHIFT ts LEFT DELETING LEADING '0'.
WRITE: ts.

For values with no decimals you can use conversion exits as well. For others just use SHIFT statement.

Amandeep

2 REPLIES 2

Former Member
0 Kudos
95

Is this what you are looking for.

PROGRAM ztest.
DATA:ts(100) TYPE c VALUE '0000000000.53'.
SHIFT ts LEFT DELETING LEADING '0'.
WRITE: ts.

For values with no decimals you can use conversion exits as well. For others just use SHIFT statement.

Amandeep

Former Member
0 Kudos
94

use function module:

for leading zeros

CONVERT_EXIT_ALPHA_OUTPUT

for adding zeros

CONVERT_EXIT_ALPHA_INPUT