SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Accesses → ABAP and SAP HANA → SQLScript Call →
CALL DATABASE PROCEDURE
Syntax
CALL DATABASE PROCEDURE
{ proxy
[CONNECTION con|(con_syntax)] parameter_list }
| { (proxy_name) [CONNECTION con|(con_syntax)] {parameter_list
|parameter_table} }.
Addition:
... CONNECTION con|(con_syntax)
Effect
This statement calls a database procedure written in SQLScript on an SAP HANA database.
The database procedure is specified using a dedicated database procedure proxy. This proxy can either be specified directly as proxy or dynamically as the uppercase content of a parenthesized character-like data object, proxy_name. The actual parameters for the input and output parameters of the procedure are either specified statically using parameter_list or dynamically using parameter_table.
Notes
... CONNECTION con|(con_syntax)
Effect
The database procedure is not executed on the standard database but on the specified secondary database connection. The database connection can be specified statically with con or dynamically as the content of con_syntax, where the field con_syntax must belong to the type c or string. The database connection must be specified with a name that is in column CON_NAME in table DBCON.
Notes
Example
Database Procedure
Take the following database procedure:
The input parameters are:
Parameter | Database Type |
in_sel | Table Data Type |
in_date | Scalar |
The components of in_sel are:
Component | Database Type |
FIRST_NAME | NVARCHAR, Length 20 |
LAST_NAME | NVARCHAR, Length 20 |
The output parameters are:
Parameter | Database Type |
out_items | Table Data Type |
The components of out_items are:
Component | Database Type |
POS | INTEGER |
FIRST_NAME | NVARCHAR, Length 20 |
LAST_NAME | NVARCHAR,Length 20 |
DATE | INTEGER |
CURRENCY | NVARCHAR, Length 4 |
AMOUNT | DECIMALS, Length 11, Scale 2 |
Database Procedure Proxy
The following mapping is defined in the associated database procedure proxy ..._PROXY:
Procedure Parameter | ABAP Name | ABAP Data Type |
IN_SEL | IN_SEL | Internal table |
IN_SEL, FIRST_NAME | IN_SEL, FIRST_NAME | c, length 20 |
IN_SEL, LAST_NAME | IN_SEL, LAST_NAME | c, length 20 |
IN_DATE | IN_DATE | d |
OUT_ITEMS, POS | OUT_ITEMS, POS | i |
OUT_ITEMS, FIRST_NAME | OUT_ITEMS, FIRST_NAME | c, length 20 |
OUT_ITEMS, LAST_NAME | OUT_ITEMS, LAST_NAME | c, length 20 |
OUT_ITEMS, DATA | OUT_ITEMS, POSTING_DATE | d |
OUT_ITEMS, CURRENCY | OUT_ITEMS, CURRENCY | c, length 4 |
OUT_ITEMS, AMOUNT | OUT_ITEMS, AMOUNT | p, length 6, 2 decimal places |
Note the name and type changes in the date fields.
Database Procedure Interface
The database procedure interface IF_..._PROXY is generated with the following type declarations:
Database Procedure Call
The following ABAP program section calls the database procedure using the name of the database procedure proxy; actual parameters typed using the database procedure interface are used.
Example
The example Database Procedure Call uses a database procedure proxy created in the program to call a database procedure created using
ADBC.
Catchable Exceptions
Except for CX_SY_DB_PROCEDURE_SQL_ERROR, all the following exception classes are subclasses of the abstract superclass CX_SY_DB_PROCEDURE_CALL.
CX_SY_DB_PROCEDURE_SQL_ERROR
CX_SY_DB_PROCEDURE_CONNECTION
CX_SY_DB_PROCEDURE_NOT_FOUND
CX_SY_DB_PROCEDURE_NOT_SUPP
CX_SY_DB_PROCEDURE_OVERFLOW
CX_SY_DB_PROCEDURE_PARAMETER
Cause: One of the following exceptions was raised (abstract superclass).
Non-Catchable Exceptions