SAP-samples / abap-platform-fiori-feature-showcase

Feature showcase that demonstrates and documents how to implement annotation-driven SAP Fiori Elements UI features for oData V4, using the ABAP RESTful Application Programming Model (RAP).
Apache License 2.0
169 stars 37 forks source link

Can't find an example for sap:field-control / @Common.FieldControl #7

Closed gregorwolf closed 1 year ago

gregorwolf commented 1 year ago

Hello ABAP Fiori Feature Showcase Team,

thank you for closing the gap to CAP and providing also an ABAP Fiori Feature Showcase. I've searched in the documentation and the source but was not able to find an example that shows how to achieve sap:field-control (OData V2) or @Common.FieldControl. Can such an example please be added?

Best Regards Gregor

jessie-cheah commented 1 year ago

Hi Gregor,

you are correct, there is no mention of field controls in the documentation. This will be corrected in the next release.

With regards to field controls, there are 2 types, static and dynamic. There are actually examples of static field control, namely readonly and mandatory. If you look through the $metadata of the service, you will find the following:

<Annotations Target="SAP__self.RootType/Email">
   <Annotation Term="SAP__common.FieldControl" EnumMember="SAP__common.FieldControlType/Mandatory"/>
</Annotations>

Defined in the Behaviour Definition with

field ( mandatory ) Email;

Defined in the Behaviour Definition with

field ( mandatory : create, readonly : update ) StringProperty;

In the next release, there will be examples of dynamic field control.

Regards, Jessie

jessie-cheah commented 1 year ago

Here the link to the updated Guide on Feature Control https://github.com/SAP-samples/abap-platform-fiori-feature-showcase/wiki/Feature-Showcase-App-Guide#feature-control