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

concatenation - space

Former Member
0 Likes
861

Hello all,

I am concatenating something like this -



condense l_bstkd.

concatenate '~'
                   l_bstkd
                   '~' into ltext.

The sample result of the above would look like

ltext = xyz.

My requirement now is let us say l_bstkd is blank. In this case the above will result in l_text = ~~.

But I need a space between ~'s when l_bstkd is blank so that l_text = ~ ~.

Suggestions please

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
836

Hi,

Try this..

IF l_bstkd IS INITIAL.

concatenate '~'

'~' into ltext SEPARATED BY SPACE.

ELSE.

concatenate '~'

l_bstkd

'~' into ltext.

ENDIF.

Thanks,

Naren

Hello all,

I am concatenating something like this -



condense l_bstkd.

concatenate '~'
                   l_bstkd
                   '~' into ltext.

The sample result of the above would look like

ltext = xyz.

My requirement now is let us say l_bstkd is blank. In this case the above will result in l_text = ~~.

But I need a space between ~'s when l_bstkd is blank so that l_text = ~ ~.

Suggestions please

7 REPLIES 7
Read only

Former Member
0 Likes
837

Hi,

Try this..

IF l_bstkd IS INITIAL.

concatenate '~'

'~' into ltext SEPARATED BY SPACE.

ELSE.

concatenate '~'

l_bstkd

'~' into ltext.

ENDIF.

Thanks,

Naren

Read only

0 Likes
836

Hi,

thanks for the reply. I know we could do something like this. but my problem is I have like 7 char fields which I am concatenating. I think its impractical to apply your logic to handle all the 7 char fields.

what do you think?

Read only

0 Likes
836

after concatenation you can write statemnet like this

Replace '~' with ' ~' in <string name>

Read only

Former Member
0 Likes
836

you need to check

if l_bstkd is initial

concatenate '~'

l_bstkd

'~' into ltext seperated by space.

endif.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
836

I know, it does look very good, but it should work.




condense l_bstkd.

if l_bstkd is initial.
ltext = '~ ~'.
else.
concatenate '~'
                   l_bstkd
                   '~' into ltext.
endif.

Regards,

RIch Heilman

Read only

0 Likes
836

folks,

actually I am concatenating total 7 char fields into ltext. how to handle all the 7 char fields at the same time.

Read only

Former Member
0 Likes
836

Hi,

Okay..Do this..

After the concatenate..

CONCATENATE '~'... ~' into L_TEXT.

IF L_text = '~~'.

L_text = '~ ~'.

ENDIF.

Thanks,

Naren