cancel
Showing results for 
Search instead for 
Did you mean: 

Create Maintenance app How to restrict search help value coming from CDS views in standard RAP srv

1,367

I have added notification type field using UI annotation in the "create maintenance request" app. I want to restrict values which are coming in dropdown for this field. Currently, it fetches Y1, M1, M2, M3, M4, M5 values but I want it to show only M1 and M5. How can it be achieved?

This field is using following value Help in the projection view C_MAINTWORKREQUESTOVERVIEWTP:

Value help I_PMNotificationTypeStdVH fetches data from I_PMNotificationType and has @accesControl.authorizationCheck active.

Please suggest how can I restrict values for this dropdown?

Accepted Solutions (0)

Answers (2)

Answers (2)

svasani
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Gaurav,

If authorization based control approach is not solving your problem, then I would suggest you to try out below mentioned approach -

Backend -

  • Create a custom Value help view entity and expose it via Service Extension created on top of existing service definition to expose newly created value help in service metadata document.

Frontend -

  • Create an Adaptation project for the Actual Application
  • Create a local annotations.xml file in the adaptation project, as part of which - Override the existing ValueList annotation for NotificationType property with the view you would already have exposed. (filePath - webapp/changes/annotations/annotations.xml)
  • In the manifest.appdescr_variant file of Adaptation project, add the below mentioned code snippet -
	{
	        "changeType": "appdescr_app_addAnnotationsToOData",
		"content": {
			"dataSourceId": "mainService",
			"annotations": ["localAnnotations01"],
			"annotationsInsertPosition": "END",
			"dataSource": {
				"localAnnotations01":{
				    "uri": "changes/annotations/annotations.xml",
		                    "type": "ODataAnnotation"
				}
			}
		}
	 }

Regards,

Shyam

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Gaurav,

Rather than code...

Have you considered simply using authorizations as per https://blogs.sap.com/2023/01/25/sap-fiori-for-sap-s-4hana-how-to-restrict-filter-values-in-sap-fior...

You can check if the OData Service respects the authorizations using https://blogs.sap.com/2023/08/01/sap-fiori-for-sap-s-4hana-finding-authorization-objects-for-sap-fio...

P.s. For questions about S/4HANA apps, please use tag "SAP Fiori for SAP S/4HANA" and remember to include your S/4HANA release!

0 Kudos

Hi Jocelyn,

Thanks a lot for responding to my query.

I had already explored the authorization object level restriction. If I allow only M1 and M5 notification type for authorization object I_QMEL then all the places (all the CDS views/fiori applications) wherever this auth object is used, only these two values will be allowed for all the users.

But this restriction is needed only for this application. Is there any other option through which we can add value restriction?