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

CONCATENATE PROBLEM?

Former Member
0 Likes
943

Hi friends,

I have a problem in concatenation.

I have 2 variables like A and B.

I am concatenating into C .

In between A and B i need 3 space empty like below program

****************************************************************

REPORT YABCDE .

DATA: A(5) TYPE C,

B(5) TYPE C,

C(20) TYPE C.

A = 'ABC'.

B = 'XYZ' .

CONCATENATE A ' ' B INTO C .

WRITE:/ C.

****************************************************************

I need answer like 'ABC XYZ'.(NEED 3 space between ABC and XYZ).

But its coming like ABCXYZ.

Points will be rewarded.

8 REPLIES 8
Read only

Former Member
0 Likes
919

try this:

concatenate A B into C separated by space.

regards,

madhumitha

Read only

Former Member
0 Likes
919

Hi,

Try this:

CONCATENATE A B INTO C SEPARATED BY SPACE.

but this will give you only 1 Space in Between ABC and XYZ.

OR

For 3 Spaces, Create another Variable with 3 Spaces and write the Below piece of code:

DATA:
  a(10) TYPE c VALUE 'ABC',
  b(10) type c VALUE 'XYZ',
  c(10)  TYPE c,
  d(3)   TYPE c VALUE '   '.

CONCATENATE A B INTO C SEPARATED BY D.

write:
  / c.

Regards,

Sunil.

Read only

Former Member
0 Likes
919

This works


DATA: A(5) TYPE C,
B(5) TYPE C,
C(20) TYPE C.

A = 'ABC'.
B = 'XYZ' .

CONCATENATE A '***' B INTO C .
translate c USING '* '.
WRITE:/ C.

Read only

Former Member
0 Likes
919

HI,

code like this.


DATA: A(5) TYPE C,
B(5) TYPE C,
C(20) TYPE C.

A = 'ABC'.
B = 'XYZ' .

CONCATENATE A '   ' B INTO C RESPECTING BLANKS.
WRITE:/ C.

rgds,

bharat.

Read only

Former Member
0 Likes
919

DATA: A(5) TYPE C,

B(5) TYPE C,

C(20) TYPE C.

A = 'ABC'.

B = 'XYZ' .

C = ' '. " 3 spaces.

CONCATENATE A C B INTO C .

WRITE:/ C.

Reward if helpful.

Thanks,

Imran.

Read only

Former Member
0 Likes
919

Hi,

just declare one variable or constant c_space and pass the value space(press ALT key and then press 0160, repeat this 3 times for 3 spaces) then use this variable with your concatenate statement.

Rgds,

Bujji

Read only

Former Member
0 Likes
919

Hi ,

Check this sample code.

********************************************************

DATA:

a(3) TYPE c VALUE 'ABC',

b(3) type c VALUE 'XYZ',

c(3) TYPE c VALUE ' ',

d(9) type c.

CONCATENATE A C B INTO d RESPECTING BLANKS.

write: / d.

********************************************************

Hope this is helpful to you. If you need further information, revert back.

Reward all the helpful answers.

Regards

Nagaraj T

Read only

anub
Participant
0 Likes
919

Hi,

Use the below code.

DATA: A(5) TYPE C,

B(5) TYPE C,

C(3) TYPE C,

D(20) type c.

A = 'ABC'.

B = 'XYZ' .

C = ' '.

CONCATENATE A C B INTO D respecting blanks.

WRITE:/ D.

Reward if useful.

Regards,

Anu,