Error
Error Code:
1318
SAP S/4HANA Error 1318: SQLScript Built-in Function Not Defined
Description
Error 1318, "ERR_SQLSCRIPT_BUILTIN_NOT_DEFINED", indicates that an SQLScript built-in function used within a database object (like a procedure, view, or calculation view) in SAP S/4HANA's underlying SAP HANA database is not recognized or available. This typically occurs during the activation, compilation, or execution of custom SQLScript code that references an undefined function.
Error Message
ERR_SQLSCRIPT_BUILTIN_NOT_DEFINED
Known Causes
4 known causesIncorrect Function Name or Typo
The built-in SQLScript function name is misspelled, uses incorrect casing, or does not exist in the current SAP HANA database version.
Missing HANA Database Feature/Version
The specific built-in function might be part of a newer SAP HANA database version, a specific database feature, or a component that is not enabled or installed in the current system's database.
Incorrect Database Context
The function is being called in a database schema or context where it is not applicable or cannot be resolved, possibly due to missing schema prefixing or incorrect database configuration.
Function Deprecation or Removal
A built-in function that was previously available might have been deprecated or removed in a recent major upgrade of the SAP HANA database.
Solutions
4 solutions available1. Verify SQLScript Built-in Function Availability easy
Checks if the used SQLScript built-in function is supported in your S/4HANA version and database.
1
Identify the specific SQLScript built-in function that is causing the error 1318. This information is usually present in the application log or trace file where the error occurred.
Example: SELECT * FROM MY_TABLE WHERE MY_FUNCTION(COLUMN_A) = 'VALUE';
2
Consult the SAP HANA SQL and System Views Reference documentation for your specific SAP S/4HANA version and underlying SAP HANA database version. Search for the identified built-in function to confirm its existence and syntax.
Refer to SAP Help Portal for SAP HANA documentation. Search for 'SQL and System Views Reference' specific to your HANA version (e.g., HANA 2.0 SPSXX).
3
If the function is not found or has been deprecated in your version, you will need to find an alternative or upgrade your SAP HANA database if possible. If the function is indeed missing or unsupported, the error is expected.
N/A
2. Check for Typographical Errors in SQLScript Functions easy
Ensures that the SQLScript built-in function is spelled correctly and uses the expected syntax.
1
Carefully review the SQLScript code where the error 1318 is reported. Pay close attention to the spelling of the built-in function name.
Example of a typo: `MYFUNCTIOIN(COLUMN_A)` instead of `MYFUNCTION(COLUMN_A)`
2
Verify that the function's arguments are correctly specified, including the number and data types of the parameters, as per the SAP HANA documentation.
Example: `CONCAT(string1, string2)` requires two string arguments.
3
Correct any spelling mistakes or syntax errors in the SQLScript code and re-execute the process or transaction that triggered the error.
N/A
3. Investigate Application Code and Parameter Passing medium
Determines if the error originates from how the application is calling the SQLScript function, especially with dynamic parameters.
1
Examine the application code (e.g., ABAP, SAPUI5) that is executing the SQLScript statement. Look for how the built-in function is being invoked.
For ABAP, this might involve checking function modules, AMDPs (ABAP Managed Database Procedures), or direct SQL execution.
2
If dynamic SQL is being used, ensure that the parameters being passed to the SQLScript function are correctly formed and do not contain unintended characters or syntax that could lead to the function being misinterpreted.
Example: If a parameter is supposed to be a string literal, ensure it's properly quoted within the generated SQL.
3
Use debugging tools within your application development environment to step through the code and inspect the generated SQL statement just before it's executed against the SAP HANA database.
In ABAP, use the debugger and set breakpoints before the database call. In SAPUI5, use browser developer tools.
4
If a parameter is causing the issue, ensure it's correctly bound or passed, potentially by explicitly casting it to the expected data type within the SQLScript call.
Example in SQLScript: `MY_FUNCTION(CAST(:parameter AS VARCHAR(100)))`
4. Analyze SAP HANA Database System Views for Function Information advanced
Provides a deeper dive into the SAP HANA database to verify function existence and definitions.
1
Connect to your SAP HANA database using a SQL client (e.g., SAP HANA Studio, DBVisualizer, or the `hdbsql` command-line tool).
Example using hdbsql:
`hdbsql -n <host>:<port> -u <user> -p <password>`
2
Query the `SYS.FUNCTIONS` system view to check if the built-in function is registered and available in the system. You can filter by function name.
SELECT * FROM SYS.FUNCTIONS WHERE FUNCTION_NAME = 'YOUR_FUNCTION_NAME';
3
If the function is not found in `SYS.FUNCTIONS`, query `SYS.PROCEDURES` to see if it might be defined as part of a procedure or a built-in system procedure.
SELECT * FROM SYS.PROCEDURES WHERE PROCEDURE_NAME = 'YOUR_FUNCTION_NAME';
4
If the function is still not found, and you are certain it should exist for your S/4HANA version, this might indicate a database inconsistency or a specific version dependency. In such cases, consider opening an SAP Support Ticket.
N/A