Hello,
I am trying to create a new Fiori Application by RAP in SAP BTP ABAP environment. I am struggling to create child entity programmatically for a parent entity using association in draft instance. I don't understand what to pass to the EML CBA to identify the parent entity. All I have is the %pid of the parent here. My requirement is as follows.
I have two tables - header table is travel(key field: guid), item table is booking(key field: guid, foreign key field: parent_guid which stores guid of travel table).
I have developed an OData V4 service which is implemented by RAP managed and draft capability. So in the initial screen, when user is clicking the create the 'create' button and object page is appearing where user can enter the travel details and item table is also displayed in another facet.
Now, my requirement is when I fill a value in field called travel-f1 in the object page, the item table will be derived and populated by some custom logic. So, I am developing a side effect and determination action which will in turn call a determination.
So far so good. I have implemented everything as I have mentioned above.
But where I am stuck is, when user is now creating a new record for travel, I am using the EML create by association to populate the booking instance value. Although I am not getting any error, but I am also not getting any result back after firing a READ entity. My EML is as follows -
MODIFY ENTITIES OF ZI_BO IN LOCAL MODE
ENTITY Travel
CREATE BY \_booking
FIELDS ( Article OldArticle ArticleSize Priority )
WITH VALUE #( ( guid = <current_travel>-%pid "current travel record being created
%target = VALUE #( FOR choice IN lt_choice_sku (
%cid = <current_choice>-%pid && choice-Matnr
" %is_draft = if_abap_behv=>mk-on
"<current_choice>-%is_draft
Article = choice-Matnr
ArticleSize = choice-SizeName
%control-Article = if_abap_behv=>mk-on
%control-ArticleSize = if_abap_behv=>mk-on
) )
) ).
In the current travel draft instance, the guid of travel is managed create i.e. the UUID is generated by RAP framework. So in debugging, I can see the guid is not filled yet, only the PID is filled. What I don't understand is, what value to pass here in the EML command so that the RAP framework knows the creation of booking records needs to happen against the draft travel instance being created here?
Also tagging Andre Fischer Ramjee Korada for your expert guidance on the approach here.
Thanks,
Mainak