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

Former Member
0 Likes
959

Hi,

Below is my final internal table iam getting the data here.

data : begin of itab occurs 0,

field1(10) type c,

field2(10) type c,

field3(10) type c,

field4(10) type c,

end of itab.

data : v_wa(500) type c. "work area

field1 has value 100

field2 has value 200

field3 has value 300

field4 has value 400

My final output should look like this.

100#200#300#400.

please suggest.

Thanks

Vikranth Khimavath

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
936

Loop at itab.

<b>concatenate itab-field1 itab-field2 itab-field3 itab-field4 into v_wa separated by '#'.</b>

write v_wa.

Endloop.

Message was edited by:

Dominic Pappaly

8 REPLIES 8
Read only

Former Member
0 Likes
937

Loop at itab.

<b>concatenate itab-field1 itab-field2 itab-field3 itab-field4 into v_wa separated by '#'.</b>

write v_wa.

Endloop.

Message was edited by:

Dominic Pappaly

Read only

0 Likes
936

Hi Dominic,

my ouput should look like this

100#200#300#400

no this way

100 200 300 400

Thanks

Vikranth khimavath

Read only

0 Likes
936

Yes that is why we have the 'separated by' extension of the statement.

This will concatenate the field values into v_wa and put'#' in between.

Please check out .

Read only

0 Likes
936

Thanks Dominic its working fine.

Read only

Former Member
0 Likes
936

Hi,

Try this..

Loop at itab.

<b>concatenate itab-field1'#' itab-field2 '#'itab-field3 '#'itab-field4 into v_wa separated by space.</b>

write v_wa.

Endloop.

reward if useful..

Regards,

Ajith

Read only

Former Member
0 Likes
936

Hi

Use the floowing :

DATA: lw_itab LIKE LINE OF itab.

DATA: l_data(100) type c .

Loop at itab into LW_ITAB.

concatenate LW_ITAB-field1 LW_ITAB-field2 LW_ITAB-field3 LW_ITAB-field4

into l_data separated by '#'.

Endloop.

If sounds good pl reward.

Cheers.

Read only

Former Member
0 Likes
936

just execute the code

data : begin of itab occurs 0,
field1(10) type c,
field2(10) type c,
field3(10) type c,
field4(10) type c,
end of itab.
data: str(50) type c.
data mrk type c value '#'.
itab-field1 = 100.
itab-field2 = 200.
itab-field3 = 300.
itab-field4 = 400.


condense :itab-field1,
         itab-field2,
         itab-field3,
         itab-field4.

concatenate itab-field1
itab-field2
itab-field3
itab-field4
into str
separated by mrk.


 condense str.

 write:/ str .

regards,

vijay

Read only

Former Member
0 Likes
936

Each of the fileds in your final table is 10 bytes long, but your values are only 3. So what happens to the spaces? Do you want the results left or right justified? Or do you want the spaces removed?

Rob