<?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: Loop Query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692983#M304186</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Loop thro the first internal table first and concatenate the values into a string.&lt;/P&gt;&lt;P&gt;Then loop thro the second table and assign column 4 to this string for all the records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Meera&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Nov 2006 07:58:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-17T07:58:10Z</dc:date>
    <item>
      <title>Loop Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692982#M304185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             I have a small problem .&lt;/P&gt;&lt;P&gt;My scenario is like this:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1, Say I have an internal table with 4 columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;columns-&amp;gt;      C1                 C2                  C3                 C4&lt;/P&gt;&lt;P&gt;Row1-&amp;gt;          A                   a                      1                   - (empty)&lt;/P&gt;&lt;P&gt;Row2 -&amp;gt;         B                   b                      2                   -&lt;/P&gt;&lt;P&gt;Row3-&amp;gt;          C                   c                      3                   -&lt;/P&gt;&lt;P&gt;Row4-&amp;gt;          D                   d                      2                   -&lt;/P&gt;&lt;P&gt;Row5-&amp;gt;          E                   e                      5                   -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2, Now I need to do a manipulation such that in each row the C4 must contain the concatenated values of column C3 separated by  "," and should not repeat i.e say the column C3 contains the number 2 more than once then the string in column C4 must not conatain this number  "2"  twice.&lt;/P&gt;&lt;P&gt;I.e my output should be :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;columns-&amp;gt;      C1                 C2                  C3                     C4&lt;/P&gt;&lt;P&gt;Row1-&amp;gt;          A                   a                      1                   1,2,3,5&lt;/P&gt;&lt;P&gt;Row2-&amp;gt;          B                   b                      2                   1,2,3,5&lt;/P&gt;&lt;P&gt;Row3-&amp;gt;          C                   c                      3                   1,2,3,5&lt;/P&gt;&lt;P&gt;Row4-&amp;gt;          D                   d                      2                   1,2,3,5&lt;/P&gt;&lt;P&gt;Row5-&amp;gt;          E                   e                      5                   1,2,3,5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anyone help me out in acheiving this  ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;waiting for ur reply................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2006 07:33:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692982#M304185</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-17T07:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692983#M304186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Loop thro the first internal table first and concatenate the values into a string.&lt;/P&gt;&lt;P&gt;Then loop thro the second table and assign column 4 to this string for all the records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Meera&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2006 07:58:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692983#M304186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-17T07:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692984#M304187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For eg:&lt;/P&gt;&lt;P&gt;c_comma has the value ','.&lt;/P&gt;&lt;P&gt;l_value is defined as a string. It can be a maximum of only 255 characters/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at int_tab1.&lt;/P&gt;&lt;P&gt;concatenate l_value c_comma l_col3 into l_value.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at int_tab2.&lt;/P&gt;&lt;P&gt;l_col4 = l_value.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;MEera&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2006 08:04:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692984#M304187</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-17T08:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692985#M304188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Deepu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do something like this.  Check if this logic works.&lt;/P&gt;&lt;P&gt;declare a variable g_var.&lt;/P&gt;&lt;P&gt;Loop at first itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab-c4 NE g_var.&lt;/P&gt;&lt;P&gt;concatenate itab-c4 into g_var.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read itab with key c1,c2,c3&lt;/P&gt;&lt;P&gt;modify itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2006 08:05:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692985#M304188</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-17T08:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692986#M304189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Deepu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the solution..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: begin of t_t occurs 0,&lt;/P&gt;&lt;P&gt;        c1(1),&lt;/P&gt;&lt;P&gt;        c2(1),&lt;/P&gt;&lt;P&gt;        c3(1),&lt;/P&gt;&lt;P&gt;        c4(10),&lt;/P&gt;&lt;P&gt;      end of t_t,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      begin of t_tt occurs 0,&lt;/P&gt;&lt;P&gt;        c3(1),&lt;/P&gt;&lt;P&gt;      end of t_tt,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_t(10).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_t-c1 = 'A'.&lt;/P&gt;&lt;P&gt;t_t-c2 = '2'.&lt;/P&gt;&lt;P&gt;t_t-c3 = '1'.&lt;/P&gt;&lt;P&gt;append t_t.&lt;/P&gt;&lt;P&gt;clear t_t.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_t-c1 = 'B'.&lt;/P&gt;&lt;P&gt;t_t-c2 = 'b'.&lt;/P&gt;&lt;P&gt;t_t-c3 = '2'.&lt;/P&gt;&lt;P&gt;append t_t.&lt;/P&gt;&lt;P&gt;clear t_t.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_t-c1 = 'C'.&lt;/P&gt;&lt;P&gt;t_t-c2 = 'c'.&lt;/P&gt;&lt;P&gt;t_t-c3 = '3'.&lt;/P&gt;&lt;P&gt;append t_t.&lt;/P&gt;&lt;P&gt;clear t_t.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_t-c1 = 'D'.&lt;/P&gt;&lt;P&gt;t_t-c2 = 'd'.&lt;/P&gt;&lt;P&gt;t_t-c3 = '2'.&lt;/P&gt;&lt;P&gt;append t_t.&lt;/P&gt;&lt;P&gt;clear t_t.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_t-c1 = 'E'.&lt;/P&gt;&lt;P&gt;t_t-c2 = 'e'.&lt;/P&gt;&lt;P&gt;t_t-c3 = '5'.&lt;/P&gt;&lt;P&gt;append t_t.&lt;/P&gt;&lt;P&gt;clear t_t.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_t.&lt;/P&gt;&lt;P&gt;  t_tt-c3 = t_t-c3.&lt;/P&gt;&lt;P&gt;  append t_tt.&lt;/P&gt;&lt;P&gt;  clear  t_tt.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort t_tt by c3.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from t_tt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_tt.&lt;/P&gt;&lt;P&gt;  if v_t is initial.&lt;/P&gt;&lt;P&gt;     v_t = t_tt-c3.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    concatenate v_t t_tt-c3 into v_t separated by ','.&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;loop at t_t.&lt;/P&gt;&lt;P&gt;  t_t-c4 = v_t.&lt;/P&gt;&lt;P&gt;  modify t_t transporting c4.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_t.&lt;/P&gt;&lt;P&gt;  write:/ t_t-c1, space, t_t-c2, space, t_t-c3, space, t_t-c4, space.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Anu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2006 08:24:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692986#M304189</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-17T08:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692987#M304190</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;       Thanks for all ur replies.&lt;/P&gt;&lt;P&gt;It helped me to solve my problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks friends. (; (; (;&lt;/P&gt;&lt;P&gt;Points are awarded (; (; (; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;PS: Sorry for my late reply.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        deepu k&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2006 09:43:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692987#M304190</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-21T09:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692988#M304191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;y&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2006 09:45:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-query/m-p/1692988#M304191</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-21T09:45:02Z</dc:date>
    </item>
  </channel>
</rss>

