Showing results for 
Search instead for 
Did you mean: 

Side Effect: Can the content of an Calculated / Virtual Field be updated in draft

Active Contributor
0 Kudos

Hello SAP CAP and Fiori Elements Experts,

I try to follow the Side Effect Annotations: Examples --> Additional Features in SAP Fiori Elements for OData V4 in my sample project. But the annotation:

 @Common.SideEffects #effect: {
    SourceProperties: [taxPercentage],
    TargetProperties: [

Doesn't update the content of the Computed fields when I change the taxPercentage. I’ve tried also with a virtual field where I’ve added the calculation in the handler:

  this.after("each", Orders, (order) => {
    order.VirtualTotalWithTax = + ( * order.taxPercentage) / 100;

But this resulted in an endless loop when switching to the edit mode. There the Fiori Elements App requested endlessly the field VirtualTotalWithTax.

Does anyone had success creating an example where a calculated field is updated while being in draft?

Best Regards

View Entire Topic
0 Kudos


I asked the same question some time ago. The answer was that drafts are not supported and should be handled with a separate implementation. However, it was said that in the future there might be a default handling for calculated fields from the database.

my Solution is this:

this.after('PATCH', 'Positions', async (data) => {
  await UPDATE(Positions.drafts, data.ID).set`total = quantity * amount`