Umar Abdullah
Umar Abdullah

Reputation: 1290

Mark field as mandatory in Fiori app through CDS annotations

I have created a Fiori app in Web IDE using the list report template based on CDS views.

I want to make few of the fields mandatory when editing a record. I have added annotation:

@ObjectModel.mandatory: true

for each of the fields which i want to be mandatory on my business object CDS view.

The result of ObjectModel.mandatory annotation on the app is that I can see a red asterisk next to the field. However, nothing really happens if I edit the record and hit Save with the mandatory field being blank.I am able to successfully save the values even if the mandatory fields are empty.

Am I missing something? I would expect to get an error for the mandatory fields.

regards,

Umar Abdullah

Upvotes: 1

Views: 5628

Answers (1)

Eduardo Copat
Eduardo Copat

Reputation: 5151

The CDS framework will not automatically validate it. But, you can create a validation at your BOPF node. You can use the standard class /BOBF/CL_LIB_V_MANDATORY_ATTR, which enforces the @ObjectModel.mandatory: true. — at least in the back-end side.

Upvotes: 3

Related Questions