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.
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.
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.
*-- End of Program
Fast Links:
Using Select-Options and Ranges
Difference
Between Select-Options & Ranges
Get help for your ABAP problems
Do you have
a ABAP Question?
SAP Books
SAP Certification,
Functional, Basis Administration and ABAP Programming Reference Books
ABAP Tips
ABAP Forum for Discussion
and Samples Program Codes for Abapers
Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
All product names are trademarks of their respective
companies. The site www.erpgreat.com is in no way affiliated with
SAP AG.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
The content on this site may not be reproduced
or redistributed without the express written permission of
www.erpgreat.com or the content authors.
|