<?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: At first - Work area initialized in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234413#M1209786</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;loop at itab_1 into wa_1.
*  loop at itab_2 into wa_2 where matnr = wa_1-matnr.
  loop at itab_2 where matnr = wa_1-matnr.
    wa_2 = itab2.
    at first.
       wa_1-netpr = wa_2-netpr
       modify itab_1 from wa_1.
        continue.
    endat.
    wa_1-lifnr = wa_2-lifnr.
    append wa_1 to itab_3.
  endloop.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U shouldn't use AT FIRST event in a LOOP with the WHERE condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Feb 2009 10:40:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-02-11T10:40:54Z</dc:date>
    <item>
      <title>At first - Work area initialized</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234412#M1209785</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; I am quite new to ABAP. Forgive me if this is really a stupid question. But I tried to search and could not find any solution for the same. So here is the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an inner loop and I want to use the At first statement here. My code is some thing like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab_1 into wa_1.&lt;/P&gt;&lt;P&gt;loop at itab_2 into wa_2 where matnr = wa_1-matnr.&lt;/P&gt;&lt;P&gt;at first.&lt;/P&gt;&lt;P&gt;wa_1-netpr      = wa_2-netpr&lt;/P&gt;&lt;P&gt;modify itab_1 from wa_1.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;wa_1-lifnr = wa_2-lifnr.&lt;/P&gt;&lt;P&gt;append wa_1 to itab_3.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is the work area wa_2 values are initialized when the control gets into at first. Why does this happen? Is this the expected behaviour? If so, how can I modify my code to achieve the same result?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Jai&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2009 10:34:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234412#M1209785</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-11T10:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: At first - Work area initialized</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234413#M1209786</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;loop at itab_1 into wa_1.
*  loop at itab_2 into wa_2 where matnr = wa_1-matnr.
  loop at itab_2 where matnr = wa_1-matnr.
    wa_2 = itab2.
    at first.
       wa_1-netpr = wa_2-netpr
       modify itab_1 from wa_1.
        continue.
    endat.
    wa_1-lifnr = wa_2-lifnr.
    append wa_1 to itab_3.
  endloop.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U shouldn't use AT FIRST event in a LOOP with the WHERE condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2009 10:40:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234413#M1209786</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-11T10:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: At first - Work area initialized</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234414#M1209787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this problems happens somethimes..i dont know why...&lt;/P&gt;&lt;P&gt;define wa_temp type wa_2&lt;/P&gt;&lt;P&gt;do this:&lt;/P&gt;&lt;P&gt;loop at itab_1 into wa_1.&lt;/P&gt;&lt;P&gt;loop at itab_2 into wa_2 where matnr = wa_1-matnr.&lt;/P&gt;&lt;P&gt;wa_temp = wa_2.&lt;/P&gt;&lt;P&gt;'then use wa_temp'&lt;/P&gt;&lt;P&gt;at first.&lt;/P&gt;&lt;P&gt;wa_1-netpr = wa_temp-netpr&lt;/P&gt;&lt;P&gt;modify itab_1 from wa_1.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;wa_1-lifnr = wa_temp-lifnr.&lt;/P&gt;&lt;P&gt;append wa_1 to itab_3.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2009 10:41:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234414#M1209787</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-11T10:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: At first - Work area initialized</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234415#M1209788</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 main pre-requisite to use AT FIRST stmt is to sort the internal table before the looping....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;Changes made in u code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itan by netpr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab_1 into wa_1.&lt;/P&gt;&lt;P&gt;loop at itab_2 into wa_2 where matnr = wa_1-matnr.&lt;/P&gt;&lt;P&gt;at first.&lt;/P&gt;&lt;P&gt;wa_1-netpr = wa_2-netpr&lt;/P&gt;&lt;P&gt;modify itab_1 from wa_1.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;wa_1-lifnr = wa_2-lifnr.&lt;/P&gt;&lt;P&gt;append wa_1 to itab_3.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT FIRST means prints  whatever the data in this, at the beging of the loop before displaying the data or populationg the data.Generaly we u use this stmt to print the headers means labels of that table.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2009 10:41:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234415#M1209788</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-11T10:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: At first - Work area initialized</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234416#M1209789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;In your code, the used AT FIRST will be executed only for the first loop pass, hence use At New &amp;lt;field-name&amp;gt;.&lt;/P&gt;&lt;P&gt;This block is executed for every new value of &amp;lt;field-name&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards&lt;/P&gt;&lt;P&gt;Sharath&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2009 10:46:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-first-work-area-initialized/m-p/5234416#M1209789</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-11T10:46:52Z</dc:date>
    </item>
  </channel>
</rss>

