<?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: read table inside a loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474103#M1417784</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;please see this ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_itab1 INTO wa_itab1.
READ TABLE it_itab2 INTO wa_itab2
WITH KEY glla = wa_itab1-glia
cctrla = wa_itab1-cctria
anln1 = wa_itab1-anln1
anln2 = wa_itab1-anln2.
IF sy-subrc = 0.
---
--
endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Jan 2010 10:21:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-01-18T10:21:37Z</dc:date>
    <item>
      <title>read table inside a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474096#M1417777</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 would like to seek advice on this.&lt;/P&gt;&lt;P&gt;I have 2 internal table as below. The problem is although i have the same set of data in both internal table but &lt;/P&gt;&lt;P&gt;why sy-subrc still returns 4. I found out anln2 map to different ones. Why read table not able to pick the same anln2 even though it has the same value of anln2 in itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_itab1 INTO wa_itab1.&lt;/P&gt;&lt;P&gt;    READ TABLE it_itab2 INTO wa_itab2&lt;/P&gt;&lt;P&gt;                              WITH KEY glla   = wa_itab2-glia&lt;/P&gt;&lt;P&gt;                                       cctrla = wa_itab2-cctria&lt;/P&gt;&lt;P&gt;                                       anln1  = wa_itab2-anln1&lt;/P&gt;&lt;P&gt;                                       anln2  = wa_itab2-anln2.&lt;/P&gt;&lt;P&gt;   IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2010 10:11:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474096#M1417777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-18T10:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: read table inside a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474097#M1417778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Please check the below code&lt;/P&gt;&lt;P&gt;same as urs but small mofications&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi,&lt;/P&gt;&lt;P&gt;&amp;gt; I would like to seek advice on this.&lt;/P&gt;&lt;P&gt;&amp;gt; I have 2 internal table as below. The problem is although i have the same set of data in both internal table but &lt;/P&gt;&lt;P&gt;&amp;gt; why sy-subrc still returns 4. I found out anln2 map to different ones. Why read table not able to pick the same anln2 even though it has the same value of anln2 in itab2.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; LOOP AT it_itab1 INTO wa_itab1.&lt;/P&gt;&lt;P&gt;&amp;gt;     READ TABLE it_itab2 INTO wa_itab2&lt;/P&gt;&lt;P&gt;&amp;gt;                               WITH KEY glla   = wa_itab1-glia&lt;/P&gt;&lt;P&gt;&amp;gt;                                        cctrla = wa_itab2-cctria&lt;/P&gt;&lt;P&gt;&amp;gt;                                        anln1  = wa_itab2-anln1&lt;/P&gt;&lt;P&gt;&amp;gt;                                        anln2  = wa_itab2-anln2.&lt;/P&gt;&lt;P&gt;&amp;gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&amp;gt;    &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Thanks&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_itab1 INTO wa_itab1.
    READ TABLE it_itab2 INTO wa_itab2
                             WITH KEY glla   = wa_itab1-glia
IF sy-subrc = 0.
                                        cctrla = wa_itab1-cctria
                                        anln1  = wa_itab1-anln1
                                        anln2  = wa_itab1-anln2.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Surendra P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2010 10:14:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474097#M1417778</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-18T10:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: read table inside a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474098#M1417779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
READ TABLE it_itab2 INTO wa_itab2
WITH KEY glla = wa_itab1-glia " wa_itab1 instead of wa_itab2
cctrla = wa_itab1-cctria
anln1 = wa_itab1-anln1
anln2 = wa_itab1-anln2.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2010 10:14:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474098#M1417779</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-18T10:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: read table inside a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474099#M1417780</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;PRE&gt;&lt;CODE&gt;cctrla = wa_itab2-cctria&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;SPAN __default_attr="red" __jive_macro_name="color"&gt; -&lt;/SPAN&gt;&lt;/P&gt;&lt;HR originaltext="---" /&gt;&amp;gt; are these the same or sy-subrc = 4 is because of this&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and most importantly it must be wa_tab1 in the compare fields...&lt;/P&gt;&lt;P&gt; not wa_tab2&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Abhijit G. Borkar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2010 10:16:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474099#M1417780</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-18T10:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: read table inside a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474100#M1417781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;The reason behind the unsucessful READ is that you are having a loop in ITAB1. So in that loop for any READ statement you should use work area of ITAB1 in KEY addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you are looping in ITAB1 but using the work area of ITAB2 (which is not yet populated) . Hence SY-SUBRC always return the valu 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nikhil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2010 10:18:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474100#M1417781</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-18T10:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: read table inside a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474101#M1417782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;WITH KEY glla = wa_itab2-glia
cctrla = wa_itab2-cctria
anln1 = wa_itab2-anln1
anln2 = wa_itab2-anln2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;change this  itab2 in with key to itab1.. how can you read a work area data which is not yet filled??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WITH KEY glla = wa_itab1-glia " i am just making it as itab1 inplace of itab2
cctrla = wa_itab1-cctria
anln1 = wa_itab1-anln1
anln2 = wa_itab1-anln2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2010 10:18:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474101#M1417782</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-18T10:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: read table inside a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474102#M1417783</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;please replace &lt;/P&gt;&lt;P&gt;WITH KEY glla = wa_itab2-glia&lt;/P&gt;&lt;P&gt;cctrla = wa_itab2-cctria&lt;/P&gt;&lt;P&gt;anln1 = wa_itab2-anln1&lt;/P&gt;&lt;P&gt;anln2 = wa_itab2-anln2.&lt;/P&gt;&lt;P&gt;BY&lt;/P&gt;&lt;P&gt;WITH KEY glla = wa_itab1-glia&lt;/P&gt;&lt;P&gt;cctrla = wa_itab1-cctria&lt;/P&gt;&lt;P&gt;anln1 = wa_itab1-anln1&lt;/P&gt;&lt;P&gt;anln2 = wa_itab1-anln2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The values in wa_itab2 are intial before read. You need to use wa_itab1 which have the values after looping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will help you...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2010 10:19:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474102#M1417783</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-18T10:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: read table inside a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474103#M1417784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;please see this ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_itab1 INTO wa_itab1.
READ TABLE it_itab2 INTO wa_itab2
WITH KEY glla = wa_itab1-glia
cctrla = wa_itab1-cctria
anln1 = wa_itab1-anln1
anln2 = wa_itab1-anln2.
IF sy-subrc = 0.
---
--
endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2010 10:21:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474103#M1417784</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-18T10:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: read table inside a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474104#M1417785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it's just your spelling mistake&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2010 10:30:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-inside-a-loop/m-p/6474104#M1417785</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-18T10:30:22Z</dc:date>
    </item>
  </channel>
</rss>

