Is there a way to create a "temporary" (or I guess it's called virtual) deep entity with using oModel.createEntity()?
I have a entity called Timesheet with an association to breaks, called ToBreaks.
Now I want to create a new entity in the frontend by using
oModel.createEntity("/TimesheetSet").
Unfortunately in the so called virtual new entry all my associations are missing.
Because I use the assications for binding tables, after creating the virtual new entry, a backend call is triggered
TimesheetSet("id-04-123456789")/ToBreaks which leads to a "invalid key predicate" error.
Is there a way to do this with OData V2?
Update 09.08.2016:
You can still try by just using the properties parameter with a nested entity set. As long as your OData service supports the corresponding deep create it should work:
I've also tried something like this:
oModel.createEntry("/TimesheetEntry", {
Pernr: sPernr,
Begda: dBegda,
ToBreaks: [{
Pernr: sPernr,
Begda: dBegda
}]
});
ToBreaks is the name of the association.
In the virtual entry of the OData-Model the properties for the associations are still missing. I can create the new entry by using the code above, but afterwards there is no property called ToBreaks
On the Backend-Side I followed this tutorial for implementing the deep_create method: step-by-step-development-guide-for-createdeepentity-operation. I'm able to trigger the method from within the SAP Gateway Client.