SAP EXEC PROCEDURE ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• EXECUTE PROCEDURE EXEC SQL
• IN EXEC SQL
• OUT EXEC SQL
• INOUT EXEC SQL

ABAP_EXEC_SQL - EXECUTE PROCEDURE

ABAP_SYNTAX
EXEC SQL.
EXECUTE PROCEDURE proc ( IN p_in1, IN p_in2, ...
OUT p_out1, OUT p_out2, ...
INOUT p_inout1, INOUT p_inout2, ... )
ENDEXEC.

What does it do?
In database systems, procedures can be defined as stored procedures. Since the syntax for calling this type of procedure and the associated parameter passing can vary widely for various database systems, a uniform statement exists in statically embedded Native SQL.
The statement EXECUTE PROCEDURE calls a procedure proc stored in the database. For all formal parameters of the procedure, actual parameters separated by commas must be specified. IN, OUT, or INOUT must be specified in front of every actual parameter, to indicate whether the parameter is an input, output, or input/output parameter. Literals or host variables indicated by colons (:) can be used for the actual parameters.
BEGIN_SECTION SAP_INTERNAL_HINT
For special internal usage on some databases the host variables can also be internal tables here. Then, they must be standard tables without secondary key.
END_SECTION SAP_INTERNAL_HINT



Latest notes:

On the SAP HANA database, the stored procedures are database procedures written in SQLScript. In ABAP, these procedures can be managed and called using ABAP Managed Database Procedures (AMDP) and the special statement CALL DATABASE PROCEDURE. This statement enables access using a secondary connection.
EXECUTE PROCEDURE can be used to call procedures with input and output parameters but cannot be used to call functions with return values. In SQL, functions are used directly in suitable operand positions (see Executable Example ).
ABAP_HINT_END



Example ABAP Coding

Definition of a procedure abap_docu_demo_incprice using database-specific SQL statements and calling the procedure with the SAP-specific Native SQL statement EXECUTE PROCEDURE. The execution of the program section increases the price of every flight for the current client in the table SFLIGHT by a specific amount. See also the corresponding executable example for ADBC.
ABEXA 00247
ABAP_EXAMPLE_END

Return to menu