<?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: performance on the create internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625400#M1281070</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;Both statements create internal table (reserve appropriate memory area). &lt;/P&gt;&lt;P&gt;In first situation only 3 fields are created, in the latter all fields from &lt;EM&gt;mara&lt;/EM&gt; table are included here. &lt;/P&gt;&lt;P&gt;There is no point to have all the fields (i.e. 20) and use only 3 of them. &lt;/P&gt;&lt;P&gt;In each internal table row we would have 17 fields empty. So our memory here is "licking".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option 2 would be better if you later in program use select stamenent at MARA table where all the entries be stored internally in program (for further execution) and only if the rest 17 fields are really needed for calculation. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is case comparable to &lt;EM&gt;select&lt;/EM&gt; statement, where you can choose all fields&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select * from ...  "bad performance as system has to transport unecessary data from DB
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or project them (select particular fields only)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select field1 field2 from...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alwasy try to consider how much memory will be reserved, how much data will be transported (in select statement) and get rid of unnecessary (not used) declaration. Golden rule: &lt;STRONG&gt;the less, the better&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 May 2009 06:58:28 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2009-05-17T06:58:28Z</dc:date>
    <item>
      <title>performance on the create internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625398#M1281068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;what is more performing, a creation of a internal table field one at a time or refer all standard table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exemple:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of ti_mara occurs 0,&lt;/P&gt;&lt;P&gt;matnr type mara-matnr,&lt;/P&gt;&lt;P&gt;mtart type mara-mtart,&lt;/P&gt;&lt;P&gt;seinr type mara-zeinr,&lt;/P&gt;&lt;P&gt;end of ti_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: ti_mara type mara occurs 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, here i would like use matnr, mtart and seinr... but i used all table on the last command, this cause a bad performance?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you for your attention,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 May 2009 02:36:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625398#M1281068</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-17T02:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: performance on the create internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625399#M1281069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok first thing is OCCURS 0 should not be used to define internal table as it not confirming the Object Oriented ABAP standards. OCCURS 0 is considered an obsolete command extension&lt;/P&gt;&lt;P&gt;So now you have 2 options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
1) DATA:
  ti_mara    TYPE STANDARD TABLE OF mara.

2) TYPES: 
BEGIN OF TYPE i_mara,
matnr type mara-matnr,
mtart type mara-mtart,
seinr type mara-zeinr,
END OF TYPE i_mara.

* This is recommended in your case
DATA i_mara TYPE STANDARD TABLE OF typ_final,
wa_mara TYPE typ_final. "Work area If required
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case i think you should go for &lt;STRONG&gt;option 2 rather than defining the internal table for Entire table MARA as this will allocate extra memory for the unrequired fields and hence bad performance&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shital&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 May 2009 04:43:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625399#M1281069</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-17T04:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: performance on the create internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625400#M1281070</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;Both statements create internal table (reserve appropriate memory area). &lt;/P&gt;&lt;P&gt;In first situation only 3 fields are created, in the latter all fields from &lt;EM&gt;mara&lt;/EM&gt; table are included here. &lt;/P&gt;&lt;P&gt;There is no point to have all the fields (i.e. 20) and use only 3 of them. &lt;/P&gt;&lt;P&gt;In each internal table row we would have 17 fields empty. So our memory here is "licking".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option 2 would be better if you later in program use select stamenent at MARA table where all the entries be stored internally in program (for further execution) and only if the rest 17 fields are really needed for calculation. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is case comparable to &lt;EM&gt;select&lt;/EM&gt; statement, where you can choose all fields&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select * from ...  "bad performance as system has to transport unecessary data from DB
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or project them (select particular fields only)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select field1 field2 from...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alwasy try to consider how much memory will be reserved, how much data will be transported (in select statement) and get rid of unnecessary (not used) declaration. Golden rule: &lt;STRONG&gt;the less, the better&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 May 2009 06:58:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625400#M1281070</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-05-17T06:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: performance on the create internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625401#M1281071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please reserve the expression 'bad performance* fro something with relevance and not&lt;/P&gt;&lt;P&gt;for effect of 200 microseconds versus 250 microseconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 May 2009 19:57:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625401#M1281071</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-17T19:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: performance on the create internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625402#M1281072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 2 ways by which u can create an internal table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Internal table with header line&lt;/P&gt;&lt;P&gt;2) Internal tab;e without header line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The one which you have defined are internal table with header line and if you use occurs 0 system by default allocates a memory of 8 kb even though your data is less than that. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to create internal tables without header line, where data is passed into work area. Also there is no memory wastage in this case as it will allocated dynamically as an when data is passed into the work area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you definining an internal table, pass only those fields that are required to be fetched from the database rather than taking all the fields of that table, this will drastically improve the perfromance, also use Primary index in the where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this might be useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prashant Gaikwad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2009 04:59:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625402#M1281072</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-18T04:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: performance on the create internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625403#M1281073</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;Now a days , we are not supposed to use internal table with header line or internal table without header line. &lt;/P&gt;&lt;P&gt;Always try to use internal table and work area. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Always try to declare  the fields in the type declaration,  which you want to fetch from the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See below a sample code. Always try to use data elements in the declaration (matnr)  and not like this (mara-matnr).&lt;/P&gt;&lt;P&gt;**Type declaration&lt;/P&gt;&lt;P&gt;types: begin of ty_mara,&lt;/P&gt;&lt;P&gt;           matnt type matnr,&lt;/P&gt;&lt;P&gt;           ersda type ersda,&lt;/P&gt;&lt;P&gt;           aenam type aenam,&lt;/P&gt;&lt;P&gt;          end of ty_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Internal table declaration and work area declaration&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;data: it_mara type standard table of ty_mara, &lt;/P&gt;&lt;P&gt;        wa_mara type ty_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**Fetch data&lt;/P&gt;&lt;P&gt;Select matnr &lt;/P&gt;&lt;P&gt;          ersda &lt;/P&gt;&lt;P&gt;          aenam &lt;/P&gt;&lt;P&gt;          from mara &lt;/P&gt;&lt;P&gt;          into table it_mara&lt;/P&gt;&lt;P&gt;          where matnr  eq -&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**Read the internal table data through work area  or loop the internal table through work area for further processing data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_mara into wa_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table it_mara into wa_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you and make you clear.&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;Ramesh Sundaram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 10:18:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-on-the-create-internal-table/m-p/5625403#M1281073</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-25T10:18:18Z</dc:date>
    </item>
  </channel>
</rss>

