<?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 Package Size in Select Query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/package-size-in-select-query/m-p/3214985#M766573</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT KSCHL&lt;/P&gt;&lt;P&gt;       VKORG&lt;/P&gt;&lt;P&gt;       VTWEG&lt;/P&gt;&lt;P&gt;       MATNR&lt;/P&gt;&lt;P&gt;       DATBI&lt;/P&gt;&lt;P&gt;       DATAB&lt;/P&gt;&lt;P&gt;       KNUMH&lt;/P&gt;&lt;P&gt;       FROM A304 &lt;/P&gt;&lt;P&gt;       INTO TABLE Itab2&lt;/P&gt;&lt;P&gt;       WHERE KFRST = ' '.&lt;/P&gt;&lt;P&gt;I want to replace the above select statement by the following.&lt;/P&gt;&lt;P&gt;SELECT KSCHL&lt;/P&gt;&lt;P&gt;       VKORG&lt;/P&gt;&lt;P&gt;       VTWEG&lt;/P&gt;&lt;P&gt;       MATNR&lt;/P&gt;&lt;P&gt;       DATBI&lt;/P&gt;&lt;P&gt;       DATAB&lt;/P&gt;&lt;P&gt;       KNUMH&lt;/P&gt;&lt;P&gt;       FROM A304 APPENDING CORRESPONDING FIELDS OF  ITAB2 &amp;lt;b&amp;gt;PACKAGE SIZE 1000&amp;lt;/b&amp;gt;    &lt;/P&gt;&lt;P&gt;       WHERE KFRST = ' '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On what basis is the figure in the package size be defined.I  mean on what basis we can decide that no.1000?Will the above select statement improve performance as desired?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Kiran K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Kiran K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Dec 2007 05:37:52 GMT</pubDate>
    <dc:creator>kiran_k8</dc:creator>
    <dc:date>2007-12-11T05:37:52Z</dc:date>
    <item>
      <title>Package Size in Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/package-size-in-select-query/m-p/3214985#M766573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT KSCHL&lt;/P&gt;&lt;P&gt;       VKORG&lt;/P&gt;&lt;P&gt;       VTWEG&lt;/P&gt;&lt;P&gt;       MATNR&lt;/P&gt;&lt;P&gt;       DATBI&lt;/P&gt;&lt;P&gt;       DATAB&lt;/P&gt;&lt;P&gt;       KNUMH&lt;/P&gt;&lt;P&gt;       FROM A304 &lt;/P&gt;&lt;P&gt;       INTO TABLE Itab2&lt;/P&gt;&lt;P&gt;       WHERE KFRST = ' '.&lt;/P&gt;&lt;P&gt;I want to replace the above select statement by the following.&lt;/P&gt;&lt;P&gt;SELECT KSCHL&lt;/P&gt;&lt;P&gt;       VKORG&lt;/P&gt;&lt;P&gt;       VTWEG&lt;/P&gt;&lt;P&gt;       MATNR&lt;/P&gt;&lt;P&gt;       DATBI&lt;/P&gt;&lt;P&gt;       DATAB&lt;/P&gt;&lt;P&gt;       KNUMH&lt;/P&gt;&lt;P&gt;       FROM A304 APPENDING CORRESPONDING FIELDS OF  ITAB2 &amp;lt;b&amp;gt;PACKAGE SIZE 1000&amp;lt;/b&amp;gt;    &lt;/P&gt;&lt;P&gt;       WHERE KFRST = ' '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On what basis is the figure in the package size be defined.I  mean on what basis we can decide that no.1000?Will the above select statement improve performance as desired?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Kiran K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Kiran K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2007 05:37:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/package-size-in-select-query/m-p/3214985#M766573</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-12-11T05:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Package Size in Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/package-size-in-select-query/m-p/3214986#M766574</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;&lt;/P&gt;&lt;P&gt;... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE itab [PACKAGE SIZE n] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;If the result set consists of multiple lines, an internal table itab of any table type can be specified after INTO or APPENDING. The row type of the internal table must meet the prerequisites. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result set is inserted into the internal table itab line-by-line; a sorting process is executed in the case of a sorted table. If INTO is used, the internal table is initialized before the first line is inserted. Previous lines remain intact if APPENDING is used. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before any assignment of a line of the result set, an initial row of the internal table itab is created and the line of the result set is assigned to this row. When assigning a line of the result set to a row of the internal table with or without CORRESPONDING FIELDS, the same rules apply as when assigning to an individual work area wa (see above). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the PACKAGE SIZE addition is not used, all lines of the result set are inserted in the internal table itab and the ENDSELECT statement must not be specified after SELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you specify the PACKAGE SIZE addition, all lines of the result set for SELECT are processed in a loop, which must be closed with ENDSELECT. The lines are inserted in the internal table itab in packages of n lines. n must be a type i data object that contains the number of lines. If the value of n is smaller than 0, an exception that cannot be handled occurs. If n is equal to 0, all lines of the result set are inserted in the internal table itab. If used in the FETCH statement, n lines are extracted from the current cursor position. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If INTO is used, the internal table is initialized before each insertion and, in the SELECT loop, it only contains the lines of the current package. If APPENDING is used, a further package is added to the existing rows of the internal table for each SELECT loop or for each extraction using FETCH. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After ENDSELECT, the content of itab is not defined if INTO is used - that is, the table can either contain the lines of the last package or it can be initial. If APPENDING is used, the content of itab retains the state of the last loop pass. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes &lt;/P&gt;&lt;P&gt;In the case of an internal table with a unique key, an exception that cannot be handled occurs if an attempt is made to create a duplicate entry. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the addition PACKAGE SIZE is specified together with FOR ALL ENTRIES, it is not passed to the database system, but is applied to the result set on the application server, after all selected rows have been read. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this example, all columns of the result set are read into an internal table whose row type is a nested structure with the same construction as the result set. Note that in practice, the column carrid exists twice in the result set with the same content and, after the assignment, this content is stored redundantly in the columns struc1-carrid and struc2-carrid of the internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF wa, &lt;/P&gt;&lt;P&gt;        struc1 TYPE scarr, &lt;/P&gt;&lt;P&gt;        struc2 TYPE spfli, &lt;/P&gt;&lt;P&gt;      END OF wa. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA itab LIKE SORTED TABLE OF wa &lt;/P&gt;&lt;P&gt;          WITH UNIQUE KEY table_line. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * &lt;/P&gt;&lt;P&gt;       FROM scarr &lt;/P&gt;&lt;P&gt;         INNER JOIN spfli ON scarr&lt;SUB&gt;carrid = spfli&lt;/SUB&gt;carrid &lt;/P&gt;&lt;P&gt;       INTO TABLE itab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO wa. &lt;/P&gt;&lt;P&gt;  WRITE: / wa-struc1-carrid, &lt;/P&gt;&lt;P&gt;           wa-struc1-carrname, &lt;/P&gt;&lt;P&gt;           wa-struc2-connid. &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;&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;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2007 05:41:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/package-size-in-select-query/m-p/3214986#M766574</guid>
      <dc:creator>former_member386202</dc:creator>
      <dc:date>2007-12-11T05:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Package Size in Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/package-size-in-select-query/m-p/3214987#M766575</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;PACKAGE SIZE n &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Works like ... INTO wa, except that the selected data is not placed in the internal table itab line by line, but in packets of n lines. The old contents of itab are overwritten. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;n &amp;lt;= 0 causes a runtime error. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internally, n is placed in a type I field. Here, the usual conversion rules apply (see MOVE). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After leaving the processing loop, the contents of the internal table itab are undefined. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the result of the selection is a table, the data is retrieved in a processing loop introduced by SELECT and concluded by ENDSELECT. The processing passes through the loop once for each line read. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;Output a list of all airlines (with short description and name): &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: itab TYPE STANDARD TABLE OF SCARR WITH NON-UNIQUE &lt;/P&gt;&lt;P&gt;DEFAULT KEY INITIAL SIZE 10. &lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;FS&amp;gt; TYPE scarr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * INTO TABLE itab PACKAGE SIZE 20 FROM scarr. &lt;/P&gt;&lt;P&gt;LOOP AT itab ASSIGNING &amp;lt;FS&amp;gt;. &lt;/P&gt;&lt;P&gt;WRITE: / &amp;lt;FS&amp;gt;-carrid, &amp;lt;FS&amp;gt;-carrname. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Package size can be used if you for example only want to finish processing a limited amount of data at a time due to lack of memory. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example below read 50 records at a time from VBAK into an internal table, and selects the corresponding entries from vbap into an internal table. Then the two internal tables can be processed, and the next 50 records from VBAk can be read. Remember to reinitialize tha tables before the next read. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT z_test. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: &lt;/P&gt;&lt;P&gt;  BEGIN OF t_vbak, &lt;/P&gt;&lt;P&gt;    vbeln LIKE vbak-vbeln, &lt;/P&gt;&lt;P&gt;    erdat LIKE vbak-erdat, &lt;/P&gt;&lt;P&gt;  END OF t_vbak, &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  BEGIN OF t_vbap, &lt;/P&gt;&lt;P&gt;    posnr  LIKE vbap-posnr, &lt;/P&gt;&lt;P&gt;    matnr  LIKE vbap-matnr, &lt;/P&gt;&lt;P&gt;    meins  LIKE vbap-meins, &lt;/P&gt;&lt;P&gt;  END OF t_vbap, &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  BEGIN OF t_report, &lt;/P&gt;&lt;P&gt;    vbeln LIKE vbak-vbeln, &lt;/P&gt;&lt;P&gt;    erdat LIKE vbak-erdat, &lt;/P&gt;&lt;P&gt;    posnr  LIKE vbap-posnr, &lt;/P&gt;&lt;P&gt;    matnr  LIKE vbap-matnr, &lt;/P&gt;&lt;P&gt;    meins  LIKE vbap-meins, &lt;/P&gt;&lt;P&gt;  END OF t_report. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA: &lt;/P&gt;&lt;P&gt;  li_vbak   TYPE t_vbak OCCURS 0, &lt;/P&gt;&lt;P&gt;  l_vbak    TYPE  t_vbak, &lt;/P&gt;&lt;P&gt;  li_vbap   TYPE t_vbap OCCURS 0, &lt;/P&gt;&lt;P&gt;  l_vbap    TYPE t_vbap, &lt;/P&gt;&lt;P&gt;  li_report TYPE t_report OCCURS 0, &lt;/P&gt;&lt;P&gt;  l_report  TYPE t_report. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;START-OF-SELECTION. &lt;/P&gt;&lt;P&gt;  SELECT vbeln erdat &lt;/P&gt;&lt;P&gt;    FROM vbak &lt;/P&gt;&lt;P&gt;    INTO TABLE li_vbak PACKAGE SIZE 50. &lt;/P&gt;&lt;P&gt;    SELECT posnr matnr meins &lt;/P&gt;&lt;P&gt;      FROM vbap &lt;/P&gt;&lt;P&gt;      INTO TABLE li_vbap &lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN li_vbak &lt;/P&gt;&lt;P&gt;      WHERE vbeln = li_vbak-vbeln. &lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0. &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Now you have the two internal tables li_vbak and li_vbap filled &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  with data. &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Do something with the data - remember to reinitialize internal &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  tables &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    ENDIF. &lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2007 07:16:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/package-size-in-select-query/m-p/3214987#M766575</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-11T07:16:06Z</dc:date>
    </item>
  </channel>
</rss>

