Performance Part 9: Package Processing for Large Data Volumes
Preview · a free account unlocks the full lesson
Process millions of records safely: SELECT … PACKAGE SIZE with ENDSELECT, OPEN CURSOR WITH HOLD / FETCH NEXT CURSOR, committing between packages, restartability, memory limits, and parallel processing with background jobs or aRFC for very large runs.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Parts 4 through 8 made each individual read efficient. For very large data volumes, though, the structure of the program itself needs to change, and that's what this part covers.
The reasoning behind processing in packages comes down to a few things at once. Memory stays bounded by the package size, rather than growing with the full data volume. Reading millions of rows into one internal table can exhaust memory (TSV_TNEW_PAGE_ALLOC_FAILED); process in packages instead. Commits also matter: a single long-running LUW holds locks and rollback segments for its entire duration, while processing in packages allows commits along the way. And packages naturally give you progress tracking and restart points as a side effect.
The simplest form of this is SELECT … INTO TABLE lt_pkg PACKAGE SIZE 10000 … ENDSELECT. SELECT … INTO TABLE … PACKAGE SIZE n … ENDSELECT processes n rows per pass; OPEN CURSOR / FETCH NEXT CURSOR … PACKAGE SIZE gives more control. Here, lt_pkg gets overwritten on each pass through the loop, and committing inside the loop is not allowed — doing so closes the cursor and causes the dump DBIF_RSQL_INVALID_CURSOR.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Related SAP topics
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.