2025 Jan 24 6:27 AM - edited 2025 Jan 24 6:28 AM
Hello, community
I have a question about value helps in ABAP RESTFul application managed without draft oData version is 2.
I created value help which contain three fields SomeID, TextForId, DateFrom, DateTo
I consumed that value help in projection view as below
define view entity ZC_BASE_CDS_PROJ as projection on ZI_BASE_CDS {
@Consumption.valueHelpDefinition: [ { entity: { name: 'zc_value_help', element: 'SomeID' },
additionalBinding: [ { element: 'SomeId',
localElement: 'LocalSomeId',
usage: #RESULT },
{ element: 'DateFrom',
localElement: 'DateFrom',
usage: #FILTER_AND_RESULT },
{ element: 'DateTo',
localElement: 'DateTo',
usage: #FILTER_AND_RESULT } ],
useForValidation: true,
label: 'Important IDs' } ]
@EndUserText.label: 'Very important ID'
LocalSomeId,
DateFrom,
DateTo
}
And everything would be fine but, I don't want use dates in filter like DateFrom in CDS equivalent DateFrom in value help, I would like to use intersection of periods in value help and in CDS. I know how to fill CDS.DateFrom and CDS.DateTo before creating new record, but I don't know how use dates in CDS as range or interval filter for value help. I asked our frontend developer can he pass those fields as default filter before showing value help pop up window, but he said that is impossible.
So question is how to pass additional binding elements as filter with greater than or less than?
Maybe I chose wrong approach, so could you please suggest right approach for Fiori elements not for custom application.
@Andre_Fischer could you please help?
Thank you in advance.
2025 Mar 21 7:27 AM - edited 2025 Mar 21 7:54 AM
Hello @Kostiantyn_K
I encountered the same issue and managed to resolve it by creating a custom entity that pulls data from my value help entity (in your case, zc_value_help).
In the implementation of the custom entity, I utilized the filters object of the io_request object to retrieve the filters defined in the additional bindings annotation. Once the value of your date filter is saved locally, you can use it to perform a selection on your value help entity.
It would be much more convenient if there were an additional annotation field, such as "operator," which would allow you to specify it directly in your consumption value help definition.
@Andre_Fischer : Is there a more efficient way to approach this?
Best regards,
Leif Johannsen