Error
Error Code:
1350
SAP S/4HANA Error 1350: Forbidden SQLScript Feature
Description
This error indicates that a SQLScript statement or feature producing varying results (non-deterministic) is being used in a context requiring consistent output. It typically occurs in SAP HANA views, calculated columns, or specific database procedures where data integrity demands deterministic operations.
Error Message
ERR_SQLSCRIPT_NOT_ALLOWED_NON_DETERMINISTIC_FEATURE
Known Causes
3 known causesNon-Deterministic Functions in Views 💻
Employing functions like NOW(), RAND(), or CURRENT_TIMESTAMP within SAP HANA calculation views or calculated columns, where the output must be consistent across executions.
External or Non-Deterministic UDFs ⚙
Invoking user-defined functions or external procedures that are inherently non-deterministic or not explicitly marked as such, in a context requiring consistent results.
Restricted SQLScript Contexts 🔒
Using non-deterministic SQLScript features within specific database objects or procedures, such as read-only views, which strictly enforce deterministic behavior for data integrity.
Solutions
3 solutions available1. Identify and Refactor Non-Deterministic SQLScript Features advanced
Locate the specific non-deterministic function or statement and replace it with a deterministic alternative.
1
Analyze the SQLScript code that is triggering the error. This often involves examining custom ABAP code, HANA calculation views, or stored procedures.
2
Identify common non-deterministic features. These include functions that rely on system time (e.g., `NOW()`, `SYSDATE`), random number generators, or external system calls. Example of a non-deterministic function: `SELECT NOW() FROM DUMMY;`
SELECT NOW() FROM DUMMY;
3
Refactor the code to use deterministic alternatives. For example, if system time is required, pass it as an input parameter to the SQLScript. If a random number is needed, consider generating it in ABAP before calling the SQLScript.
-- Example: Passing system date as parameter (assuming it's called from ABAP)
-- In ABAP, you would pass sy-datum to this procedure.
CREATE PROCEDURE my_deterministic_proc (IN input_date DATE) AS
BEGIN
-- Use input_date instead of NOW() or SYSDATE
INSERT INTO my_table (date_col) VALUES (input_date);
END;
4
Recompile or re-deploy the modified SQLScript object.
2. Review and Adjust HANA Calculation View Properties medium
Modify the properties of HANA Calculation Views to avoid non-deterministic SQLScript usage.
1
Open the affected HANA Calculation View in the SAP HANA Application Lifecycle Management (HALM) or SAP Business Application Studio (BAS).
2
Navigate to the 'Properties' or 'Settings' of the Calculation View.
3
Look for settings related to 'SQLScript' or 'Execution' and ensure that options permitting non-deterministic features are disabled or set to be restrictive. The exact property name may vary slightly depending on the HANA version and development environment.
4
If the view uses a Scripted Calculation View and contains non-deterministic SQLScript, you will need to refactor the script within the view as per Solution 1.
5
Save and activate the Calculation View.
3. Isolate and Remove Direct Calls to Forbidden Functions easy
Find and remove any direct use of non-deterministic built-in HANA functions.
1
If you are directly calling a HANA SQLScript function that is known to be non-deterministic (e.g., `CURRENT_TIMESTAMP`, `RAND()`), identify where this call is occurring.
SELECT CURRENT_TIMESTAMP FROM DUMMY;
2
Replace the non-deterministic function with a deterministic alternative. If you need the current timestamp, pass it as a parameter from the calling application (e.g., ABAP).
-- Assuming 'current_time_param' is passed from the application
SELECT :current_time_param FROM DUMMY;
3
Test the modified code to ensure it functions as expected.