cancel
Showing results for 
Search instead for 
Did you mean: 

RAP: To-One Cardinality child entity fields not editable on object page

felixdeum
Explorer

Hi SAP Community,

I am trying to set up a Fiori App (RAP) with the following properties:

I have one parent (root) entity called 'actual' and one child entity called 'forecast'. What I want to achieve is to include all the fields of both entities on one object page by linking both entities with the same UUID field ([0..1 Cardinality]. Below is a snipped of the CDS views code of both entities:

define root view entity ZRE_MAIN_ACTUAL 
as select from ztd_actual as Main_Actual
composition [0..1] of ZRE_MAIN_FORECAST as _MAIN_FORECAST

define view entity ZRE_MAIN_FORECAST 
as select from ztd_forecas as Main_Forecast association to parent ZRE_MAIN_ACTUAL as _MAIN_ACTUAL on $projection.Uuid = _MAIN_ACTUAL.Uuid


Now, when I preview the app and create a new object I can see the fields of both entities on the object page, however, only the fields of the parent entity are editable and the child ones are not editable. Also, when I go into the draft data tables of both entities I can see only data in the parent entities data table but no data in the child table.

To preview the app I am creating a Fiori app project in VS Code with the help of SAP Fiori Tools. My app uses oData V4 and is draft enabled.

I would be happy for any hints on how I can achieve to be able to have all the fields editable with a [0..1] cardinality. Thank you 🙂

lars_kr
Participant
0 Kudos
Do you now have a solution to your problem? I think my problem is the same at the moment. Here ist my Question: https://community.sap.com/t5/technology-q-a/rap-create-child-with-identification-reference/qaq-p/137...

Accepted Solutions (0)

Answers (1)

Answers (1)

AbhishekSharma
Active Contributor
0 Kudos

Hi felixdeum

Below are some points which you may check if you have implemented or not:

  • In your behavior implementation class for Root entity you need to add

association <Child Entity> { create; with draft };

This will allow you have Create button for Child Entity.

As per the functionality and based on my experience (little) first system will ask you to fill all Root entity form and then you ill click on Create Button of Associated Entity which will open Object Page to fill form.

For more details please visit below video:

https://www.youtube.com/watch?v=QdmFrja4yZw

Data will go together (Root and Child) to Persistent state, till tile both records should be available in your Draft table.

Thanks-

Abhishek

felixdeum
Explorer
0 Kudos

Hi Abhishek, Thanks for your reply 🙂

I had already added the given line into my behavior implementation.

In my case I do not want to implement or show and create buttons for the child entity. The child entity is supposed to be automatically created when the parent (root) entity is being created.

AbhishekSharma
Active Contributor
0 Kudos

Hi felixdeum

I have not got chance to Implement this kind of scenario but still below are my suggestions:

You may want to use EML in order (Association create) with header, and you also might have Implemented early Numbering method, there you may try to put your logic.

For more details you may check below video for EML Create by Associations:

https://www.youtube.com/watch?v=5MZQ5EDgyxU

I would also like you to read about Factory Methods in ABAP RAP that might help.

Thanks-

Abhishek

felixdeum
Explorer
0 Kudos

Hi abhishek-166 ,

Thanks again for your reply 🙂 I will give the option to manually add the child entity via EML a try and will get back if it solved the problem.