<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to loop through internal table column wise. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968329#M69077</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vicky, you can try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty,&lt;/P&gt;&lt;P&gt;col1(2),&lt;/P&gt;&lt;P&gt;col2(2),&lt;/P&gt;&lt;P&gt;col3(2),&lt;/P&gt;&lt;P&gt;col4(2),&lt;/P&gt;&lt;P&gt;end of ty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty1,&lt;/P&gt;&lt;P&gt;col1(2),&lt;/P&gt;&lt;P&gt;end of ty1.&lt;/P&gt;&lt;P&gt;data itab1 type standard table of ty1 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty2,&lt;/P&gt;&lt;P&gt;col2(2),&lt;/P&gt;&lt;P&gt;end of ty2.&lt;/P&gt;&lt;P&gt;data itab2 type standard table of ty2 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty3,&lt;/P&gt;&lt;P&gt;col3(2),&lt;/P&gt;&lt;P&gt;end of ty3.&lt;/P&gt;&lt;P&gt;data itab3 type standard table of ty3 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty4,&lt;/P&gt;&lt;P&gt;col4(2),&lt;/P&gt;&lt;P&gt;end of ty4.&lt;/P&gt;&lt;P&gt;data itab4 type standard table of ty4 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab type standard table of ty with header line,&lt;/P&gt;&lt;P&gt;wa type ty,&lt;/P&gt;&lt;P&gt;s1(100),&lt;/P&gt;&lt;P&gt;s2(100),&lt;/P&gt;&lt;P&gt;s3(100),&lt;/P&gt;&lt;P&gt;s4(100),&lt;/P&gt;&lt;P&gt;s type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa-col1 = 'a1'.&lt;/P&gt;&lt;P&gt;  wa-col2 = 'a2'.&lt;/P&gt;&lt;P&gt;    wa-col3 = 'a3'.&lt;/P&gt;&lt;P&gt;      wa-col4 = 'a4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'b1'.&lt;/P&gt;&lt;P&gt;  wa-col2 = 'b2'.&lt;/P&gt;&lt;P&gt;    wa-col3 = 'b3'.&lt;/P&gt;&lt;P&gt;      wa-col4 = 'b4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'c1'.&lt;/P&gt;&lt;P&gt;  wa-col2 = 'c2'.&lt;/P&gt;&lt;P&gt;    wa-col3 = 'c3'.&lt;/P&gt;&lt;P&gt;      wa-col4 = 'c4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'a1'.&lt;/P&gt;&lt;P&gt;  wa-col2 = 'b2'.&lt;/P&gt;&lt;P&gt;    wa-col3 = 'c3'.&lt;/P&gt;&lt;P&gt;      wa-col4 = 'a4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Decompose itab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  move itab-col1 to itab1-col1.&lt;/P&gt;&lt;P&gt;  move itab-col2 to itab2-col2.&lt;/P&gt;&lt;P&gt;  move itab-col3 to itab3-col3.&lt;/P&gt;&lt;P&gt;  move itab-col4 to itab4-col4.&lt;/P&gt;&lt;P&gt;  append itab1.&lt;/P&gt;&lt;P&gt;  append itab2.&lt;/P&gt;&lt;P&gt;  append itab3.&lt;/P&gt;&lt;P&gt;  append itab4.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab1 .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab1 .&lt;/P&gt;&lt;P&gt;sort itab2 .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab2 .&lt;/P&gt;&lt;P&gt;sort itab3 .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab3 .&lt;/P&gt;&lt;P&gt;sort itab4 .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab4 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;  if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;    s1 = itab1-col1.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    concatenate s1 itab1-col1 into s1.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;loop at itab2.&lt;/P&gt;&lt;P&gt;  if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;    s2 = itab2-col2.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    concatenate s2 itab2-col2 into s2.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;loop at itab3.&lt;/P&gt;&lt;P&gt;  if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;    s3 = itab3-col3.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    concatenate s3 itab3-col3 into s3.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;loop at itab4.&lt;/P&gt;&lt;P&gt;  if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;    s4 = itab4-col4.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    concatenate s4 itab4-col4 into s4.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write:/ s1, / s2, / s3 , / s4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Andrej.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Jul 2005 02:17:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-07-13T02:17:28Z</dc:date>
    <item>
      <title>how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968323#M69071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an issue of looping through an internal table - column wise, leaving duplicate values.  Let me explain clearly as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an internal table with four coloumns - col1, col2, col3, col4.  Each column will have values - may include duplicates.  &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;col1    col2     col3     col4&lt;/P&gt;&lt;P&gt;_______________________________&lt;/P&gt;&lt;P&gt;a1       a2       a3       a4&lt;/P&gt;&lt;P&gt;b1       b2       b3       b4&lt;/P&gt;&lt;P&gt;c1       c2       c3       c4&lt;/P&gt;&lt;P&gt;a1       a2       a3       a4&lt;/P&gt;&lt;P&gt;_______________________________&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to loop through above internal table, and get the values in the following form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;col1=a1&amp;amp;b1&amp;amp;c1&lt;/P&gt;&lt;P&gt;col2=a2&amp;amp;b2&amp;amp;c2&lt;/P&gt;&lt;P&gt;col3=a3&amp;amp;b3&amp;amp;c3&lt;/P&gt;&lt;P&gt;col4=a4&amp;amp;b4&amp;amp;c4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;finally I must put all this values into a string value as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data :  strvalue type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;strvalue = col1=a1&amp;amp;b1&amp;amp;c1;col2=a2&amp;amp;b2&amp;amp;c2;col3=a3&amp;amp;b3&amp;amp;c3;col4=a4&amp;amp;b4&amp;amp;c4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody help me as to how to go about this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Vicky.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2005 20:33:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968323#M69071</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-11T20:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968324#M69072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Vicky,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can decompose data of your internal table. You can create 4 internal tables with types col1, col2, col3 and col4 and then copy your data in this tables. Then 'DELETE ADJACENT DUPLICATES FROM itab' for each internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Andrej&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2005 01:13:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968324#M69072</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-12T01:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968325#M69073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vicky,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not clear from your explanation whether the internal table will have duplicate rows or duplicate values just for certain columns. for example, is it possible that you have -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;a1  a2  a3  a4
