<?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: UPDATE outside the Loop ...... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169694#M1371422</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No where it_data is getting filled before the loop.So,do you think that it will loop the it_data internal table even when there is no data in it ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Oct 2009 03:25:03 GMT</pubDate>
    <dc:creator>kiran_k8</dc:creator>
    <dc:date>2009-10-16T03:25:03Z</dc:date>
    <item>
      <title>UPDATE outside the Loop ......</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169692#M1371420</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;     Currently  in my code i have a update statement inside the loop. i want to move it out side. My criteria is to modify any number of records. I don't this MODIFY statement will be correct. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
 LOOP AT t_zvei.

 UPDATE zxxvei SET
                                 ardoc       =  t_zvei-ardoc
                      where    
                               mjahr         =  t_zvei-mjahr
                               monat        =  t_zvei-monat.


 if sy-subrc eq 0.
   
       commit work.

endloop. 

endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the problem with  MODIFY is that it gives sy-subrc eq 0  only if all records are modified . But i want to  commit even if any record is changed. &lt;/P&gt;&lt;P&gt;I want to  change  only few columns comparing the key ffileds. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Oct 2009 15:12:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169692#M1371420</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-15T15:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE outside the Loop ......</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169693#M1371421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi, 
&amp;lt;li&amp;gt; Try like below which suggests that bring database table data into internal table and make changes to that internal table and update the same to the database.
&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest.
DATA: BEGIN OF it_data OCCURS 0,
        bukrs TYPE t001-bukrs,
        rcomp TYPE t001-rcomp,
      END OF it_data.
DATA:it_t001 TYPE STANDARD TABLE OF t001 WITH HEADER LINE.

START-OF-SELECTION.
  "Select required records from database table
  SELECT * FROM t001 INTO TABLE it_t001.
  SORT it_t001."It is sorted based on key fields.

  "Get your own data
  "Loop your internal table which has data to update database table.
  LOOP AT it_data.
    READ TABLE it_t001 WITH KEY bukrs = it_data-bukrs.
    IF sy-subrc EQ 0.
      it_t001-rcomp = 'XYZ Pte ltd'.
      MODIFY it_t001 INDEX sy-tabix TRANSPORTING rcomp.
      CLEAR it_t001.
    ENDIF.
  ENDLOOP.
  "Modify database table at a time using internal table
  MODIFY t001 FROM TABLE it_t001.
  IF sy-subrc EQ 0.
    WRITE 'All lines were inserted or changed.'.
  ELSE.
    WRITE 'At least one line could not be processed'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;
Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2009 03:13:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169693#M1371421</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2009-10-16T03:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE outside the Loop ......</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169694#M1371422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No where it_data is getting filled before the loop.So,do you think that it will loop the it_data internal table even when there is no data in it ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2009 03:25:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169694#M1371422</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2009-10-16T03:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE outside the Loop ......</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169695#M1371423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;My dear friend Kiran, 
You can see the comment written Before LOOP statment &lt;STRONG&gt;"Get your own data&lt;/STRONG&gt;

Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2009 03:41:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169695#M1371423</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2009-10-16T03:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE outside the Loop ......</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169696#M1371424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok,didn't checked that.No Offences meant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy Diwali &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2009 03:59:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169696#M1371424</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2009-10-16T03:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE outside the Loop ......</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169697#M1371425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No friends ... I have  not all data for the  DB table to be modified. I have only few fields that needs to be modified depending upon some criteria.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Oct 2009 06:18:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169697#M1371425</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-22T06:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE outside the Loop ......</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169698#M1371426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no ans&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Feb 2010 06:34:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-outside-the-loop/m-p/6169698#M1371426</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-10T06:34:02Z</dc:date>
    </item>
  </channel>
</rss>

