<?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: memory problem in internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758284#M904169</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding to Billy's comment, I would suggest to use OPEN CURSOR and FETCH. This is a normal processing technique in BI for data extraction where large number of records are extrated from a source system like R/3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  
  OPEN CURSOR WITH HOLD gv_cursor FOR
    SELECT * 
      FROM table dbtab
      WHERE clause.

  DO.
    FETCH NEXT CURSOR gv_cursor
      INTO TABLE itab
      PACKAGE SIZE p_mxsize.

    IF sy-subrc NE 0.
      CLOSE CURSOR gv_cursor.
      EXIT.
    ELSE.
      "process itab here
    ENDIF.
  ENDDO.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_mxsize is the number of records that should be procesed as a chuck e.g. 2000, 4000 or 5000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sanjeev&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 May 2008 20:01:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-06T20:01:31Z</dc:date>
    <item>
      <title>memory problem in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758277#M904162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;i have nerly 4 cores of records in my database table&lt;/P&gt;&lt;P&gt;now i need to get this data into a internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but i declared my internal table with occurs 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it it going to dump showing TSV_TNEW_PAGE_ALLOC_FAILED because of low memory in the internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can any one tell me how to resolve this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 14:10:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758277#M904162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T14:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: memory problem in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758278#M904163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you really need to select all records at once, you will have to talk to basis administrators about your problem. Better would be to limit the number of records to be selected, or do multiple selects, or something likewise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 14:13:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758278#M904163</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-05-06T14:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: memory problem in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758279#M904164</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;use occurs 10 or something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or else it is better to use declaring structure and then assign internal table of type that structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz reward me if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 14:15:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758279#M904164</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T14:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: memory problem in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758280#M904165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you try with the hashed table type?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 14:16:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758280#M904165</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T14:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: memory problem in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758281#M904166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Internal table can store max of 2GB data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to fetch more than this, then i suggest do it in bunch i.e go for PACKAGE SIZE option in select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT *
FROM &amp;lt;table&amp;gt;
INTO TABLE itab
PACKAGE SIZE &amp;lt;n&amp;gt;.

IF sy-subrc EQ 0.
\*" Process the n records
ENDIF.

ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;G@urav.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 14:18:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758281#M904166</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T14:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: memory problem in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758282#M904167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want process large number of records. So you keep your internal table as buffer in between source and destination system. &lt;/P&gt;&lt;P&gt;Fill your buffer(internal table) and transfer to destination system. Refresh the buffer and again process it in a loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you specify the PACKAGE SIZE addition in a SELECT ... ENDSELECT. &lt;/P&gt;&lt;P&gt;The lines are inserted in the internal table in packages of n lines. &lt;/P&gt;&lt;P&gt;if you use INTO TABLE addition it automatically refresh the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it clarifies why use PACKAGE SIZE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 14:43:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758282#M904167</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T14:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: memory problem in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758283#M904168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since available memory is the issue (I'm assuming this is occurring consistently), you may want to consider creating a database cursor (FETCH) to pull and process records in chunks; clearing internal table(s) before each fetch.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 15:18:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758283#M904168</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T15:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: memory problem in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758284#M904169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding to Billy's comment, I would suggest to use OPEN CURSOR and FETCH. This is a normal processing technique in BI for data extraction where large number of records are extrated from a source system like R/3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  
  OPEN CURSOR WITH HOLD gv_cursor FOR
    SELECT * 
      FROM table dbtab
      WHERE clause.

  DO.
    FETCH NEXT CURSOR gv_cursor
      INTO TABLE itab
      PACKAGE SIZE p_mxsize.

    IF sy-subrc NE 0.
      CLOSE CURSOR gv_cursor.
      EXIT.
    ELSE.
      "process itab here
    ENDIF.
  ENDDO.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_mxsize is the number of records that should be procesed as a chuck e.g. 2000, 4000 or 5000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sanjeev&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 20:01:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758284#M904169</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T20:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: memory problem in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758285#M904170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error TSV_NEW_PAGE_ALLOC_FAILED means that more memory was requested by the system because the program needed to expand an internal table, but not is available. When Extended Memory is completely used up, the process will go into PRIV mode and it will start using Heap Memory in case of Windows or vice versa in case of Unix. Once this enters into PRIV mode, no other user will be able to use the corresponding work process. If there is enough memory for it to finish, You will not see the error.&lt;/P&gt;&lt;P&gt;Note: Internal table can store max of 2GB data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Solution: 1)	Process smaller chunks of data. (E.g. not all 50.000 records at once) is one option.&lt;/P&gt;&lt;P&gt;               2)	Create a memory snapshot right before the program dumps and analyze where the memory is consumed in order to understand if or where you can reduce memory consumption.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2011 17:34:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758285#M904170</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-19T17:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: memory problem in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758286#M904171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ram reddy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry you have to read so much nonsense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note OCCURS does not change anything, this was last milenium when it had any effect&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If page allocation fails, memory has been used over limit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ask basis to give you more, try in background task (more memory in background) or select less data: Strictly avoid SELECT *, think what you really need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2011 21:03:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/memory-problem-in-internal-table/m-p/3758286#M904171</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2011-07-19T21:03:25Z</dc:date>
    </item>
  </channel>
</rss>

