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

prefix zero to alphanumeric characters

Former Member
0 Likes
680

Hi All,

Can anyone suggest me any Function module is there to prefix zero to an alphanumeric charcter. I have been trying conversion_exit_alpha_input FM for this purpose but it works fine only for numerics. plaese let me know any FM exists for alphanumeric characters which serves the purpose.

Thanks in Advance

Rijish

4 REPLIES 4
Read only

FredericGirod
Active Contributor
0 Likes
637

yes

w_size2 = strlen( w_data )

w_size = size - w_size2

concatenate w_zero+0(w_size) w_data into w_data.

something like that

Read only

Former Member
0 Likes
637

U can use the below code.

data : lcons(18) type c value '000000000000000000',

lstring(36) type c.

==>lval is your value.

concatenate lcons lval to lstring.

write lstring(18) to lval.

Read only

Former Member
0 Likes
637

Hi,

i make it in this way:

REPORT ZGRO_TEST.

data: test(18).

*

data: test1(18).

data: strlen type i.

data: i type i.

*

test1 = '12wer'.

*

strlen = strlen( test1 ).

I = 18 - strlen.

*

test = '000000000000000000'.

test+i = test1.

  • leading zero.

*

write: / test.

write: / test1.

Regards, dieter

Read only

Former Member
0 Likes
637

Hi,

You can use the below code.

report abc.

data: v_size1(2) type n,

v_size2(2) type n.

constants: c_zeroes(18) type c value '000000000000000000'.

parameters: p1(18) type c.

shift p1 left deleting leading space.

v_size1 = strlen( p1 ).

if v_size1 lt 18.

v_size2 = 18 - v_size1.

shift p1 right deleting trailing space.

p1+0(v_size2) = c_zeroes.

endif.

write p1.

Also, note that the v_size2 is to be calculated as per your requirement.