Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use PACKET SIZE in order to fetch huge volume of data.

Former Member
0 Kudos

Hi all,

Can anyone please suggest me or send a piece of code how to use PACKET SIZE concept in program to make fetching huge amount of data easier..

Regards,

Neha

5 REPLIES 5

Former Member
0 Kudos

Hi Neha

Try to use the following version of the SELECT statement:

SELECT * FROM (g_table)

APPENDING INTO CORRESPONDING FIELDS OF TABLE <l_fs_dyn_table>

PACKAGE SIZE 1000 " perhaps reduce this number

FOR ALL ENTRIES IN t_pa0001

WHERE pernr = t_pa0001-pernr.

ENDSELECT.

Chandra

Message was edited by:

Chandra

Message was edited by:

Chandra

Former Member
0 Kudos

hi neha,

When you read several lines of a database table, you can place them in an internal table. To do this, use the following in the INTO clause:

SELECT ... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE <itab>
                          [PACKAGE SIZE <n>] ...

The same applies to the line type of <itab>, the way in which the data for a line of the database table are assigned to a table line, and the CORRESPONDING FIELDS addition as for flat work areas (see above).

The internal table is filled with all of the lines of the selection. When you use INTO, all existing lines in the table are deleted. When you use APPENDING; the new lines are added to the existing internal table <itab>. With APPENDING, the system adds the lines to the internal table appropriately for the table type. Fields in the internal table not affected by the selection are filled with initial values.

If you use the PACKAGE SIZE addition, the lines of the selection are not written into the internal table at once, but in packets. You can define packets of <n> lines that are written one after the other into the internal table. If you use INTO, each packet replaces the preceding one. If you use APPENDING, the packets are inserted one after the other. This is only possible in a loop that ends with ENDSELECT. Outside the SELECT loop, the contents of the internal table are undetermined. You must process the selected lines within the loop.

<b>Pls reward if helpful.</b>

Simha_
Employee
Employee
0 Kudos

Hi,

Using PACKAGE SIZE in SELECT statement when size of resultant itab is significant in size (e.g. when row width and volume of rows is large). Instead of retrieving all data in one select statement a select loop is executed multiple times providing a data package for each loop.

Do not use APPENDING TABLE with PACKAGE SIZE.

The use of PACKAGE SIZE is not recommended if FOR ALL ENTRIES is being used because FAEI defines it’s own package size

Example:

SELECT VBELN PSTYV VGBEL VGPOS FROM LIPS

INTO TABLE T_LIPS

PACKAGE SIZE 10000.

LOOP AT T_LIPS.

…….

ENDLOOP.

ENDSELECT.

In this example 10,000 lines are added to the internal table T_LIPS during each select loop.

Cheers,

SImha.

Former Member
0 Kudos

Hi Narsimha,

Thanx for your reply.

But i have one query.I have lot of select statements in which i have to use FOR ALL ENTRIES.Kindly suggest how to do this.

PACKET SIZE and PACKAGE SIZE both are different.

Kindly suggest me about PACKET SIZE.

Regards,

Neha.

Former Member
0 Kudos

open cursor with hold l_cursor

for select * from <yourtable> where ....

do.

fetch next cursor l_cursor

into corresponding fields of

table itab

package size l_packagesize.

describe table itab lines stat-found.

if stat-found = 0.

exit.

endif.

loop at itab.

...

endloop.