b1  a2  b3  a4
c1  c2  b3  c4
a1  a2  b3  c4&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If yes, then do you require to capture only the distince values for each column ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or as you have mentioned you will have duplicates only for the entire row ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandalika.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2005 03:52:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968325#M69073</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-12T03:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968326#M69074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty,&lt;/P&gt;&lt;P&gt;        col1(2),&lt;/P&gt;&lt;P&gt;        col2(2),&lt;/P&gt;&lt;P&gt;        col3(2),&lt;/P&gt;&lt;P&gt;        col4(2),&lt;/P&gt;&lt;P&gt;        end of ty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab type standard table of ty,&lt;/P&gt;&lt;P&gt;       wa type ty,&lt;/P&gt;&lt;P&gt;       s1(100),&lt;/P&gt;&lt;P&gt;       s2(100),&lt;/P&gt;&lt;P&gt;       s3(100),&lt;/P&gt;&lt;P&gt;       s4(100),&lt;/P&gt;&lt;P&gt;       s type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa-col1 = 'a1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'a2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'a3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'a4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'b1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'b2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'b3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'b4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'c1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'c2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'c3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'c4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'a1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'a2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'a3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'a4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;s1 = wa-col1.&lt;/P&gt;&lt;P&gt;s2 = wa-col2.&lt;/P&gt;&lt;P&gt;s3 = wa-col3.&lt;/P&gt;&lt;P&gt;s4 = wa-col4.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;concatenate s1 wa-col1 into s1.&lt;/P&gt;&lt;P&gt;concatenate s2 wa-col2 into s2.&lt;/P&gt;&lt;P&gt;concatenate s3 wa-col3 into s3.&lt;/P&gt;&lt;P&gt;concatenate s4 wa-col4 into s4.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;concatenate s1 s2 s3 s4 into s.&lt;/P&gt;&lt;P&gt;write s.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;a1b1c1a2b2c2a3b3c3a4b4c4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want ; and = in output,&lt;/P&gt;&lt;P&gt;just modify the following statement accordingly.&lt;/P&gt;&lt;P&gt;concatenate s1 s2 s3 s4 into s.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.Kindly reward points if so.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2005 04:01:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968326#M69074</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-07-12T04:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968327#M69075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;      I think we can move all the column values to the single internal table with single column by this we can delete even the duplicate values in the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     Sample Code.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          data : begin of itab2 occurs 0 with headerline,&lt;/P&gt;&lt;P&gt;                   singlecol(2),&lt;/P&gt;&lt;P&gt;                 end of itab2,&lt;/P&gt;&lt;P&gt;                 s type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          loop at itab.&lt;/P&gt;&lt;P&gt;               itab2-singlecol = itab-col1.&lt;/P&gt;&lt;P&gt;               append itab2.&lt;/P&gt;&lt;P&gt;               itab2-singlecol = itab-col2.&lt;/P&gt;&lt;P&gt;               append itab2.&lt;/P&gt;&lt;P&gt;               itab2-singlecol = itab-col3.&lt;/P&gt;&lt;P&gt;               append itab2.&lt;/P&gt;&lt;P&gt;               itab2-singlecol = itab-col4.&lt;/P&gt;&lt;P&gt;               append itab2.&lt;/P&gt;&lt;P&gt;          endloop.&lt;/P&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;          sort table itab2.&lt;/P&gt;&lt;P&gt;             &lt;/P&gt;&lt;P&gt;          delete adjecent duplicates from itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          loop at itab2.&lt;/P&gt;&lt;P&gt;              concatenate s itab2-stringcol into s.&lt;/P&gt;&lt;P&gt;          endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     I think this will be useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2005 05:36:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968327#M69075</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-12T05:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968328#M69076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks a lot for your helpful answers.  I assigned points to everybody.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jayanthi, your answer has almost solved my problem.  But there is one more issue.  As Jayanthi pointed out, I have to remove duplicate values from columns, not necessarily the duplicates are row wise.   So, Jayanthi, how do I select distinct values from columns in your solution?  Anand, if you have any idea regarding the same, please post it.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you once again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Vicky.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2005 14:50:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968328#M69076</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-12T14:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968329#M69077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vicky, you can try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty,&lt;/P&gt;&lt;P&gt;col1(2),&lt;/P&gt;&lt;P&gt;col2(2),&lt;/P&gt;&lt;P&gt;col3(2),&lt;/P&gt;&lt;P&gt;col4(2),&lt;/P&gt;&lt;P&gt;end of ty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty1,&lt;/P&gt;&lt;P&gt;col1(2),&lt;/P&gt;&lt;P&gt;end of ty1.&lt;/P&gt;&lt;P&gt;data itab1 type standard table of ty1 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty2,&lt;/P&gt;&lt;P&gt;col2(2),&lt;/P&gt;&lt;P&gt;end of ty2.&lt;/P&gt;&lt;P&gt;data itab2 type standard table of ty2 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty3,&lt;/P&gt;&lt;P&gt;col3(2),&lt;/P&gt;&lt;P&gt;end of ty3.&lt;/P&gt;&lt;P&gt;data itab3 type standard table of ty3 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty4,&lt;/P&gt;&lt;P&gt;col4(2),&lt;/P&gt;&lt;P&gt;end of ty4.&lt;/P&gt;&lt;P&gt;data itab4 type standard table of ty4 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab type standard table of ty with header line,&lt;/P&gt;&lt;P&gt;wa type ty,&lt;/P&gt;&lt;P&gt;s1(100),&lt;/P&gt;&lt;P&gt;s2(100),&lt;/P&gt;&lt;P&gt;s3(100),&lt;/P&gt;&lt;P&gt;s4(100),&lt;/P&gt;&lt;P&gt;s type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa-col1 = 'a1'.&lt;/P&gt;&lt;P&gt;  wa-col2 = 'a2'.&lt;/P&gt;&lt;P&gt;    wa-col3 = 'a3'.&lt;/P&gt;&lt;P&gt;      wa-col4 = 'a4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'b1'.&lt;/P&gt;&lt;P&gt;  wa-col2 = 'b2'.&lt;/P&gt;&lt;P&gt;    wa-col3 = 'b3'.&lt;/P&gt;&lt;P&gt;      wa-col4 = 'b4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'c1'.&lt;/P&gt;&lt;P&gt;  wa-col2 = 'c2'.&lt;/P&gt;&lt;P&gt;    wa-col3 = 'c3'.&lt;/P&gt;&lt;P&gt;      wa-col4 = 'c4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'a1'.&lt;/P&gt;&lt;P&gt;  wa-col2 = 'b2'.&lt;/P&gt;&lt;P&gt;    wa-col3 = 'c3'.&lt;/P&gt;&lt;P&gt;      wa-col4 = 'a4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Decompose itab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  move itab-col1 to itab1-col1.&lt;/P&gt;&lt;P&gt;  move itab-col2 to itab2-col2.&lt;/P&gt;&lt;P&gt;  move itab-col3 to itab3-col3.&lt;/P&gt;&lt;P&gt;  move itab-col4 to itab4-col4.&lt;/P&gt;&lt;P&gt;  append itab1.&lt;/P&gt;&lt;P&gt;  append itab2.&lt;/P&gt;&lt;P&gt;  append itab3.&lt;/P&gt;&lt;P&gt;  append itab4.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab1 .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab1 .&lt;/P&gt;&lt;P&gt;sort itab2 .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab2 .&lt;/P&gt;&lt;P&gt;sort itab3 .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab3 .&lt;/P&gt;&lt;P&gt;sort itab4 .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab4 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;  if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;    s1 = itab1-col1.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    concatenate s1 itab1-col1 into s1.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;loop at itab2.&lt;/P&gt;&lt;P&gt;  if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;    s2 = itab2-col2.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    concatenate s2 itab2-col2 into s2.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;loop at itab3.&lt;/P&gt;&lt;P&gt;  if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;    s3 = itab3-col3.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    concatenate s3 itab3-col3 into s3.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;loop at itab4.&lt;/P&gt;&lt;P&gt;  if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;    s4 = itab4-col4.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    concatenate s4 itab4-col4 into s4.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write:/ s1, / s2, / s3 , / s4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Andrej.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 02:17:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968329#M69077</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T02:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968330#M69078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how about this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF tab OCCURS 0,&lt;/P&gt;&lt;P&gt;        c1(2),&lt;/P&gt;&lt;P&gt;        c2(2),&lt;/P&gt;&lt;P&gt;        c3(2),&lt;/P&gt;&lt;P&gt;        c4(2),&lt;/P&gt;&lt;P&gt;      END OF tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: str1(100) TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;write:/ 'Internal Table TAB'.&lt;/P&gt;&lt;P&gt;write:/(18) sy-uline.&lt;/P&gt;&lt;P&gt;tab-c1 = '11'.    tab-c2 = '12'. &lt;/P&gt;&lt;P&gt;tab-c3 = '13'.    tab-c4 = '14'. append tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tab-c1 = '21'.    tab-c2 = '22'. &lt;/P&gt;&lt;P&gt;tab-c3 = '23'.    tab-c4 = '24'. append tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tab-c1 = '31'.    tab-c2 = '32'. &lt;/P&gt;&lt;P&gt;tab-c3 = '33'.    tab-c4 = '34'. append tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tab-c1 = '11'.    tab-c2 = '12'. &lt;/P&gt;&lt;P&gt;tab-c3 = '13'.    tab-c4 = '34'. append tab.&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;  perform write_tab tables tab.&lt;/P&gt;&lt;P&gt;  write:/(18) sy-uline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SORT tab BY c1.&lt;/P&gt;&lt;P&gt;  delete adjacent duplicates from tab comparing c1.&lt;/P&gt;&lt;P&gt;  LOOP AT tab.&lt;/P&gt;&lt;P&gt;    AT NEW c1.&lt;/P&gt;&lt;P&gt;      CONCATENATE str1 tab-c1 INTO str1.&lt;/P&gt;&lt;P&gt;    ENDAT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  CONCATENATE str1 ' - ' INTO str1.&lt;/P&gt;&lt;P&gt;       :&lt;/P&gt;&lt;P&gt;  SORT tab BY c4.&lt;/P&gt;&lt;P&gt;  delete adjacent duplicates from tab comparing c4.&lt;/P&gt;&lt;P&gt;  LOOP AT tab.&lt;/P&gt;&lt;P&gt;    AT NEW c4.&lt;/P&gt;&lt;P&gt;      CONCATENATE str1 tab-c4 INTO str1.&lt;/P&gt;&lt;P&gt;    ENDAT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  skip.&lt;/P&gt;&lt;P&gt;  write:/ 'String -&amp;gt;', str1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM write_tab TABLES   p STRUCTURE tab.&lt;/P&gt;&lt;P&gt;  loop at p.&lt;/P&gt;&lt;P&gt;    write:/(3) p-c1, (1) '' no-gap,&lt;/P&gt;&lt;P&gt;           (3) p-c2, (1) '' no-gap,&lt;/P&gt;&lt;P&gt;           (3) p-c3, (1) '' no-gap,&lt;/P&gt;&lt;P&gt;           (3) p-c4.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " write_tab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OUTPUT&lt;/P&gt;&lt;P&gt;======&lt;/P&gt;&lt;P&gt;Internal Table TAB&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------" /&gt;&lt;P&gt;11   12   13   14&lt;/P&gt;&lt;P&gt;21   22   23   24&lt;/P&gt;&lt;P&gt;31   32   33   34&lt;/P&gt;&lt;P&gt;11   12   13   34&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;String -&amp;gt; 112131 -122232 -132333 -142434&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 03:23:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968330#M69078</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T03:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968331#M69079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use &amp;lt;b&amp;gt;search&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty,&lt;/P&gt;&lt;P&gt;col1(2),&lt;/P&gt;&lt;P&gt;col2(2),&lt;/P&gt;&lt;P&gt;col3(2),&lt;/P&gt;&lt;P&gt;col4(2),&lt;/P&gt;&lt;P&gt;end of ty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab type standard table of ty,&lt;/P&gt;&lt;P&gt;wa type ty,&lt;/P&gt;&lt;P&gt;s1(100),&lt;/P&gt;&lt;P&gt;s2(100),&lt;/P&gt;&lt;P&gt;s3(100),&lt;/P&gt;&lt;P&gt;s4(100),&lt;/P&gt;&lt;P&gt;s type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa-col1 = 'a1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'a2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'a3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'a4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'b1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'b2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'b3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'b4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'c1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'c2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'c3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'c4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'a1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'b2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'c3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'a4'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;s1 = wa-col1.&lt;/P&gt;&lt;P&gt;s2 = wa-col2.&lt;/P&gt;&lt;P&gt;s3 = wa-col3.&lt;/P&gt;&lt;P&gt;s4 = wa-col4.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;  search s1 for wa-col1.&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    concatenate s1 wa-col1 into s1.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  search s2 for wa-col2.&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    concatenate s2 wa-col2 into s2.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  search s3 for wa-col3.&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    concatenate s3 wa-col3 into s3.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  search s4 for wa-col4.&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    concatenate s4 wa-col4 into s4.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;concatenate s1 s2 s3 s4 into s.&lt;/P&gt;&lt;P&gt;write s.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;a1b1c1a2b2c2a3b3c3a4b4c4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 03:50:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968331#M69079</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-07-13T03:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968332#M69080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrej, Jayanthi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks to both of you for your ideas.  It helped me a lot.  I already assigned points for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have one more thing with me.  Now that in my internal table I mentioned about only four  columns, and I got the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; But if my internal table contains more than four columns, and if I want to select only four columns which we discussed, then how do I do so? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I mean to say:  the internal table contains Col1, Col2, Col3, Col4, Col5, Col6.  And my interest is only to get the values of Col1, Col2, Col3, Col4.  How do loop through only these four columns and track their values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Vicky.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 14:30:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968332#M69080</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T14:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968333#M69081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Vicky,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it is unimportant how many columns in your internal table.&lt;/P&gt;&lt;P&gt;I think our methods will work anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. Or I don't understand something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Andrej.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2005 03:26:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968333#M69081</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-14T03:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to loop through internal table column wise.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968334#M69082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It doesn't matter how many columns you have.&lt;/P&gt;&lt;P&gt;Here is the sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty,&lt;/P&gt;&lt;P&gt;col1(2),&lt;/P&gt;&lt;P&gt;col2(2),&lt;/P&gt;&lt;P&gt;col3(2),&lt;/P&gt;&lt;P&gt;col4(2),&lt;/P&gt;&lt;P&gt;col5(2),&lt;/P&gt;&lt;P&gt;col6(2),&lt;/P&gt;&lt;P&gt;end of ty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab type standard table of ty,&lt;/P&gt;&lt;P&gt;wa type ty,&lt;/P&gt;&lt;P&gt;s1(100),&lt;/P&gt;&lt;P&gt;s2(100),&lt;/P&gt;&lt;P&gt;s3(100),&lt;/P&gt;&lt;P&gt;s4(100),&lt;/P&gt;&lt;P&gt;s type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa-col1 = 'a1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'a2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'a3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'a4'.&lt;/P&gt;&lt;P&gt;wa-col5 = 'a5'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'b1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'b2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'b3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'b4'.&lt;/P&gt;&lt;P&gt;wa-col5 = 'b5'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'c1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'c2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'c3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'c4'.&lt;/P&gt;&lt;P&gt;wa-col5 = 'c5'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;wa-col1 = 'a1'.&lt;/P&gt;&lt;P&gt;wa-col2 = 'b2'.&lt;/P&gt;&lt;P&gt;wa-col3 = 'c3'.&lt;/P&gt;&lt;P&gt;wa-col4 = 'a4'.&lt;/P&gt;&lt;P&gt;wa-col5 = 'b5'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab .&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;if sy-tabix eq 1.&lt;/P&gt;&lt;P&gt;s1 = wa-col1.&lt;/P&gt;&lt;P&gt;s2 = wa-col2.&lt;/P&gt;&lt;P&gt;s3 = wa-col3.&lt;/P&gt;&lt;P&gt;s4 = wa-col4.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;search s1 for wa-col1.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;concatenate s1 wa-col1 into s1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;search s2 for wa-col2.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;concatenate s2 wa-col2 into s2.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;search s3 for wa-col3.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;concatenate s3 wa-col3 into s3.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;search s4 for wa-col4.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;concatenate s4 wa-col4 into s4.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;concatenate s1 s2 s3 s4 into s.&lt;/P&gt;&lt;P&gt;write s.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.If so,kindly reward points and close the thread.If you need more clarifications,get back.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2005 03:56:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-through-internal-table-column-wise/m-p/968334#M69082</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-07-14T03:56:45Z</dc:date>
    </item>
  </channel>
</rss>

