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: 

Replacing sapces with 0 in character variables.

Former Member
0 Kudos

Hi,

Can anyone suggest a method to replace zeros instead of characters at left side.

I have a component of internal table which accepts character data --> size 10, however before it gets uploaded I want it to look like '0000000012' instead of 12.

I used replace and replace all occurances, I also tried using first SHIFT and later REPLACE but no use.

Can anyone help ?

Appropirate rewards for good answers.

Thank you,

Dipesh Jhala.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi

use fm CONVERSION_EXIT_ALPHA_INPUT to add leading zeroes

if helpful, reward

Sathish. R

8 REPLIES 8

Former Member
0 Kudos

hi

use fm CONVERSION_EXIT_ALPHA_INPUT to add leading zeroes

if helpful, reward

Sathish. R

Former Member
0 Kudos

data : var(10) type n.

var = <your char var>.

write : / var.

or use conversion_exit_alpha_input fn module.

regards

shiba dutta

Former Member
0 Kudos

HI ,

You can use CONVERSION_EXIT_ALPHA_INPUT to add leading zeros.

Reward helpful answers.

Regards,

Siddhesh Sanghvi.

former_member208856
Active Contributor
0 Kudos

Hi,

use code as below :

data : a(10), b(10).

a = '12'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = a

IMPORTING

OUTPUT = b

.

write 😕 a.

write 😕 b.

Reward, if helpful,

Sandeep Kaushik

Message was edited by:

Sandeep Kaushik

Former Member
0 Kudos

Hi,

You can use the function module 'CONVERSION_EXIT_ALPHA_INPUT' for the same.

Former Member
0 Kudos

Hi,

try this:

data : char(10) value '12'.

write 😕 char.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = char

IMPORTING

OUTPUT = char.

*

write 😕 char.

regards, Dieter

Former Member
0 Kudos

data:

temp(10).

temp = ' 12'.

overlay temp with '0000000000'.

write temp.

Former Member
0 Kudos

Thanks to all for the response.

I had tried all of these things.However I am still going to try and give points to all the answers with function module <b>CONVERSION_EXIT_ALPHA_INPUT</b>

Now the problem lied in the conversion routines attached to the data elements of the fields which were getting used in the internal table.

What I did was I changed the domain to a 'z' domain and obviously avoided the conversion routine.

Thank you all.

Dipesh Jhala.