<?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: Problem using AT..NEW statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885673#M1325657</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;&lt;STRONG&gt;AT NEW&lt;/STRONG&gt; gets triggered here (in place where tested value has changed)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
20090317       1500000   "&amp;lt;- here
20090317      -950000
20090317        5000
20090319       8700  "&amp;lt;- here
20090327       400000  "&amp;lt;- here
20090327       32000
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to get last value, use &lt;STRONG&gt;AT END OF&lt;/STRONG&gt; event which get triggered &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
20090317       1500000   
20090317      -950000  
20090317        5000 "&amp;lt;- here
20090319       8700  "&amp;lt;- here
20090327       400000 
20090327       32000 "&amp;lt;-here
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in case you want totally last value, use &lt;STRONG&gt;AT LAST&lt;/STRONG&gt; event&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
20090317       1500000   
20090317      -950000  
20090317        5000 
20090319       8700  
20090327       400000 
20090327       32000 "&amp;lt;- only here
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jul 2009 09:05:20 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2009-07-22T09:05:20Z</dc:date>
    <item>
      <title>Problem using AT..NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885672#M1325656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a internal table with structure &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;posting_date   amount
20090317       1500000
20090317      -950000
20090317        5000
20090319       8700
20090327       400000
20090327       32000&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using AT NEW POSTING_DATE  to perform some operation on the amount.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab.
AT NEW POSTING_DATE
 { 
      LOGIC
 }
ENDAT.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;all the record are working fine for AT NEW except for the last record.( posting date 20090327) It does not enter into AT..ENDAT&lt;/P&gt;&lt;P&gt;and simply goes to the endloop..Probably the reason for this is in AT new the current posting date is compared with the one that is above it...and if they are different AT NEW gets triggered. But in my case both the second last and last posting_date are the same, that's why AT NEW is not getting triggered..Please tell me how to solve this problem, how can I do the processing of last record?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS this problem does not occur if both second last record and last record are different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: priyasingh on Jul 22, 2009 11:01 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 08:59:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885672#M1325656</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-22T08:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using AT..NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885673#M1325657</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;&lt;STRONG&gt;AT NEW&lt;/STRONG&gt; gets triggered here (in place where tested value has changed)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
20090317       1500000   "&amp;lt;- here
20090317      -950000
20090317        5000
20090319       8700  "&amp;lt;- here
20090327       400000  "&amp;lt;- here
20090327       32000
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to get last value, use &lt;STRONG&gt;AT END OF&lt;/STRONG&gt; event which get triggered &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
20090317       1500000   
20090317      -950000  
20090317        5000 "&amp;lt;- here
20090319       8700  "&amp;lt;- here
20090327       400000 
20090327       32000 "&amp;lt;-here
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in case you want totally last value, use &lt;STRONG&gt;AT LAST&lt;/STRONG&gt; event&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
20090317       1500000   
20090317      -950000  
20090317        5000 
20090319       8700  
20090327       400000 
20090327       32000 "&amp;lt;- only here
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 09:05:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885673#M1325657</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-07-22T09:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using AT..NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885674#M1325658</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;Use the event AT LAST. ENDAT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab.
   AT NEW POSTING_DATE
 { 
         LOGIC
 }
   ENDAT

   AT LAST.
       LOGIC
   ENDAT..
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's good is you need to triggered the last record, u make sure not to elaborate the last record twice, u can check a flag for that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: FL_FIRST TYPE FLAG.

loop at itab.
   FL_FIRST = SPACE.
   AT NEW POSTING_DATE
      FL_FIRST = 'X'.
 { 
         LOGIC
 }
   ENDAT
   
   CHECK FL_FIRST IS INITIAL.

   AT LAST.
       LOGIC
   ENDAT..
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&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, 22 Jul 2009 09:05:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885674#M1325658</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-22T09:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using AT..NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885675#M1325659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Try the following logic as AT NEW alone wont work in ur case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;STRONG&gt;Describe itab into l_lines.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;   &lt;STRONG&gt;CNTR = 0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;   loop at itab.&lt;/P&gt;&lt;P&gt;   &lt;STRONG&gt;CNTR = CNTR + 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;   AT NEW POSTING_DATE&lt;/P&gt;&lt;P&gt;    &lt;SPAN __jive_macro_name="LOGIC"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;   ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;if CNTR = l_lines -1. " (CHECK FOR SECOND LAST RECORD.)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;   &lt;STRONG&gt;l_pdate = wa_itab-pdate.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;if CNTR = l_lines and l_pdate = wa_itab-pdate."(Checkfor last record and difference between last and 2nd last record)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     &lt;STRONG&gt;LOGIC.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;endif.&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CHEERS!!.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vimal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vimal V on Jul 22, 2009 11:15 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 09:07:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885675#M1325659</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-22T09:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using AT..NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885676#M1325660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Priya singh  ,&lt;/P&gt;&lt;P&gt;   where you want to trigger the event  at the end of field value or at the first occurence of new field value ?.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Thanks and Regards ..&lt;/P&gt;&lt;P&gt;    Priyank Dixit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 12:28:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885676#M1325660</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-22T12:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using AT..NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885677#M1325661</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;An alternative would be this. LOL....Its freaky though. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do what the others have suggested or here it goes....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Append a record with initial values for the fields as the last entry in the internal table (provided you arent doing any kind of display with the data present there...If so, it will definitely be a pain in your neck). So your AT NEW event will get triggered for your record &lt;STRONG&gt;20090327&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 12:39:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885677#M1325661</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-22T12:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using AT..NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885678#M1325662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;at new event would process the records only when the column on which its used is changed..&lt;/P&gt;&lt;P&gt;so in the present context the last record will not b processed. But as per requirement for accessing the last record u can use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_index type i, w_lines type i.&lt;/P&gt;&lt;P&gt;describe table itab lines w_lines.&lt;/P&gt;&lt;P&gt;w_index = w_lines.&lt;/P&gt;&lt;P&gt;read itab index w_index into &amp;lt;work_area&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mdi.Deeba&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 12:59:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885678#M1325662</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-22T12:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using AT..NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885679#M1325663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Priya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you try the same with :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ON CHANGE ON IT-POSTING_DATE&lt;/P&gt;&lt;P&gt;     logic....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDON.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 15:20:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-at-new-statement/m-p/5885679#M1325663</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-22T15:20:24Z</dc:date>
    </item>
  </channel>
</rss>

