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
905

Hello friends, I am having problem in concatenating.

Below is the code,

DATA : i_output TYPE n.

PARAMETER : id1(8).

INITIALIZATION.

IF sy-sysid = 'PRD'.

id1 = '00034665'.

ELSE.

id1 = '00034678'.

ENDIF.

CONCATENATE '010' id1 INTO i_output.

WRITE 😕 i_output.

Eg- for output,

01000034665.

ANy help on this will be appericiated.

Shejal Shetty.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
883

Hi,

I_output should be of type c.

Eg data I_output(20) .

Change your code as follows

DATA : i_output(20) TYPE C.

PARAMETER : id1(8).

INITIALIZATION.

IF sy-sysid = 'PRD'.

id1 = '00034665'.

ELSE.

id1 = '00034678'.

ENDIF.

start-of-selection.

CONCATENATE '010' id1 INTO i_output.

WRITE 😕 i_output.

Hope this helps.

8 REPLIES 8
Read only

Former Member
0 Likes
884

Hi,

I_output should be of type c.

Eg data I_output(20) .

Change your code as follows

DATA : i_output(20) TYPE C.

PARAMETER : id1(8).

INITIALIZATION.

IF sy-sysid = 'PRD'.

id1 = '00034665'.

ELSE.

id1 = '00034678'.

ENDIF.

start-of-selection.

CONCATENATE '010' id1 INTO i_output.

WRITE 😕 i_output.

Hope this helps.

Read only

0 Likes
883

Specify the size of i_output as described by Imtiaz.

Read only

0 Likes
883

Thanks Imtiaz and all,

Shejal Shetty.

Read only

Former Member
0 Likes
883

You need a START-OF-SELECTION. statement before your write statement.

Read only

Former Member
0 Likes
883

My problem for this post is i am not getting result in i_output.

Shejal.

Read only

Former Member
0 Likes
883

Hi Shejal,

i cannot see any problem?

Can you explane it.

regards, Dieter

Read only

Former Member
0 Likes
883

Declare I_OUTPUT iwth length 11.

data : i_output(11) type n.

Read only

Former Member
0 Likes
883

Hi Shejal,

try this:

REPORT ZGRO_TEST MESSAGE-ID ZZ.

*

<b>DATA : i_output(11) TYPE n.</b>

PARAMETER : id1(8).

INITIALIZATION.

IF sy-sysid = 'PRD'.

id1 = '00034665'.

ELSE.

id1 = '00034678'.

ENDIF.

<b>start-of-selection.</b>

*

CONCATENATE '010' id1 INTO i_output.

WRITE 😕 i_output.

Regards, Dieter