<?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: Internal Table Logic Needed in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-logic-needed/m-p/5501955#M1258468</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use this code! &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: total type i.
loop at itab.                    " itab is assumed to be with header.
  total = total + itab-quantity. " adding quantities
  at end of material.            " triggerred when material or vender ends (about to change)
    itab2-total = total. 
    modify itab.                 "Modify the internal table
    clear total.
  endat.
endloop.
Delete itab where quantity = ' '.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So you get the entries like you mentioned.&lt;/P&gt;&lt;P&gt;If you want to retain the previous internal table also then copy internal table first and then manipulate.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Apr 2009 10:33:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-11T10:33:16Z</dc:date>
    <item>
      <title>Internal Table Logic Needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-logic-needed/m-p/5501954#M1258467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement regarding data processing in a internal table,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;internal table consists of filelds Vendor,Material and Scheduling Dates and Total Qty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here i need to fill the field Total Quantity, individual addition of quanties of that material for a particular vendor .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us consider intitially my internal table consists of data like this with these fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                  Vendor ,           Material  ,            qty(individual),   Total qty   ,  Schedule dates &lt;/P&gt;&lt;P&gt;                   v1        ,           m1       ,                 10           &lt;/P&gt;&lt;P&gt;                   v1        ,           m1        ,                10&lt;/P&gt;&lt;P&gt;                   v1       ,             m1       ,                  20&lt;/P&gt;&lt;P&gt;                   v1       ,              m2      ,                    5&lt;/P&gt;&lt;P&gt;                   v1       ,             m2        ,                 10&lt;/P&gt;&lt;P&gt;                   v2        ,            m2         ,                20&lt;/P&gt;&lt;P&gt;                  v2        ,             m2        ,                  15&lt;/P&gt;&lt;P&gt;                  v2        ,            m3         ,                  20&lt;/P&gt;&lt;P&gt;                  v2        ,            m3           ,                10 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Initiall the total qty field is empty i need to fill tht field for the last item for a particular material Like M1&lt;/P&gt;&lt;P&gt;  for vendor v1 and total qty of m2 for vendor v1, total qty of m1 for v2, total qty of m2 for v2 and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Requied output should be like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                 Vendor     ,          Material       ,    qty(individual)            Total qty   Schedule dates&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                  v1         ,                m1         ,         10           ,               0         &lt;/P&gt;&lt;P&gt;                   v1          ,              m1          ,        10           ,                 0&lt;/P&gt;&lt;P&gt;                   v1         ,                m1         ,         20          ,                40(10&lt;EM&gt;10&lt;/EM&gt;20)&lt;/P&gt;&lt;P&gt;                   v1        ,                 m2          ,         5           ,               0&lt;/P&gt;&lt;P&gt;                   v1          ,               m2           ,      10            ,              15(5+10)&lt;/P&gt;&lt;P&gt;                   v2          ,               m2          ,        20            ,             0     &lt;/P&gt;&lt;P&gt;                   v2          ,               m2           ,       15             ,              35(20+15)&lt;/P&gt;&lt;P&gt;                  v2           ,              m3          ,        20              ,             0&lt;/P&gt;&lt;P&gt;                  v2            ,              m3           ,       10              ,           30(20+10)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here i made one thing , i calculated the total qty of material for particular vendor.&lt;/P&gt;&lt;P&gt;Like               &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         Vendor                           Material                     Total Qty       &lt;/P&gt;&lt;P&gt;                 v1        ,                        m1            ,             40&lt;/P&gt;&lt;P&gt;                 v1        ,                       m2              ,            15&lt;/P&gt;&lt;P&gt;                 v2         ,                     m2                ,           35&lt;/P&gt;&lt;P&gt;                 v2          ,                    m3                 ,           30&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Finally i need the logic by using Control Events(At New   , At End of )  to adjust that total qty of a material for a particular vendor by Modifying the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i hope my problem is clear , pls let me know if any clarifications needed. and&lt;/P&gt;&lt;P&gt; code for the same .&lt;/P&gt;&lt;P&gt;Thannks in advance,&lt;/P&gt;&lt;P&gt;Niranjan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Apr 2009 10:21:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-logic-needed/m-p/5501954#M1258467</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-11T10:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Table Logic Needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-logic-needed/m-p/5501955#M1258468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use this code! &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: total type i.
loop at itab.                    " itab is assumed to be with header.
  total = total + itab-quantity. " adding quantities
  at end of material.            " triggerred when material or vender ends (about to change)
    itab2-total = total. 
    modify itab.                 "Modify the internal table
    clear total.
  endat.
endloop.
Delete itab where quantity = ' '.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So you get the entries like you mentioned.&lt;/P&gt;&lt;P&gt;If you want to retain the previous internal table also then copy internal table first and then manipulate.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Apr 2009 10:33:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-logic-needed/m-p/5501955#M1258468</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-11T10:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Table Logic Needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-logic-needed/m-p/5501956#M1258469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For control processing statements check this link &lt;/P&gt;&lt;P&gt;[Control processing|http://help.sap.com/saphelp_nw70/helpdata/EN/9f/db9f1f35c111d1829f0000e829fbfe/content.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Apr 2009 10:36:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-logic-needed/m-p/5501956#M1258469</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-11T10:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Table Logic Needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-logic-needed/m-p/5501957#M1258470</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;Solution is here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by vendor material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;itab&amp;gt; like line of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab assigning &amp;lt;itab&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on change of vendor.&lt;/P&gt;&lt;P&gt;clear flag.&lt;/P&gt;&lt;P&gt;endon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add &amp;lt;itab&amp;gt;-quanity to lw_quantiy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--here pdate internal table end of each similar kind of record&lt;/P&gt;&lt;P&gt;at end of.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flag = 'x'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;itab&amp;gt;-totalqty =  lw_quantiy.&lt;/P&gt;&lt;P&gt;clear  lw_quantiy&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--rest of record update zero by checking flag&lt;/P&gt;&lt;P&gt;if flag is initial.&lt;/P&gt;&lt;P&gt;&amp;lt;itab&amp;gt;-totalqty = 0.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close this thread if you got solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Peranandam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Apr 2009 11:28:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-logic-needed/m-p/5501957#M1258470</guid>
      <dc:creator>Peranandam</dc:creator>
      <dc:date>2009-04-11T11:28:26Z</dc:date>
    </item>
  </channel>
</rss>

