Application Development and Automation 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: 
Read only

regarding package size in select statement

Former Member
0 Likes
1,061

Hi,

i have coded select statement as below.

data: lv_n type i value 10000.

  • lv_n1 TYPE i VALUE 10000.

  • Fetching data from mara and A073

select a~matnr "article code

a~mtart "article type

a~matkl "mc code

a~meins "UOM

a~satnr "Style Code

b~kappl "application

b~kschl "condition type

b~vkorg "s.org

b~vrkme "sales unit

b~datbi " to date

b~datab " from date

b~knumh "condition record number

from mara as a

inner join

a073 as b on amatnr = bmatnr

into table it_mara

package size lv_n

where a~matnr in s_matnr

and a~mtart in s_mtart

and a~matkl in s_matkl

and b~vkorg = p_vkorg

and b~datab in s_date.

endselect.

if sy-subrc eq 0.

sort it_mara by matnr matkl.

endif.

now the issue is as i have given 10000 for lv_n onli 10000 records are displayed or all the records are displayed?

Hi,

i have coded select statement as below.

data: lv_n type i value 10000.

  • lv_n1 TYPE i VALUE 10000.

  • Fetching data from mara and A073

select a~matnr "article code

a~mtart "article type

a~matkl "mc code

a~meins "UOM

a~satnr "Style Code

b~kappl "application

b~kschl "condition type

b~vkorg "s.org

b~vrkme "sales unit

b~datbi " to date

b~datab " from date

b~knumh "condition record number

from mara as a

inner join

a073 as b on amatnr = bmatnr

into table it_mara

package size lv_n

where a~matnr in s_matnr

and a~mtart in s_mtart

and a~matkl in s_matkl

and b~vkorg = p_vkorg

and b~datab in s_date.

endselect.

if sy-subrc eq 0.

sort it_mara by matnr matkl.

endif.

now the issue is as i have given 10000 for lv_n onli 10000 records are displayed or all the records are displayed?

6 REPLIES 6
Read only

Former Member
0 Likes
862

All will be, but at one shot it will pull only 10000.

It will pull like first 10000 at one shot and then next 10000....and so on... if you use append in between select and endselect all records will be captured. If you dont then it will replace captured records and update with the next bunch...and so on.

In your case it will have last 10000 or less number of records...

Edited by: Satya suresh Donepudi on May 11, 2009 7:53 AM

Read only

Former Member
0 Likes
862

Hi,

your select will fetch only last 10000 records.

so maintain all the logic between select....& endselct.

Use the Endselct statement after dispalying the records.


select a~matnr "article code
a~mtart "article type
a~matkl "mc code
a~meins "UOM
a~satnr "Style Code
b~kappl "application
b~kschl "condition type
b~vkorg "s.org
b~vrkme "sales unit
b~datbi " to date
b~datab " from date
b~knumh "condition record number
from mara as a
inner join
a073 as b on a~matnr = b~matnr
into table it_mara
package size lv_n
where a~matnr in s_matnr
and a~mtart in s_mtart
and a~matkl in s_matkl
and b~vkorg = p_vkorg
and b~datab in s_date.

if sy-subrc eq 0.
sort it_mara by matnr matkl.
endif.

* displaying data ...if required

endselect.

regards,

Naveen

Read only

Former Member
0 Likes
862

the output is 10000 or less.

if the selct query where condition satisfies more than 10000 ,it shows the last 10000 satisfid records.

if the selct query where condition satisfies less than 10000 it shows the satisfid records.

Regards,

Prabhudas

Edited by: Prabhu Das on May 11, 2009 6:17 PM

Read only

0 Likes
862

where to keep append statement? and whether this statement is performance issue?

Read only

0 Likes
862

Hi,

Below I have mentioned, where you need to add 'APPENDING'. Please check the code.

Hope this helps!

This should not create a Performance issue, but the internal Table will keep on building in size

depending on the volume of records to be picked. In some scenarios where there are millions

of records processed during a single execution, it might cause Memory overflow and cause dumps.

Regards,

Chandy

  • Fetching data from mara and A073

select a~matnr "article code

a~mtart "article type

a~matkl "mc code

a~meins "UOM

a~satnr "Style Code

b~kappl "application

b~kschl "condition type

b~vkorg "s.org

b~vrkme "sales unit

b~datbi " to date

b~datab " from date

b~knumh "condition record number

from mara as a

inner join

a073 as b on amatnr = bmatnr

  • into table it_mara "Comment old code

APPENDING TABLE it_mara "New Code

package size lv_n

where a~matnr in s_matnr

and a~mtart in s_mtart

and a~matkl in s_matkl

and b~vkorg = p_vkorg

and b~datab in s_date.

endselect.

if sy-subrc eq 0.

sort it_mara by matnr matkl.

endif.

Read only

0 Likes
862

What's the point of specifying "package size" if you are going to just append to an internal table? Wouldn't you be better off not using package size at all?

The idea is to prevent memory overflow. When you receive data in chunks of 10000 rows, you are supposed to process the data, REDUCE THE MEMORY FOOTPRINT, and then get the next chunk.