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
590

Hi,

I am trying to concatenate 22 fields of an ITAB into another single field of ITAB1 ,... all the fields seperated by | (pipe symbol).

Can anyone tell me if this is the only way I can do it or is there any simple way.

<b>loop at itab into wa.

concatenate wa-f1 wa-f2......wa-f22 into itab1 seperated by '|' .

  • ( DO I HAVE TO WRITE AN APPEND FOR ITAB1 ? )

endloop.</b>

Thanks in advance?

Message was edited by:

ramana peddu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
561

Hi,

Using the concatenate statement is the simple way and please try this.


loop at itab into wa.
  concatenate wa-f1 wa-f2......wa-f22 into itab1-field1 seperated by '|' .
  append itab1.
endloop.

or


data: wa_string type string.

loop at itab into wa.
  concatenate wa-f1 wa-f2......wa-f22 into wa_string   seperated by '|' .
  append wa_string to itab.
endloop.

Regards,

Ferry Lianto

Hi,

Using the concatenate statement is the simple way and please try this.


loop at itab into wa.
  concatenate wa-f1 wa-f2......wa-f22 into itab1-field1 seperated by '|' .
  append itab1.
endloop.

or


data: wa_string type string.

loop at itab into wa.
  concatenate wa-f1 wa-f2......wa-f22 into wa_string   seperated by '|' .
  append wa_string to itab.
endloop.

Regards,

Ferry Lianto

3 REPLIES 3
Read only

Former Member
0 Likes
562

Hi,

Using the concatenate statement is the simple way and please try this.


loop at itab into wa.
  concatenate wa-f1 wa-f2......wa-f22 into itab1-field1 seperated by '|' .
  append itab1.
endloop.

or


data: wa_string type string.

loop at itab into wa.
  concatenate wa-f1 wa-f2......wa-f22 into wa_string   seperated by '|' .
  append wa_string to itab.
endloop.

Regards,

Ferry Lianto

Read only

raja_thangamani
Active Contributor
0 Likes
561

This is the simple way to do..

<i>* Reward each useful asnwer</i>

Raja T

Read only

Former Member
0 Likes
561

Hey hii

This is the simplest method available. please use following for code efficiency.

data: wa_string type (data_element name of itab1-fieldname).

loop at itab into wa.

concatenate wa-f1 wa-f2......wa-f22 into wa_string seperated by '|' .

append wa_string to itab.

endloop.

by declaring the type as data element, it will not arise any inconsistency issue later.

Reward if u find it useful.

bbye tac care

Ashwani