New to SAP RAP / CDS / OData? Start with the module overview
RAP Deep Create with Compositions: Consultant Reference
Quick answer
RAP deep create persists a parent business object and its composition children through one controlled transactional request. Content IDs and entity associations represent relationships, not arbitrary database inserts, so bypassing the association mechanism can leave children technically saved but not properly linked to their parent.
Consultant reference for RAP Deep Create with Compositions: purpose, common failure patterns, evidence to inspect, safe resolution and interview-ready reasoning.
Published 17 Nov 2026· 793 words
What this controls
RAP deep create persists a parent business object and its composition children through one controlled transactional request. Content IDs and entity associations represent relationships, not arbitrary database inserts.
When to use it
Use RAP deep create (creating a root entity and its composition children in one request) whenever the business transaction is genuinely atomic — for example creating a sales order header together with its line items in one user action — rather than forcing the client to make multiple separate create calls that could leave the object in a partially-created state if one fails.
Safe resolution path
Implement supported RAP creation and key mapping without COMMIT WORK in behavior logic. Validate atomic business outcome and child-to-parent keys after save; negative tests must not leave orphan items or leaked partial states.
Common pitfalls
The most common mistake is modeling a composition relationship where the parent-child cardinality or dependency doesn't match the real business object, leading to deep-create behavior that doesn't match what users expect (e.g., unable to add a child without first saving the parent, when the business process requires atomic creation).
Teams also underestimate the validation complexity needed across composition levels — a validation on the root entity may need to consider child data that hasn't been fully processed yet within the same deep-create request.
A third pitfall is not properly testing deep-create failure and rollback behavior, since a partial failure deep in a composition tree needs to roll back the entire transaction cleanly, not leave orphaned child records.
ECC, S/4HANA and clean core
RAP and its deep-create capability are S/4HANA and BTP ABAP Environment concepts with no ECC equivalent; classic BAPI-based creation typically required multiple separate calls orchestrated by the caller, with no standardized transactional composition model. RAP's deep create is part of what makes new Fiori Elements development meaningfully more productive than the equivalent classic BAPI-plus-custom-orchestration approach required in ECC-era development.
Revisit this guidance at each major SAP release or upgrade cycle, since clean-core scope, released-API coverage and BTP service capabilities all continue to expand; a decision that required a workaround in one release may have a supported, upgrade-safe option in the next, so a periodic architecture-review checkpoint is worth scheduling rather than treating the original decision as permanent.
Typical production symptom
A sales-order root and items are created in one request, but child keys map to the wrong header after late numbering. A consumer that sends duplicate temporary references may also create ambiguous compositions.
Likely root causes
The most common causes are configuration mismatch, stale or incomplete master data, incorrect status or validity dates, authorization scope, integration mapping, timing or sequencing, and changes that were transported without their prerequisites. Avoid assuming the screen where the symptom appears is the layer that owns the defect.
What to inspect
Check composition model, behavior create-by-association, %cid/%cid_ref relationships, mapped/failed/reported EML responses and save sequence. Test one header with multiple items, a rejected child and valid parent. Understand whether numbering is early or late.
Consultant and interview angle
A strong answer explains the controlling object or configuration, the evidence used to isolate the issue, the cross-module or integration dependencies, the safe fix, and the regression plan. Senior candidates should also explain monitoring, governance and how to prevent the same failure from recurring.
Worked design review and production acceptance
RAP deep-create walkthrough: a sales document needs one root and three item children in a single transactional request. Client-generated %cid values link temporary child references to the root; final document numbering can occur later, so technical identifiers must not be guessed before save.
Construct a controlled EML create-by-association test with root temporary ID A and item IDs B/C/D, then inspect MAPPED, FAILED and REPORTED after interaction and commit through supported transaction handling. Trigger a failure on the second child and verify whether the behavior contract rejects the invalid business transaction and does not leave orphan lines.
For a managed behavior, check the actual composition association and projection exposure; unmanaged persistence needs explicit consistency logic. Test duplicate %cid input, a valid multi-item save and a repeated client request to detect duplication. Confirm correct material, quantity, currency and parent-child keys by reading back the persisted business object.
Do not call COMMIT WORK from inappropriate behavior phase or directly insert child rows just to force a successful response. The success criterion is a single consistent business document and actionable error mapping for invalid input.
Check that a client-generated %cid is unique within request scope and that mapped IDs are reported after save in the behavior's supported response. Force invalid data on one child and verify no forbidden parent-child persistence occurs. Confirm message text identifies the affected item rather than returning a generic root failure.
Source: ERPClimb — https://erpclimb.com/sap-technical-topics/rap-deep-createERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.