cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member596519
Participant

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

Accepted Solutions (1)

Accepted Solutions (1)

CarineTchoutouo
Product and Topic Expert
Product and Topic Expert

Dear Aleksandar,

As of today, an automatic check is not available when using value helps.
The inputs have to be checked in the back-end before they are saved.

Any updates on this will be rolled out in the future via the ABAP platform roadmap.

Kind regards,

Carine

former_member596519
Participant

Thank you Carine!

0 Kudos

Hello Carine,

any updates here?

Thanks and best regards

André

Answers (1)

Answers (1)

abhishek_160
Explorer

Dear Aleksandar,

After adding value help/F4 help for a field using annotation @Consumption.valueHelpDefinition, you can add a validation for the values using annotation @Consumption.valueHelpDefinition.useForValidation. This validation marks value help that shall be used for validation of user input. For more information on usage of annotations, visit below official SAP help portal:

Consumption Annotations | SAP Help Portal

Thanks

Abhishek Khanna