cancel
Showing results for 
Search instead for 
Did you mean: 

Annotation accepts only String 40, which is less than the minimum number of positions(256)

max_mueller007
Explorer
0 Kudos
383

I want to dynamically set the field labels.

For this, I decided to use the Virtual Elements, calculated using the class and assign using the annotation EndUserText.Label.

Issue 1:

The @EndUserText only accepts string(40) data type, which does not seem possible to define due to the errors below:

Moreover, string is also not supported as the target type for CAST.

Issue 2:

To avoid created too many classes for each virtual element, I used a single class. However, when I try to reuse the class, I get the above error, which goes away when I use the class only once, or use 2 different classes. However, I have seen multiple blogs online using the same class for multiple fields. The class still does get activated, so do not know if this is really an issue.

What do you think is the best way to achieve my use case.

Best Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

JessieCheah
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Max,

issue 2 is a framework bug that comes up during a CDS annotation check. There will be a fix for it, but it should not hinder the CDS view activation.

Issue 1: The error could be a bit misleading. It actually means that the EndUserText.label annotation expects an annotation value of a string with 40 characters, enclosed with single quotation marks.

 @EndUserText.label: 'This is a text label'

This annotation only accepts a fixed value defined during design time (no dynamic).

Regards,
Jessie

max_mueller007
Explorer
0 Kudos

Hi Jessie, Thanks for your response.

In my use case, I only need to set the text once as per a written logic based on another field selection.

Is there another possible way to perhaps do that?

JessieCheah
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Max,

for RAP services, unfortunately no.

Regards,
Jessie