Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Fiori DRAFT issue

0 Likes
2,736

hi,

I have created a CDS view with draft enabled annotations. However, when I am running the application in front end(which i exposed via Odatapublish: true) then the draft feature is not working.

@ObjectModel:{ representativeKey: 'salesorder',

semanticKey: ['salesorder'],

compositionRoot: true,

createEnabled: true,

updateEnabled: true,

deleteEnabled: true,

transactionalProcessingEnabled: true,

draftEnabled: true,

usageType.dataClass: #TRANSACTIONAL,

usageType.serviceQuality: #C,

usageType.sizeCategory: #S,

writeActivePersistence: 'ZSM_VBAK',

writeDraftPersistence: 'ZSMVBRK_D'

please help. it is only saving in active persistent. Why it is happening. am i missing anything?

1 ACCEPTED SOLUTION
Read only

maheshpalavalli
Active Contributor
0 Likes
2,137

Hi Swastik Mukherjee,

Please follow the standard doccumenation tutorial below. it is very explanatory and if you follow it, it should solve your issue.

https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/1809.000/en-US/d36820f082c84085b6634be4...

Note; Keys should be uuid for this scenario.

Thanks,
Mahesh

8 REPLIES 8
Read only

Nawanandana
Active Contributor
0 Likes
2,137

Hi,

Just try with transactionalProcessingEnabled: true, createEnabled: true,deleteEnabled: true,updateEnabled: true,

Ex:

@ObjectModel: {
  compositionRoot: true,
  transactionalProcessingEnabled: true,
  createEnabled: true,
  deleteEnabled: true,
  updateEnabled: true,
  draftEnabled: true ,

  entityChangeStateId: 'changedat',  --Required for ETag check
  writeActivePersistence: 'db_salesorder', 
  writeDraftPersistence: 'db_salesorder_d', 

  semanticKey: [ 'SalesOrder']   }
   
define view I_SalesOrder as select from db_salesorder as SalesOrder
  association [0..1] to I_BusinessPartner as _BusinessPartner on $projection.customerID = _BusinessPartner.businesspartnerID
{
key salesorderID,
    ...
    customerID,
    ... 
@ObjectModel.association.draftEnabled: true
@ObjectModel.association.draft.fieldNamePrefix: 'BuPa'
    _BusinessPartner   }
Read only

0 Likes
2,137

Thanks for your reply. However, I already used those annotations but it is not working. Please suggest. it is getting saved in active persistent only. Draft is not working.

Read only

0 Likes
2,137

Try this, it may help you

Read only

0 Likes
2,137

I have gone through whole blog. They are not using active persistence annotations. They are saving the draft data in copy draft to active using modify statement. But in my case and example you provided there both active and draft persistence annotations are there. My all data getting save in active persistence, draft not working at all

Read only

maheshpalavalli
Active Contributor
0 Likes
2,138

Hi Swastik Mukherjee,

Please follow the standard doccumenation tutorial below. it is very explanatory and if you follow it, it should solve your issue.

https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/1809.000/en-US/d36820f082c84085b6634be4...

Note; Keys should be uuid for this scenario.

Thanks,
Mahesh

Read only

2,137

Thank You Mahesh. I will go through the Help document and get back here. Moreover, I gone through your blogs in SAP and It is very much useful. I appreciate your effort there. The Durable lock was a new thing in draft i got to know. 🙂

Read only

2,137

Hi Swastik Mukherjee,

Welcome and thanks for the feedback 🙂 🙂 I was and am still new to these concepts and it's a learning whenever I dig through them.. Hope to see you share your learnings in the future 🙂 🙂

Let me know if you face any issues while going through.

Thanks,
Mahesh

Read only

0 Likes
2,137

Sorry for late reply. Now the draft is working. Thank you so much for the help. 🙂