<?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 tables help in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815734#M42165</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this case, you can do something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT GT_TAB.&lt;/P&gt;&lt;P&gt;  AT NEW MONTHPOSTING&lt;/P&gt;&lt;P&gt;     CLEAR TOTAL&lt;/P&gt;&lt;P&gt;     REFRESH LT_TAB&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;  APPEND GT_TAB TO LT_TAB&lt;/P&gt;&lt;P&gt;  TOTAL = TOTAL + GT_TAB-qty&lt;/P&gt;&lt;P&gt;  AT END OF MONTHPOSTIN&lt;/P&gt;&lt;P&gt;     LOOP AT LT_TAB&lt;/P&gt;&lt;P&gt;        PERCENT1 = MONTH1 / TOTAL.&lt;/P&gt;&lt;P&gt;        PERCENT2 = MONTH1 / TOTAL.&lt;/P&gt;&lt;P&gt;        PERCENT3 = MONTH1 / TOTAL.&lt;/P&gt;&lt;P&gt;        WRITE: / CUSTOME, MATERIAL, MONTH1, MONTH2, MONTH3&lt;/P&gt;&lt;P&gt;            PERCENT1, PERCENT2 PERCENT3.&lt;/P&gt;&lt;P&gt;     ENDLOOP&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>Mon, 04 Oct 2004 16:01:51 GMT</pubDate>
    <dc:creator>nablan_umar</dc:creator>
    <dc:date>2004-10-04T16:01:51Z</dc:date>
    <item>
      <title>internal tables help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815731#M42162</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 am new to ABAP and was looking for some help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well we have data coming from a header and a line item table( delivery LIKP and LIPS).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create an internal table one which can hold the data at line item level but sorted on plant so that all the data gets in order by plant and month of posting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need another internal table that will aggregate and give me the totals by plant on a month basis so that I can sum of quantities by month and by plant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I need to divide the individual line items in the first internal table by the total quantities of internal table 2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont seem to be making any progress. Can I get some help on the code for the best way to go about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2004 14:30:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815731#M42162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-10-04T14:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815732#M42163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would suggest you you join those 2 tables in a select statement into 1 internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select a~field1&lt;/P&gt;&lt;P&gt;       a~field2&lt;/P&gt;&lt;P&gt;       b~field1&lt;/P&gt;&lt;P&gt;       b~field2&lt;/P&gt;&lt;P&gt;   into table gt_tab&lt;/P&gt;&lt;P&gt;   from likp as a&lt;/P&gt;&lt;P&gt;    inner join lips as b&lt;/P&gt;&lt;P&gt;     on b&lt;SUB&gt;vbeln = a&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;   where a~key1 = key_selection1&lt;/P&gt;&lt;P&gt;         a~key2 = key_selection2&lt;/P&gt;&lt;P&gt;   order by a&lt;SUB&gt;werks a&lt;/SUB&gt;monthposting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, you loop at this internal table (make LT_TAB same as GT_TAB)&lt;/P&gt;&lt;P&gt;LOOP at GT_TAB.&lt;/P&gt;&lt;P&gt;  at new monthposting.&lt;/P&gt;&lt;P&gt;     refresh LT_TAB.&lt;/P&gt;&lt;P&gt;  endat.&lt;/P&gt;&lt;P&gt;  append GT_TAB to LT_TAB.&lt;/P&gt;&lt;P&gt;  at end of monthposting.&lt;/P&gt;&lt;P&gt;     describe lt_tab lines lv_size.&lt;/P&gt;&lt;P&gt;     loop at LT_TAB.&lt;/P&gt;&lt;P&gt;        line_time_qty = LT_TAB-qty / LV_SIZE.&lt;/P&gt;&lt;P&gt;     endloop.&lt;/P&gt;&lt;P&gt;     write the summary per plant, monthposting.&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>Mon, 04 Oct 2004 14:57:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815732#M42163</guid>
      <dc:creator>nablan_umar</dc:creator>
      <dc:date>2004-10-04T14:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815733#M42164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nablan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the prompt reply. I am lost a bit in the code that you sent.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe lt_tab lines lv_size.&lt;/P&gt;&lt;P&gt;loop at LT_TAB.&lt;/P&gt;&lt;P&gt;line_time_qty = LT_TAB-qty / LV_SIZE.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;write the summary per plant, monthposting.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What does lv_size do. From what I got when we do the above statement we are not getting the total for a particular plant for that month and we need to divide the individual quantities after obtaining the total by month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;customer material  q1  q2  q3&lt;/P&gt;&lt;P&gt;123        m1      3   2   4&lt;/P&gt;&lt;P&gt;123        m2      4   1   2&lt;/P&gt;&lt;P&gt;456        m1      2   2   4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so i would want&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;customer material  q1  q2  q3  %q1  %q2  %q3&lt;/P&gt;&lt;P&gt;123       m1       3   2   4    3/7  2/3  4/6&lt;/P&gt;&lt;P&gt;123       m2       4   1   2    4/7  1/3  2/6&lt;/P&gt;&lt;P&gt;456       m1       2   2   4    2/2  2/2  4/4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2004 15:43:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815733#M42164</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-10-04T15:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815734#M42165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this case, you can do something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT GT_TAB.&lt;/P&gt;&lt;P&gt;  AT NEW MONTHPOSTING&lt;/P&gt;&lt;P&gt;     CLEAR TOTAL&lt;/P&gt;&lt;P&gt;     REFRESH LT_TAB&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;  APPEND GT_TAB TO LT_TAB&lt;/P&gt;&lt;P&gt;  TOTAL = TOTAL + GT_TAB-qty&lt;/P&gt;&lt;P&gt;  AT END OF MONTHPOSTIN&lt;/P&gt;&lt;P&gt;     LOOP AT LT_TAB&lt;/P&gt;&lt;P&gt;        PERCENT1 = MONTH1 / TOTAL.&lt;/P&gt;&lt;P&gt;        PERCENT2 = MONTH1 / TOTAL.&lt;/P&gt;&lt;P&gt;        PERCENT3 = MONTH1 / TOTAL.&lt;/P&gt;&lt;P&gt;        WRITE: / CUSTOME, MATERIAL, MONTH1, MONTH2, MONTH3&lt;/P&gt;&lt;P&gt;            PERCENT1, PERCENT2 PERCENT3.&lt;/P&gt;&lt;P&gt;     ENDLOOP&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>Mon, 04 Oct 2004 16:01:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815734#M42165</guid>
      <dc:creator>nablan_umar</dc:creator>
      <dc:date>2004-10-04T16:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815735#M42166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Nablan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will try that out and will inform you of the same. How do I allot the points please so that you get credit for the help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2004 18:40:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815735#M42166</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-10-04T18:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815736#M42167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can reward points by pressing the yellow star icon at the header of each post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can give;&lt;/P&gt;&lt;P&gt;- one 10 points (solved)&lt;/P&gt;&lt;P&gt;- two 6 points (very helpful answer)&lt;/P&gt;&lt;P&gt;- many 2 points (helpful answer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As soon as you give a 10 points, your question will seem as "solved".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Serdar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2004 18:45:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815736#M42167</guid>
      <dc:creator>ssimsekler</dc:creator>
      <dc:date>2004-10-04T18:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815737#M42168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nablan, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code that you posted, will sort the record by plant&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select a~field1&lt;/P&gt;&lt;P&gt;a~field2&lt;/P&gt;&lt;P&gt;b~field1&lt;/P&gt;&lt;P&gt;b~field2&lt;/P&gt;&lt;P&gt;into table gt_tab&lt;/P&gt;&lt;P&gt;from likp as a&lt;/P&gt;&lt;P&gt;inner join lips as b&lt;/P&gt;&lt;P&gt;on b&lt;SUB&gt;vbeln = a&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;where a~key1 = key_selection1&lt;/P&gt;&lt;P&gt;a~key2 = key_selection2&lt;/P&gt;&lt;P&gt;order by a&lt;SUB&gt;werks a&lt;/SUB&gt;monthposting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When we say at monthpostin that will give us just the total quantity for the entire month but not by plant. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT GT_TAB.&lt;/P&gt;&lt;P&gt;AT NEW MONTHPOSTING&lt;/P&gt;&lt;P&gt;CLEAR TOTAL&lt;/P&gt;&lt;P&gt;REFRESH LT_TAB&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;APPEND GT_TAB TO LT_TAB&lt;/P&gt;&lt;P&gt;TOTAL = TOTAL + GT_TAB-qty&lt;/P&gt;&lt;P&gt;AT END OF MONTHPOSTIN&lt;/P&gt;&lt;P&gt;LOOP AT LT_TAB&lt;/P&gt;&lt;P&gt;PERCENT1 = MONTH1 / TOTAL.&lt;/P&gt;&lt;P&gt;PERCENT2 = MONTH1 / TOTAL.&lt;/P&gt;&lt;P&gt;PERCENT3 = MONTH1 / TOTAL.&lt;/P&gt;&lt;P&gt;WRITE: / CUSTOME, MATERIAL, MONTH1, MONTH2, MONTH3&lt;/P&gt;&lt;P&gt;PERCENT1, PERCENT2 PERCENT3.&lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;P&gt;ENDAT&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;Please clarify that part. In the example that I sent across we divided the indivual line items by the totals for the plant at the end of the month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;customer material q1 q2 q3&lt;/P&gt;&lt;P&gt;123 m1 3 2 4&lt;/P&gt;&lt;P&gt;123 m2 4 1 2&lt;/P&gt;&lt;P&gt;456 m1 2 2 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so i would want&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;customer material q1 q2 q3 %q1 %q2 %q3&lt;/P&gt;&lt;P&gt;123 m1 3 2 4 3/7 2/3 4/6&lt;/P&gt;&lt;P&gt;123 m2 4 1 2 4/7 1/3 2/6&lt;/P&gt;&lt;P&gt;456 m1 2 2 4 2/2 2/2 4/4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here for plant 123 the total q1 was 7 ,total q2 was 3 and total q3 was 6.&lt;/P&gt;&lt;P&gt;But for plant 456 the total q1 was 2,total q2 was 2 and total q3 was 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would be thankful if the above code can be modified so that we can do the above thing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2004 18:57:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815737#M42168</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-10-04T18:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815738#M42169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this one then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP at GT_TAB.&lt;/P&gt;&lt;P&gt;   AT NEW PLANT.&lt;/P&gt;&lt;P&gt;      CLEAR: TOTAL_Q1, TOTAL_Q2, TOTAL_Q3.&lt;/P&gt;&lt;P&gt;      REFRESH LT_TAB.&lt;/P&gt;&lt;P&gt;   ENDAT.&lt;/P&gt;&lt;P&gt;   TOTAL_Q1 = TOTAL_Q1 + GT_TAB-QTY1.&lt;/P&gt;&lt;P&gt;   TOTAL_Q2 = TOTAL_Q2 + GT_TAB-QTY2.&lt;/P&gt;&lt;P&gt;   TOTAL_Q3 = TOTAL_Q3 + GT_TAB-QTY3.&lt;/P&gt;&lt;P&gt;   APPEND GT_TAB to LT_TAB.&lt;/P&gt;&lt;P&gt;   AT END OF PLANT.&lt;/P&gt;&lt;P&gt;      LOOP AT LT_TAB.&lt;/P&gt;&lt;P&gt;        PERCENT1 = ( LT_TAB-QTY1 / TOTAL_Q1 ) * 100.&lt;/P&gt;&lt;P&gt;        PERCENT2 = ( LT_TAB-QTY2 / TOTAL_Q2 ) * 100.&lt;/P&gt;&lt;P&gt;        PERCENT3 = ( LT_TAB-QTY3 / TOTAL_Q3 ) * 100.&lt;/P&gt;&lt;P&gt;        Write: customer, material, LT_TAB-QTY1, LT_TAB-QTY2, LT_TAB-QTY3, PERCENT1, PERCENT2, PERCENT3.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&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>Mon, 04 Oct 2004 19:14:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-help/m-p/815738#M42169</guid>
      <dc:creator>nablan_umar</dc:creator>
      <dc:date>2004-10-04T19:14:47Z</dc:date>
    </item>
  </channel>
</rss>

