cancel
Showing results for 
Search instead for 
Did you mean: 

Create By Association for 1:1 composition in RAP Unmanaged

ShivamChadha
Explorer
0 Kudos
297

Hi,

I have a requirement where I have a composition (parent-child relationship) of cardinality 1:1.
When I click on Edit and create a parent, I want the child section to be editable as well. So that I can enter values for both parent and child and create a record.

But that is not how the system is behaving.
Is there any special way of handling such 1:1 compositions?

In the below screenshot, LimitingRule is the child and should also be editable when creating a Trigger entity.
The parent(Trigger Details) is editable but not the child(LimitingRule).

ShivamChadha_0-1738656060958.png

Thanks in advance!!
Shivam Chadha

View Entire Topic
ClearQueries
Explorer

Hi @ShivamChadha,

RAP service works on OData protocol.

Let us understand the working mechanism with following BO design

- RootEntity

    - ChildEntityOneToOne (Composition 1:1)

    - ChildEntityOneToMany (Composition 1:n)

When you create the root node, the system will create the draft instance for the RootEntity only as UI only triggers POST call for the node you're currently operating.

As the ChildEntityOneToOne would not have any draft instance available in database, it will be visible in greyed out mode the way you have shared in your screenshot.

For the ChildEntityOneToMany as well draft instance will not be available, but as it's in tabular format Fiori Elements gives a create button in order for you to request creation whenever needed.

It implies that the ChildEntityOneToOne needs special treatment.

You're required to create Draft instance for ChildEntityOneToOne upon creating new instance for root (or let us say parent if it's not root node).

You can create determination on Parent node and trigger it on modify create event.

define behavior for Z_R_RootNode
.
.
{
  determination createInstanceForChildOneToOne on modify { create; }

}

Determination Implementation - 
MODIFY ENTITIES OF Z_R_RootNode IN LOCAL MODE
CREATE
BY _RelevantComposition
FROM lt_emptyrecord
MAPPED ....
REPORTED ....
FAILED ....

This determination ensures that the ChildInstance also gets created during parent/root node creation and hence your facet will be visible in Edit mode.

Hope this answers your question.

Please accept the answer if it solves your query.

 

Regards,

ClearQueries.com 

Follow on LinkedIn