cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori RAP: Define Sort Order for Value Help

ivan_kalcha
Explorer
0 Kudos
280

I’m developing an SAP Fiori application using the RAP model. In my scenario, I have a CDS entity that provides the data for the Value Help. The screenshot below shows the Value Help window with the data. I would like to specify the sort order for the Value Help, so that when the list is displayed, the line items will be sorted in ascending order based on the first column. Is there a RAP annotation that can be used to define the sorting order?

ivan_kalcha_0-1744328667374.png

 

 

Accepted Solutions (0)

Answers (2)

Answers (2)

junwu
SAP Champion
SAP Champion
0 Kudos

Consumption.valueHelpDefinition.presentationVariantQualifier: PUTYOURPRESENTATIONVARIANTHERE

when you annotate the field, you have to mention which presentationvariant to be used

EldaL
Associate
Associate
0 Kudos

Hi @ivan_kalcha,

In the Metadata Extension of the CDS View Value Help you could try adding the following annotation in the header section:

@ui.presentationVariant:[{ sortOrder: [{ by: '[FieldName]', direction: #ASC }] }]
annotate entity [CDSValueHelpName] with { ... }

In case the field you want to sort is of type CHAR, you can try casting to INT (if this does not work as expected or is not permitted, try casting to NUMC then to INT) as the following:

cast( cast([FieldName] as abap.numc(len)) as abap.int[int_len] ) as [FieldName]

I hope this helps you resolve the issue.

BR,
Elda

ivan_kalcha
Explorer
0 Kudos
I've tried both of your suggestions. I added the annotation in the Metadata Extension of the CDS view and also applied the cast conversion for the "Status" field directly in the CDS view. Unfortunately, neither change made a difference. I really appreciate your help with this.
ivan_kalcha
Explorer
0 Kudos

Cast conversion in the CDS View for Value Help:

cast( cast( cast( domvalue_l as abap.sstring(10) ) as abap.numc(2) ) as abap.int1 ) as Status

Annotation in the Metadata Extension:

@ui:{presentationVariant:[{sortOrder:[{by:'Status',direction:#ASC}]}]