How to get a list of annotations that can be used in SAP Cloud Platform, ABAP Environment
The problem …
If you are developing in SAP Cloud Platform, ABAP Environment you will sooner or later run into the problem that you try to use an annotation that is not supported in Steampunk.
Unfortunately code completion (currently) does also offer you annotations that are not yet released.
As shown in the screen shot above the source code editor offers you to select the annotation
but if you enter the same you will get the error message
Use of Annotation 'Semantics.geoLocation.longitude' is not permitted (not released).
The solution …
Until a fix for code completion is available you can consult the documentation.
It’s all in the documentation anyway ;-).
However the question remains where to find it …
Option 1: Use this link
Option 2: Use the built in help documentation in ADT:
- Open the DDL source code of a CDS view. Select the DEFINE statement and press F1.
- In the search field (upper right corner) enter the following search string “abap annotations”
- Click on “ABAP annotation syntax” => Here you get a list of all released ABAP annotations. ABAP annotations are SAP annotations that are evaluated by the ABAP runtime environment.
- For @Semantics you will find the following four entries:
@Semantics.amount.currencyCode @Semantics.currencyCode @Semantics.quantity.unitOfMeasure @Semantics.unitOfMeasure
- But there are more annotations …At SAP we distinguish between the aforementioned “ABAP annotations” and “Framework-specific annotations“.In a second search you now have to enter “framework-specific annotations” in the search field.
Here you have to click on “Framework-specific annotation syntax”
- This will provide you several tables that summarize the annotation syntax of all framework-specific annotations in CDS DDL and CDS DCL in ABAP CDS. The API column indicates whether the annotation can be used in CDS entities defined in ABAP for SAP Cloud Platform when it contains the entry RELEASED_FOR_SAP_CLOUD_PLATFORM.
If you have opened the F1 help in a Steampunk system the tables automatically only show the annoations that are supported here whereas if you do the same in an on premise system you will get a complete list and you would have to check the content of the API column for the entry RELEASED_FOR_SAP_CLOUD_PLATFORM.
As you can see there are additional @Semantics annotations available that are released for ABAP in SAP Cloud Platform such as:
@Semantics.language @Semantics.systemDateTime.createdAt @Semantics.systemDateTime.lastChangedAt @Semantics.text @Semantics.user.createdBy @Semantics.user.lastChangedBy