sitemap
SapMaterial.com
Package size in SELECT statements

Package size can be used to retreive a spcific number of records at a time. This can be used if you
for example only want tofinish  processing a limited amount of data at a time due to lack of memory.

The exampel 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. remeber to reinitialize tha tables before
the next read.

Note the usage of SELECT - ENDSELECT !

REPORT  z_test                        .

TYPES:
BEGIN OF t_vbak,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
END OF t_vbak,
BEGIN OF t_vbap,

posnr  LIKE vbap-posnr,
matnr  LIKE vbap-matnr,
meins  LIKE vbap-meins,
END OF t_vbap,
BEGIN OF t_report,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
posnr  LIKE vbap-posnr,
matnr  LIKE vbap-matnr,
meins  LIKE vbap-meins,
END OF t_report.

DATA:
li_vbak   TYPE t_vbak OCCURS 0,
l_vbak    TYPE  t_vbak,
li_vbap   TYPE t_vbap OCCURS 0,
l_vbap    TYPE t_vbap,
li_report TYPE t_report OCCURS 0,
l_report  TYPE t_report.


START-OF-SELECTION.

SELECT vbeln erdat
FROM vbak
INTO TABLE li_vbak PACKAGE SIZE 50.

SELECT posnr matnr meins
FROM vbap
INTO TABLE li_vbap
FOR ALL ENTRIES IN li_vbak
WHERE vbeln = li_vbak-vbeln.
IF sy-subrc = 0.
*   Now you have the two internal tables li_vbak and liÆ_vbap filled with data.
*   Do something with the data - remember to reinitialize internal tables
ENDIF.

ENDSELECT.
All of the  product names here are trademarks of their respective companies.  The site
www.allsaplinks.com no way affiliated with SAP AG. We have made every effort for the content
integrity.  Information used on this site is at your own risk.
ABAP TECHNICAL

SAP Introduction

sap abap faq

sap Tables

SAP Transaction codes

Internal tables

data dictionary

performance tuning

transports & Requests

Sap scripts

Smartforms

lsmw

reports

sap Workflow

module pool/ dialog
programming

table control

user exits

sap memory

abap memory

alv reports

ABAP ADVANCED

IDOC

ALE

BAPI

BADI

RFC


FUNCTIONAL SIDE

Materials Management

FICO

Human Resources

BIW / BW / SEM


Free Documentation
Abap Material

Ale Material

BAPI Material

BC Material

IDOC Material

R/3 Database Management

SAP material

RFC

Transport

Sales & Distribution Material

Basic Data and Function
Material

Basis (BC) Material

Billing Material

CA Material

CATT : Computer Aided Test
Tool

Capacity Evaluation and
leveling Material

Capacity Planning Material

Cross Application Material

Countries

Customer Service Material

Enterpise  Material

Financial / Controlling (FICO)

Internet Time Sheet

Inspection Material

HR Material

Material Management
Material

Payments Material

Payroll Material

Pension Fund

Production Planning and
Control

Plant Maintenance

Quality Management Material

Real Estate Material

SAP material

Wage Types