<?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: Deleting from Internal Table (dynamic) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416103#M539278</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Loop at itab.&lt;/P&gt;&lt;P&gt;At new matnr.   "Reset the count for evry new material no&lt;/P&gt;&lt;P&gt;cnt = 0.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if cnt = 0.     "Add daily1/2/3/4 fields of all materials&lt;/P&gt;&lt;P&gt;  cnt = cnt + itab-daily1 + itab-daily2 + itab-daily3 + itab-daily4.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of matnr.  "If count = 0,delete all same materials&lt;/P&gt;&lt;P&gt;  if cnt = 0.&lt;/P&gt;&lt;P&gt;     delete itab where matnr = itab-matnr.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jun 2007 22:27:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-19T22:27:13Z</dc:date>
    <item>
      <title>Deleting from Internal Table (dynamic)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416099#M539274</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 an Internal table, which will contain daily movements for plants per material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The internal table will contain 4 plants per material, with more than 1 material.&lt;/P&gt;&lt;P&gt;Now, i have four columns. If all of those columns for that material and for all plants for that material equal zero, i want to delete the specific record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Material     Plant      Daily 1  Daily 2  Daily 3  Daily 4&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------------" /&gt;&lt;P&gt;102            1           0          0           0          0&lt;/P&gt;&lt;P&gt;102            2           0          0           0          0&lt;/P&gt;&lt;P&gt;102            3           0          0           0          0&lt;/P&gt;&lt;P&gt;102            4           0          0           0          0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, these 4 records should be deleted. However, say on of the daily columns will equal 1, then keep the 4 records (they are linked by material and plant.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Points will be rewarded and all help will be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 21:48:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416099#M539274</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T21:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting from Internal Table (dynamic)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416100#M539275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its a dynamic table right ?? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cnt = 2.  "This is because to skip 1st 2 fields in ASSIGN&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Loop at &amp;lt;itab&amp;gt; into &amp;lt;wa&amp;gt;.&lt;/P&gt;&lt;P&gt;DO 4 times.&lt;/P&gt;&lt;P&gt;  cnt  = cnt + 1.&lt;/P&gt;&lt;P&gt;  assign component cnt of structure &amp;lt;wa&amp;gt; into &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;  concatenate value &amp;lt;fs&amp;gt; into value.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if value eq 0000.&lt;/P&gt;&lt;P&gt;   delete &amp;lt;itab&amp;gt;.&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;If the fields daily1/2/3/4 is non-char then add &amp;lt;fs&amp;gt; value into variable &amp;amp; check if value eq 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 21:56:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416100#M539275</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T21:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting from Internal Table (dynamic)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416101#M539276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this what you are looking for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE itab WHERE daily1 = 0 AND daily2 = 0 AND daily3 = 0 AND daily4 = 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 22:16:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416101#M539276</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T22:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting from Internal Table (dynamic)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416102#M539277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sort of. But it has to look and see if the other records with the same MATNR are also empty. If all are empty for the MATNR, then do that. Otherwise, even the empty ones need to be displayed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 22:19:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416102#M539277</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T22:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting from Internal Table (dynamic)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416103#M539278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Loop at itab.&lt;/P&gt;&lt;P&gt;At new matnr.   "Reset the count for evry new material no&lt;/P&gt;&lt;P&gt;cnt = 0.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if cnt = 0.     "Add daily1/2/3/4 fields of all materials&lt;/P&gt;&lt;P&gt;  cnt = cnt + itab-daily1 + itab-daily2 + itab-daily3 + itab-daily4.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of matnr.  "If count = 0,delete all same materials&lt;/P&gt;&lt;P&gt;  if cnt = 0.&lt;/P&gt;&lt;P&gt;     delete itab where matnr = itab-matnr.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 22:27:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416103#M539278</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T22:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting from Internal Table (dynamic)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416104#M539279</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;Check this.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
sort itab by material

loop at itab.
 
  at new of matnr.
     move 'Y' to v_flg.
     move 'Y' to v_dflg
  endat.
  if v_flg eq 'Y'.
    move itab-matnr to v_matnr.
  endif.
  if itab-daily1 ne 0 and itab-dail2 ne 0
     and itab-daily3 ne 0 and itab-daily4 ne 0.
     move 'N' v_dlfg.
  endif.
  at end of matnr.
    if v_dflg eq 'Y'.
       delete itab where matnr eq v_matnr.
    endif.
    clear : v_flg, v_dlfg.
  endat.
  
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 22:31:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416104#M539279</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-06-19T22:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting from Internal Table (dynamic)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416105#M539280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: BEGIN OF itab OCCURS 0,
        matnr LIKE marc-matnr,
        werks LIKE marc-werks,
        daily1 TYPE i,
        daily2 TYPE i,
        daily3 TYPE i,
        daily4 TYPE i.
DATA: END OF itab.

DATA: itab_per_matnr LIKE itab OCCURS 0 WITH HEADER LINE,
      wa_itab        LIKE itab.

itab_per_matnr[] = itab[].
LOOP AT itab INTO wa_itab.
*-- check if there is at least one non-zero record for this material
  LOOP AT itab_per_matnr WHERE matnr = wa_itab-matnr
                           AND ( daily1 &amp;gt; 0 OR
                                 daily2 &amp;gt; 0 OR
                                 daily3 &amp;gt; 0 OR
                                 daily4 &amp;gt; 0 ).
    EXIT
  ENDLOOP.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    DELETE itab WHERE matnr = wa_itab-matnr.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 22:44:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deleting-from-internal-table-dynamic/m-p/2416105#M539280</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T22:44:36Z</dc:date>
    </item>
  </channel>
</rss>

