cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Is it possible to create a dropdown in Fiori Elements using CAP CDS enum type without a entity?

danilarrosa
Product and Topic Expert
Product and Topic Expert
0 Kudos
814

Hello SAP Community,

I'm working on a Fiori Elements application with CAP CDS as the backend. I know it's possible to create a dropdown using a separate entity to define the values, and I'm able to do that. Specifically, if I define the entity in my CDS service, I can successfully show the values returned using this annotation:

Common.ValueListWithFixedValues : true,
        Common.ValueList : {
            $Type : 'Common.ValueListType',
            CollectionPath : 'XXXXXXXX',
            Parameters : [
                {
                    $Type : 'Common.ValueListParameterInOut',
                    LocalDataProperty : XXXX,
                    ValueListProperty : 'XXXX'
                }
            ]
        }

However, in my case, defining this property as a "DB table" just to store two options (which will always remain the same) feels unnecessary. We don't need any additional information for these options, so using an enum type would be much better.

Specifically, I'd like to use an enum type like this:

type AnswerPossibilities : String enum { 
    Yes;
    No;
}

I just want to choose one option (e.g., "Yes" or "No") and store it as a string in my main object (in my basic entity).

Is it possible to create a dropdown in Fiori Elements that uses this enum type directly? If so, how can I implement it? Are there any specific annotations or configurations required?

I'd appreciate any insights, examples, or best practices for handling this scenario. Thanks in advance for your help!

Best regards,
Daniel.

View Entire Topic
junwu
SAP Champion
SAP Champion
danilarrosa
Product and Topic Expert
Product and Topic Expert
0 Kudos
Thank you so much for your time!