ERPClimb logoERPClimb
Draft Handling
RAP / CDS / ODataintermediate 9 min read

Draft Handling Part 2: Draft Lifecycle — Create, Edit, Resume, Activate, Discard

Preview · a free account unlocks the full lesson

Key takeaway

Follow the draft lifecycle step by step — new draft, Edit, Resume, Prepare, Activate and Discard — and see what happens in the data, the locks and the UI at each step.

In this lessonShow sections

Explanation

Part 1 explained draft and active instances. This part walks through each lifecycle step in turn, covering both what the user sees and what happens technically underneath.

Creating a new object starts when the user clicks Create in the list report. Technically, this is a CREATE with %is_draft = mk-on, so only a draft instance exists and no active data yet; determinations on modify run, such as defaulting the status, and the user sees an object page carrying "Draft" status.

Editing an existing object starts when the user clicks Edit on an active object. Technically, the draft action Edit copies the active instance, along with its children, into the draft tables and sets an exclusive lock on the active instance. Other users immediately see "Locked by <user>." If the user already has a draft for this object, Edit fails, and the UI instead offers to continue the existing draft.

Changing fields is straightforward: every field change is an UPDATE on the draft instance, saved immediately into the draft tables. Determinations on modify run as usual, and side effects tell the UI which fields need refreshing — nothing in the active data changes at this point.

Free account

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

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.