Who has never had to adapt a CDS field because it exceeded 30 characters? And, as a side effect, it is therefore impossible to have the desired field in the OData service.
Here is a quick and effective solution to avoid this problem.
An example is available on our Gitlab.
I. CDS in error
Let’s take a simple case of a CDS we created where one field exceeds 30 characters.

We can see that there is an error and that we cannot activate the CDS.
We could shorten the field name and then activate CDS to expose it within a service and consume it in OData, but we really want this field name.
II. Solution
There is an OData annotation to work around the problem: OData.property.name.
This annotation is a framework-specific annotation and is evaluated at runtime by the SADL framework.
Our corrected CDS is therefore:

Here, there are no more errors, and we can activate the CDS and create the associated OData service:


In this example, we are using an S/4 Hana system, Private Cloud, but this annotation is also available on BTP, ABAP Environment, S/4 Hana, Public Cloud, and On Premise.
III. Test

We can see that the desired field is well exposed and consumable via OData.
