cancel
Showing results for 
Search instead for 
Did you mean: 

How can we use association in custom CDS entity in RAP?

Rohitautodesk
Explorer
0 Kudos
109

I have a use case where I want to use association in the custom entity in RAP. The Association/Composition  is not with the child but it is pointing to the independent entity. Is there a way we can achieve this?

Basically I want to expose value help in custom entity (From some other entity) which the framework is not allowing me.

Accepted Solutions (0)

Answers (2)

Answers (2)

junwu
SAP Champion
SAP Champion
0 Kudos

valuehelp doesn't need association. you just specify the cds as the valuehelp.

clsorensen911
Participant
0 Kudos

Hello @Rohitautodesk ,

Maybe I misunderstand the question, but here is a quick example of how I implemented a value help in a (I admit, very simple) RAP app. 

Step 1: Value Help CDS View and annotation

I created a simple value help CDS View for "Country" and then added that value help as a annotation in the CDS view that is used by the RAP application:

clsorensen911_0-1746172638133.png

Value Help View

@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Country'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
    serviceQuality: #X,
    sizeCategory: #S,
    dataClass: #MIXED
}
@ObjectModel.dataCategory: #VALUE_HELP
@ObjectModel.representativeKey: 'Country'
@Search.searchable: true

define view entity ZR_T005T 
    as select from t005t
{
    @EndUserText.label: 'Country Code'
    key land1 as Country,
    @Search.defaultSearchElement: true
    @Semantics.text: true
    @Search.ranking: #HIGH
    @Search.fuzzinessThreshold: 0.75
    @EndUserText.label: 'Country'
    landx50 as Description
}

where spras = 'E'

Annotation in main CDS view

  @Consumption.valueHelpDefinition: [{
        entity : { name: 'ZR_T005T' , element: 'Country'},
        label: 'Country' , useForValidation: true, distinctValues: true
    }]

Effect on App:

When creating a draft, the value help is now available. 

clsorensen911_1-1746172870723.png

Hope this helps 🙂