Skip to Content
1
Sep 22, 2020 at 07:29 AM

Input-Validation via Search/Value-Help using foreign key or other annotation in RAP

464 Views

Dear Community,


I have the following situation:

We have a S/4Hana 1909 On-Premise in place, SAP_BASIS 7.54 SP 01, and SAP_ABA 7.5E, SP 01.

I created a Fiori-Elements Application using RAP (unmannaged), respective CDS-View and OData-Service, Service Behaviour/Definition, Behaviour Implementation etc.

I have a search help in place, using the annotation

@Consumption.valueHelpDefinition

I even created an association to that CDS-View that is providing me data for the search help, and the search help works fine.

The problem is: the users can still enter values that are not contained in the Search Help, and these values are accepted upon saving.

Instead, I want those values to be automatically restricted to those that are coming from the search help (throwing some error messages etc. would be a cool feature too), like when you create a table and a table-view maintainance from SM30, and you provide foreign-key relationship to another table, you get the search-help and those checks for free (automatically). I even tried with the annotation

@ObjectModel.foreignKey.association: 

to get the value help and see if this works, but it didn't. Then I've tried to put the foreign key relationship directly to the data base table definition in eclipse, using

 with foreign key [0..*,1] 

statement, but it didn't helped either.

So, the questions is, is it even possible to provoke this check intrinsically/automatically, ( for e.g. using annotations), or do we have to implement this manually in the validation? I was searching the documentation, blogs, developers-pages, and so far, i was not able to find anything. Maybe someone could pin-point me to an ressource/blog where this point was already discussed?

Maybe it is not possible yet for unmanaged?

Doing it manually via coding would be to much effort for each field.

Thank you all very much in advance!!

Best regards,

Aleks