<?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: Delete Statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514345#M236903</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi my point is to delete the records without looping, can u suggest me somthing on this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Aug 2006 18:27:20 GMT</pubDate>
    <dc:creator>rahulkavuri</dc:creator>
    <dc:date>2006-08-31T18:27:20Z</dc:date>
    <item>
      <title>Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514342#M236900</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 have a performance issue here, here instead of looping around XMARC to delete the records, is there any alternate to get the common records of both the internal tables into another internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both these internal tables have different structures and I dont want to loop XMARC with 1,00,000 records, thats the prob...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    IF NOT S_LGORT[] IS INITIAL.
      IF NOT XMARC[] IS INITIAL.

       SELECT MATNR
              WERKS
              LGORT
         INTO TABLE IT_LGORT
         FROM MARD
         FOR ALL ENTRIES IN XMARC
       WHERE MATNR = XMARC-MATNR
         AND WERKS = XMARC-WERKS
         AND LGORT IN S_LGORT.

     SORT xmarc by matnr werks.
     SORT IT_LGORT BY MATNR WERKS.

&amp;lt;b&amp;gt;     LOOP AT XMARC.
       READ TABLE IT_LGORT WITH KEY MATNR = XMARC-MATNR
                                    WERKS = XMARC-WERKS.
          IF SY-SUBRC &amp;lt;&amp;gt; 0.
            DELETE XMARC.
          ENDIF.
     ENDLOOP.&amp;lt;/b&amp;gt;    ENDIF.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 18:10:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514342#M236900</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T18:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514343#M236901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think all you have to do is change your READ statement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
     LOOP AT XMARC.
       READ TABLE IT_LGORT
         WITH KEY MATNR = XMARC-MATNR
                  WERKS = XMARC-WERKS
                  &amp;lt;b&amp;gt;BINARY SEARCH&amp;lt;/b&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 18:21:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514343#M236901</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T18:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514344#M236902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rahul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE IT_LGORT WITH KEY MATNR = XMARC-MATNR&lt;/P&gt;&lt;P&gt;                                    WERKS = XMARC-WERKS&lt;/P&gt;&lt;P&gt;                                    &amp;lt;b&amp;gt;binary search&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vivek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 18:25:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514344#M236902</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T18:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514345#M236903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi my point is to delete the records without looping, can u suggest me somthing on this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 18:27:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514345#M236903</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2006-08-31T18:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514346#M236904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No - but you'll find the binary search option much faster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 18:36:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514346#M236904</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T18:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514347#M236905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check if the following is of any help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT XMARC.       &lt;/P&gt;&lt;P&gt;  READ TABLE IT_LGORT WITH KEY MATNR = XMARC-MATNR  &lt;/P&gt;&lt;P&gt;                          WERKS = XMARC-WERKS.          &lt;/P&gt;&lt;P&gt;  IF SY-SUBRC &amp;lt;&amp;gt; 0.            &lt;/P&gt;&lt;P&gt;    DELETE XMARC where matnr = XMARC-MATNR and &lt;/P&gt;&lt;P&gt;                       WERKS = XMARC-WERKS. &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;In your case you were only deleting one row at a time, since you want to delete all the rows of ITAB1 if its not found in ITAB2, the above would help you delete at one go and would also reduce the looping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If however, your XMARC has unique entries for the MATNR and WERKS combination, I dont know how you will be able to delete at one go without looping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hith&lt;/P&gt;&lt;P&gt;Sunil Achyut&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Sunil Achyut&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 18:43:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514347#M236905</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T18:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514348#M236906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are other problems here as well. How many records do you expect to be in IT_LGORT?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 18:45:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514348#M236906</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T18:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514349#M236907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rahul S Kavuri ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i dont see a point there ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how you can you delete entries from XMARC without having looping over it ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also use of binary search may prove costlier sometimes ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Naresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 18:45:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514349#M236907</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T18:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514350#M236908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi sunil there are very few duplicate records , so it increases by processing time by another 20 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I expect IT_LGORT to have 1/10 th of the records of XMARC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 19:01:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514350#M236908</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2006-08-31T19:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514351#M236909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rahul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at IT_LGORT.&lt;/P&gt;&lt;P&gt;delete xmarc where matnr ne it_lgort-matnr and werks ne it_lgort-werks.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vivek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 19:07:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514351#M236909</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T19:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514352#M236910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK - I think you are deleting the wrong record from XMZRC. Try:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest MESSAGE-ID 00.

&amp;lt;b&amp;gt;DATA: marc_index  LIKE sy-tabix.&amp;lt;/b&amp;gt;
IF NOT s_lgort[] IS INITIAL AND
   NOT xmarc[]   IS INITIAL.

  SELECT matnr
         werks
         lgort
    INTO TABLE it_lgort
    FROM mard
    FOR ALL ENTRIES IN xmarc
  WHERE matnr = xmarc-matnr
    AND werks = xmarc-werks
    AND lgort IN s_lgort.

  SORT xmarc BY matnr werks.
  SORT it_lgort BY matnr werks.

  LOOP AT xmarc.
&amp;lt;b&amp;gt;    marc_index = sy-tabix.&amp;lt;/b&amp;gt;
    READ TABLE it_lgort WITH KEY matnr = xmarc-matnr
                                 werks = xmarc-werks.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      DELETE xmarc
