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

Function module to add spaces

Former Member
0 Likes
1,648

I want to concatenate a numeric field with a string. The numeric field length is 5. However the actual entry may be less than that. What I want now is one function module to add proper no of spaces before the numeric field so that I can split the concatenated result afterwards without being bothered what the length of that numeric field is. ( I will simply take out the first five characters). I know a function module CONVERSION_EXIT_ALPHA_INPUT that adds 0(zero). Is there any function module that can add spaces is the length is below 5?

4 REPLIES 4
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,086

Do we need a fm for this ??


data:lv(5) type n.
data:str type char10.

lv = '1234'.
str+5(*) = lv.

Read only

0 Likes
1,086

Did not get you.

Example: My numc field may be 12345 or just 123 (I don't know).

After concatenation with the string (say ABCDEF) it may become 12345ABCDEF or 123ABCDEF.

What will be splitting criteria then?

Read only

0 Likes
1,086

I did not get you dear

first you are concatenating and then spitting ?

If so you can use separated by space with concatenate and use space for spitting.

Thanks,

Anmol.

Read only

0 Likes
1,086

Hi,

Splitting criteria will be from offset 5

You said that your numeric fields maximum length is 5. So do it like this. always the first five characters is for the numeric value.

data:lv(5) type n.

data:str type char255.

lv = '123'.

str+0(5) = lv.

str+5(*) = 'ABCDEF'.

write str.

skip 1.

write str+0(5).

lv = '1234'.

str+0(5) = lv.

str+5(*) = 'ABCDEF'.

write str.

skip 1 .

write str+0(5)..