<?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: Inserting summary value in a ZTABLE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865516#M1137656</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;Just use an aggregate function &lt;STRONG&gt;sum( quantity_field )&lt;/STRONG&gt; and append into internal table. It will work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Dec 2008 06:41:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-12-03T06:41:55Z</dc:date>
    <item>
      <title>Inserting summary value in a ZTABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865515#M1137655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please guide me on how the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a Ztable into which i want to upload the Stock in a summary format i.e.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have got the above values in an internal table. now i want to insert the sum of results into another internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*PLANT	MATERIAL	BATCH	STORAGE		QUANTITY	MONTH_END_DATE*
0001	ABC-001		12345	RM		500		30.04.2008
0001	ABC-001		12345	RM		1500		30.04.2008
0001	ABC-002		23456	PM		1000		30.04.2008
0002	XYZ-001		12345	RM		500		30.04.2008
0002	XYZ-001		12345	RM		500		30.04.2008
0002	ABC-001		23456	PM		500		30.04.2008
0002	ABC-001		23456	RM		500		30.04.2008&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;At the end of Plant, Material, Batch &amp;amp; Storage Location system should sum up the quantity and insert into the Internal table. Format is as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*PLANT	MATERIAL	BATCH	STORAGE      QUANTITY	MONTH_END_DATE*
0001    ABC-001         12345   RM           2000       30.04.2008
0001    ABC-002         23456   PM           1000       30.04.2008
0002    XYZ-001         12345   RM           1000       30.04.2008
0002    XYZ-001         23456   PM           500        30.04.2008
0002    XYZ-001         23456   RM           500        30.04.2008&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I will then insert the above value into a Ztable. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried doing it but i just do not get the summary values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please guide on how to achieve it.&lt;/P&gt;&lt;P&gt;I hope i have given you an idea of how i want the data,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any queries please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You,&lt;/P&gt;&lt;P&gt;Jitesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 06:35:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865515#M1137655</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T06:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting summary value in a ZTABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865516#M1137656</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;Just use an aggregate function &lt;STRONG&gt;sum( quantity_field )&lt;/STRONG&gt; and append into internal table. It will work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 06:41:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865516#M1137656</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T06:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting summary value in a ZTABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865517#M1137657</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;sort the itab based on your requirement and use collect it will add the numeric fields &lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;you can use AT NEW or ON CHANGE OF etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please go through the KEY word documentaion&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Ramchander Rao.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 06:42:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865517#M1137657</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T06:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting summary value in a ZTABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865518#M1137658</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;              First of all make sure based on which field's changes you want to sum up. If its is the first one in your internal table as in your example is plant, Then sort internal table based on plant &amp;amp; then use tha following code as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;wa1 = wa.           " To get char values as they are(Not *** as it comes after SUM stmnt)&lt;/P&gt;&lt;P&gt;at new plant.&lt;/P&gt;&lt;P&gt;sum.&lt;/P&gt;&lt;P&gt;wa1-quantity = wa-quantity.&lt;/P&gt;&lt;P&gt;append wa1 to new_itab.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;clear : wa, wa1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you want it on some other field, then sort internal table based on that field and use "on change of" instead of "at new". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope will help you out to solve ur problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pankaj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 07:08:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865518#M1137658</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T07:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting summary value in a ZTABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865519#M1137659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I HAVE USED AS YOU SUGGESTED. &lt;/P&gt;&lt;P&gt;i am first giving the data what is there in the Internal Table IT_FINAL.&lt;/P&gt;&lt;P&gt;then i am giving the output after the code suggested has been written.&lt;/P&gt;&lt;P&gt;finally i am giving the output as and how i want it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
plant	material	batch		storagelocation	quantity
1	100050		NEWBATCH02	RM01		10,000.000-
1	100050		NEWBATCH01	RM01		50.000-
1	100050		NEW10		RM01		50.000-
1	100050		NEWBATCH01	RM01		100.000-
1	100050		NEW561		PM01		10.000-
1	100050		BATCH1		RM01		10.000-
1	100050		NEW561		PM01		1.000-
1	100050		123456		RM01		10.000-
1	100050		NEW561		PM01		10
1	100050		NEW10		RM01		50
1	100050		NEW10		RM01		50
1	100050		NEW561		PM01		10
1	100050		NEWBATCH02	RM01		10,000.00
1	100050		NEWBATCH02	RM01		10,000.00
1	100050		NEWBATCH01	RM01		100,000.00
1	100050		NEWBATCH01	RM01		10,000.00
1	100050		NEWBATCH01	RM01		100
1	100050		NEWBATCH01	PM01		200
1	100050		NEWBATCH01	PM01		41
1	100050		NEWBATCH01	RM01		100
1	100050		BATCH1		RM01		10
1	100050		BATCH1		RM01		10
1	100050		123456		RM01		10
1	100050		123456		RM01		10
							120,370.00
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLEASE FIND HEREWITH THE CODE&lt;/P&gt;&lt;P&gt;it_final1[] = it_Final[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: WA_MANDT TYPE MANDT,&lt;/P&gt;&lt;P&gt;      WA_MATNR TYPE MARA-MATNR,&lt;/P&gt;&lt;P&gt;      WA_WERKS TYPE MSEG-WERKS,&lt;/P&gt;&lt;P&gt;      WA_LGORT TYPE MSEG-LGORT,&lt;/P&gt;&lt;P&gt;      WA_CHARG TYPE MSEG-CHARG,&lt;/P&gt;&lt;P&gt;      WA_BUDAT TYPE BUDAT,&lt;/P&gt;&lt;P&gt;      WA_MEINS TYPE MSEG-MEINS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_final1.&lt;/P&gt;&lt;P&gt;MOVE: IT_FINAL1-MATNR TO WA_MATNR,&lt;/P&gt;&lt;P&gt;      IT_FINAL1-CHARG TO WA_CHARG,&lt;/P&gt;&lt;P&gt;      IT_FINAL1-LGORT TO WA_LGORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on change of it_final1-MATNR.&lt;/P&gt;&lt;P&gt;sum.&lt;/P&gt;&lt;P&gt;I_STOCK-MATNR = WA_MATNR.&lt;/P&gt;&lt;P&gt;I_STOCK-CHARG = WA_CHARG.&lt;/P&gt;&lt;P&gt;I_STOCK-LGORT = WA_LGORT.&lt;/P&gt;&lt;P&gt;I_STOCK-lbkum = IT_FINAL1-DR_STOCK - IT_FINAL1-CR_STOCK.&lt;/P&gt;&lt;P&gt;APPEND I_STOCK.&lt;/P&gt;&lt;P&gt;ENDon.&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;Output after the code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;plant	material	batch		storagelocation	quantity
1	100050		NEWBATCH02	RM01		120,370.00
1	100050		NEWBATCH01	RM01		120,370.00
1	100050		NEW10		RM01		120,370.00
1	100050		NEWBATCH01	RM01		120,370.00
1	100050		NEW561		PM01		120,370.00
1	100050		BATCH1		RM01		120,370.00
1	100050		NEW561		PM01		120,370.00
1	100050		123456		RM01		120,370.00
1	100050		NEW561		PM01		120,370.00
1	100050		NEW10		RM01		120,370.00
1	100050		NEW561		PM01		120,370.00
1	100050		NEWBATCH02	RM01		120,370.00
1	100050		NEWBATCH01	RM01		120,370.00
1	100050		NEWBATCH01	PM01		120,370.00
1	100050		NEWBATCH01	RM01		120,370.00
1	100050		BATCH1		RM01		120,370.00
1	100050		123456		RM01		120,370.00&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the actual output summary i want&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;plant	material	batch		storagelocation	quantity
1	100050		123456		RM01		10
1	100050		BATCH1		RM01		10
1	100050		NEW10		RM01		50
1	100050		NEW561		PM01		9
1	100050		NEWBATCH01	PM01		241
1	100050		NEWBATCH01	RM01		110,050.00
1	100050		NEWBATCH02	RM01		10,000.00
							120,370.00&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is how i want. Please advise where i am wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You,&lt;/P&gt;&lt;P&gt;Jitesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 07:12:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865519#M1137659</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T07:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting summary value in a ZTABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865520#M1137660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i want the sum to be based on Plant,Material,StorageLocation &amp;amp; Batch. What should i do?&lt;/P&gt;&lt;P&gt;Pl suggesst.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jitesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 07:17:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865520#M1137660</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T07:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting summary value in a ZTABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865521#M1137661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok then Sort your internal table by plant, material, batch and storage location(all the fields on which u want it).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after that try the code as i have given in above reply&lt;/P&gt;&lt;P&gt;except "at new plant" use "at new storage".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use the rest code same as in my previous reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp; i didnt understand wat u r doing by the below stsmnt in ur code:&lt;/P&gt;&lt;P&gt;I_STOCK-lbkum = IT_FINAL1-DR_STOCK - IT_FINAL1-CR_STOCK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if this is ur quantity field then u ll get the total qty after sum into the work area(wa) u r using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz try this one if it works 7 let me know for more details if some problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Pankaj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 07:29:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865521#M1137661</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T07:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting summary value in a ZTABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865522#M1137662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it_final1] = it_Final[.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: WA_MANDT TYPE MANDT,&lt;/P&gt;&lt;P&gt;WA_MATNR TYPE MARA-MATNR,&lt;/P&gt;&lt;P&gt;WA_WERKS TYPE MSEG-WERKS,&lt;/P&gt;&lt;P&gt;WA_LGORT TYPE MSEG-LGORT,&lt;/P&gt;&lt;P&gt;WA_CHARG TYPE MSEG-CHARG,&lt;/P&gt;&lt;P&gt;WA_BUDAT TYPE BUDAT,&lt;/P&gt;&lt;P&gt;WA_MEINS TYPE MSEG-MEINS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort it_final1 by werks matnr charg lgort.&lt;/P&gt;&lt;P&gt;loop at it_final1.&lt;/P&gt;&lt;P&gt;i_stock = it_final1.&lt;/P&gt;&lt;P&gt;at new lgort.&lt;/P&gt;&lt;P&gt;sum.&lt;/P&gt;&lt;P&gt;l_stock-menge = it_final1-menge.  " &lt;EM&gt;This is the sume of the Quantity u r looking for&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I_STOCK-lbkum = IT_FINAL1-DR_STOCK - IT_FINAL1-CR_STOCK.&lt;/P&gt;&lt;P&gt;APPEND I_STOCK.&lt;/P&gt;&lt;P&gt;ENDat.&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;i think this ll be the code in ur case with the field names of ur table as u defined while defining interanal table &amp;amp; work area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if still any problem plz let me know, &amp;amp; wat is the problem or o/p u r getting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;Pankaj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 07:38:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-summary-value-in-a-ztable/m-p/4865522#M1137662</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T07:38:18Z</dc:date>
    </item>
  </channel>
</rss>

