Deep insert is a create operation applicable in scenarios where only updates of hierarchical data are allowed.
When using deep insert the data need to be nested, that is, a deep structure is expected. When you are required to create (tabular) child entities with the respective parent entity type in one request (for example, Sales order and sales order items), you can use the method that has been provided in the /IWFND/IF_MGW_APPL_RUNTIME interface for deep insert (/IWFND/IF_MGW_APPL_RUNTIME~CREATE_DEEP_ENTITY).
The diagram below explains a model where you can use deep insert:
In the above model, the root node has three child nodes and one of the child node has another child node. Creation of a Root+Child1+Child2+Child3 (which are at the same level) at one shot, is supported as deep insert.
Follow the steps below before implementing /IWFND/IF_MGW_BOP_MAP_CREATE interface for deep insert:
The registration of the mapping specialists should be done based on an entity-name, Operation-name combination. For example, Entity-name = 'FLIGHT' ; Operation-Name = 'Deep_Insert'.
The method GET_EXPAND_CLAUSE_DEFAULT of the entity_provider class needs to be redefined. Here, based on the operation-name & entity-name, the expansion clauses need to be filled in a table of strings.
CASE iv_operation. when gc_operation_code_ro-expand_entity. APPEND 'bookings' to et_expand_clause. WHEN gc_operation_code_wr-deep_insert. APPEND 'bookings' TO et_expand_clause. ENDCASE.
Define entities, which support expand entity set operation by redefining the method GET_EXPAND_CLAUSE_DEFAULT of the abstract EDP. See Implementing GET_EXPAND_CLAUSE_DEFAULT for more information.
If you do not implement the method GET_EXPAND_CLAUSE_DEFAULT, abstract EDP will not be able to call the mapping specialists for deep insert operation.
During runtime, the abstract EDP checks if the child entity (provided as inline content during deep insert operation call, using HTTP Post) is part of the expansion clause returned by the above mentioned method. If the expansion clause string does not match, then it is assumed that the deep insert operation is not supported for the parent-child entity combination.
For implementing /IWFND/IF_MGW_BOP_MAP_CREATE for Deep Insert, see Implementing /IWFND/IF_MGW_BOP_MAP_CREATE for Create.
Continue with Error Handling in Mapping Specialists