Calling AMDP Method Must Also Allow This Restriction
During code enhancements on S4/HANA system based ABAP Test Cockpit ATC and CVA checks, I decided to move an OpenSQL Select statement into an CDS view accessed via AMDP stored procedure on HANA database.
But I experienced the error CDS view is client-specific and restricts access to a client. The calling AMDP method must also allow this restriction. during activation of the AMDP class codes on SAP HANA Studio.
I create CDS View where I filter data based on session client value on MANDT column using session parameter $session.client in WHERE clause like in following SELECT code
When I tried to use this CDS View in my AMDP class method (stored procedure on HANA database), I experienced following error which prevent the AMDP to be successfully compiled and activated.
"Z_CDS_VIEW" is client-specific and restricts access to a client. The calling AMDP method "AMDP_METHOD" must also allow this restriction.
In the following code line ABAP developers can see how I called CDS view within AMDP and applied a WHERE clause using APPLY_FILTER command.
After a short search I find out that stored procedure requires additional AMDP options defined in the AMDP class method declaration.
ABAP programmers can find the official documentation about AMDP options at ABAP Documentation
To resolve error message 'Z_CDS_VIEW is client-specific and restricts access to a client. The calling AMDP method "AMDP_METHOD" must also allow this restriction.', I had modified the AMDP class method definition as follows:
ABAP developer makes above modification on Class Method Definition by adding AMDP OPTIONS CDS SESSION CLIENT CURRENT. There is no need to make any modifications in the method implementation.
Converting the OpenSQL statements into CDS views or AMDP methods also resolves CVA security checks for ABAP where sensitive database tables are read.