OData V2 Part 2: Deep Insert, Batch and Navigation Design
Preview · a free account unlocks the full lesson
Design OData V2 navigation and write operations: associations and navigation properties, $expand, deep insert of header and items, $batch with change sets, and the implementation side in SEGW (CREATE DEEP ENTITY, changeset methods).
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 1 covered reading V2 services. This part covers relationships and complex writes — the area where many V2 projects actually struggle.
Navigation design in V2 relies on two things in the model: an Association between Header and Item (1 : n), and a NavigationProperty — ToItems on Header, ToHeader on Item. Clients then read related data with something like /PurchaseRequestSet('4711')/ToItems, or with ?$expand=ToItems. A good design rule is to model only the navigation the UI actually needs, and to avoid huge $expand chains inside list views. In SEGW, $expand is handled generically by default, calling the item's GET_ENTITYSET once per header, unless GET_EXPANDED_ENTITYSET is implemented explicitly for better performance.
Deep insert lets a client send one POST carrying nested items, such as { "RequestID": "", "Description": "…", "ToItems": [ { … }, { … } ] }. On the server side in SEGW, this means redefining /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY in the DPC_EXT class, reading the nested data with io_data_provider->read_entry_data into a deep structure, creating the header and its items in one call to the business logic, and returning the created structure. In a RAP V2 binding, by contrast, deep insert works automatically through the composition, with no equivalent code needed.
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
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.