&amp;lt;b&amp;gt;        INDEX marc_index.&amp;lt;/b&amp;gt;
    ENDIF.
  ENDLOOP.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you had substantially fewer records in IT_LGORT, I would have suggested inverting the loops, but I don't think that will help here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 19:15:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514352#M236910</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T19:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514353#M236911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rahul&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Understanding from your code, i guess this is a report&lt;/P&gt;&lt;P&gt;program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   If data in XMARC is derived within your program, you &lt;/P&gt;&lt;P&gt;can use inner join with MARD to avoid loop and delete &lt;/P&gt;&lt;P&gt;concept. An example of the same will be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  select a~matnr a~werks b~lgort into table it_mat
         from mara as a
         inner join marc as b
         on b~matnr = a~matnr
         inner join mard as c
         on c~matnr = a~matnr
         and c~werks = b~werks
         where a~matnr in s_matnr
         and   b~werks in s_werks
         and   c~lgort in s_lgort.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   If my assumption is wrong and if you are deriving data from other program, then extraction from MARD &lt;/P&gt;&lt;P&gt;remains the same. You can ignore deleting record from &lt;/P&gt;&lt;P&gt;XMARC and in the later processing you can ignore entries &lt;/P&gt;&lt;P&gt;in XMARC whenever the material is not extended for any &lt;/P&gt;&lt;P&gt;storage location in the respective plant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Ex:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;   loop at XMARC.
        read table it_mard with key matnr = xmarc-matnr
                                    werks = xmarc-werks
                           binary search.
        if sy-subrc ne 0.
           continue.
        else.
*** do the processing.
        endif.
   endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that with this method you can decrease the &lt;/P&gt;&lt;P&gt;execution time but you might be holding more memory for &lt;/P&gt;&lt;P&gt;unwanted records in XMARC. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need to reduce memory consumption then you have to&lt;/P&gt;&lt;P&gt;go with our friends advice using binary search with read statement and deleting the records in XMARC whereever the material is not extended for storage locations in &lt;/P&gt;&lt;P&gt;criteria. With this method i guess you will be looping &lt;/P&gt;&lt;P&gt;on XMARC twice, once for deleting w.r.t records in &lt;/P&gt;&lt;P&gt;it_mard and once for processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  If you can post whole code of your program, i am sure &lt;/P&gt;&lt;P&gt;our friends here can advice better solutions basing on &lt;/P&gt;&lt;P&gt;your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 19:23:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514353#M236911</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T19:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514354#M236912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can try this way....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_lgort.&lt;/P&gt;&lt;P&gt;at new werks.&lt;/P&gt;&lt;P&gt;DELETE TABLE xmarc WITH TABLE KEY &lt;/P&gt;&lt;P&gt;     matnr = it_lgort-matnr&lt;/P&gt;&lt;P&gt;     werks = it_lgort-werks.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 19:29:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514354#M236912</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T19:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514355#M236913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rahul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sorry for the second post....thats not correct...ignore it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vivek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 19:38:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514355#M236913</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T19:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514356#M236914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hey guys thanks for ur replies, but still these are not able to help me as they are not optimising the performance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kishore, similar suggestion is made already, infact it increases the processing time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is the code...&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    if not imatnr[] is initial.
      select * from marc into table xmarc
                      for all entries in imatnr
                      where matnr = imatnr-matnr
                      and dispo in s_dispo
                      and sobsl &amp;lt;&amp;gt; '50'.  " Phantom assembly excluded
    endif.
*-- End of changes by GUTTIS1 D51K903635
  endif.

*Start of changes                                            DEVK947965
  if not s_lgort[] is initial.
    if not xmarc[] is initial.

      select matnr
             werks
             lgort
        into table it_lgort
        from mard
        for all entries in xmarc
      where matnr = xmarc-matnr
        and werks = xmarc-werks
        and lgort in s_lgort.

*     SORT xmarc by matnr werks.
*     SORT IT_LGORT BY MATNR WERKS.
*
      sort xmarc by matnr werks.
      sort it_lgort by matnr werks.

      loop at xmarc.
        read table it_lgort with key matnr = xmarc-matnr
                                     werks = xmarc-werks
                                     transporting no fields
                                     binary search.
        if sy-subrc &amp;lt;&amp;gt; 0.
          delete xmarc.
        ENDIF.
        endloop.
      endif.
    endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 20:04:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514356#M236914</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2006-08-31T20:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514357#M236915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rahul.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a suggestion why dont you combine the information from marc and mard in xmarc table rather than having it it_lgort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Surely it depends on your requirement but I think if you can combine it it would reduce the additional select..endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anurag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 20:10:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514357#M236915</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T20:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514358#M236916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't know how much performance improvement you are going to get but, Try this code for deleting records from XMARC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only helps if there are lot of duplicates with MATNR WERKS in XMARC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add the code after the 2 sort statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: l_tabix type sy-tabix.
field-symbols: &amp;lt;fs&amp;gt; type marc.

loop at xmarc.
  l_tabix = sy-tabix.
  read table it_lgort with key matnr = xmarc-matnr
                              werks = xmarc-werks
                              transporting no fields
                              binary search.
  if sy-subrc &amp;lt;&amp;gt; 0.
    assign xmarc to &amp;lt;fs&amp;gt;.
    clear sy-subrc.
    while xmarc-matnr = &amp;lt;fs&amp;gt;-matnr and xmarc-werks = &amp;lt;fs&amp;gt;-werks and sy-subrc eq 0.
      delete xmarc index l_tabix.
      add 1 to l_tabix.
      read table xmarc assigning &amp;lt;fs&amp;gt; index l_tabix.
    endwhile.
  endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sridhar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Sridhar K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 21:27:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-statement/m-p/1514358#M236916</guid>
      <dc:creator>sridhar_k1</dc:creator>
      <dc:date>2006-08-31T21:27:07Z</dc:date>
    </item>
  </channel>
</rss>

