Behavior Implementations Part 4: Save Sequence, Late Numbering and Unmanaged Save
Preview · a free account unlocks the full lesson
Know what belongs in the saver class of each implementation type: when a managed BO needs a saver at all, how late numbering works with adjust numbers, and how save modified implements additional save and unmanaged save.
In this lessonShow sectionsHide sections
Explanation
Plain managed business objects need no saver class at all. Late numbering calls for adjust_numbers, while extra persistence calls for save_modified. save_modified runs exactly once per successful save, which makes it ideal for things like change logs. One rule to hold onto: no checks, commits or EML changes belong in the save phase.
Parts 1 through 3 covered handler classes. The saver class, inheriting from cl_abap_behavior_saver, holds the code for the save sequence. Unmanaged RAP Part 4 covers the full unmanaged saver in depth; this lesson looks at the saver from the perspective of implementation type, with a particular focus on managed business objects.
The saver methods run in a fixed order. finalize handles the last derivations and may report errors. check_before_save runs the final checks and may also report errors, which stops the save if it does. cleanup_finalize runs only if finalize or check_before_save failed, undoing any derivations while keeping the buffer intact. adjust_numbers, used with late numbering, assigns the final keys. save is where unmanaged business objects actually write the buffer — this is the point of no return. save_modified is used by managed business objects with additional save or unmanaged save, receiving the changes that still need to be persisted. cleanup runs after the commit, clearing the buffers. You only ever redefine the methods you actually need.
A plain managed business object doesn't need a saver at all: on-save determinations and validations live in handler methods, and the framework writes the tables on its own. A saver only becomes necessary for late numbering, which needs adjust_numbers; additional save, where the framework still writes but save_modified adds extra work in save_modified; or unmanaged save, where the framework doesn't write at all and save_modified has to do it.
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
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.