SAP CL SQL STATEMENT

Get Example source ABAP code based on a different SAP table
  


ARTICLE
• CL_SQL_STATEMENT ABAP_CLASS

CL_SQL_STATEMENT - Execution of SQL Statements
The CL_SQL_STATEMENT class contains instance methods that receive and execute dynamically created SQL statements.
Instances of the CL_SQL_STATEMENT class can be created using the statement CREATE OBJECT or the instance operator NEW, which allow a reference to an object of the CL_SQL_CONNECTION class to be passed to the constructor. If no database connection is passed, a standard connection from the database interface to the central database of the AS ABAP is used.
DDL and DML Statements
Queries
Stored Procedures

Notes
The CL_SQL_STATEMENT class allows the statement passed to be executed once. To execute a statement multiple times with different parameters, you can use the subclass CL_SQL_PREPARED_STATEMENT.
An object of the class CL_SQL_STATEMENT is often only intended to be used once, which means it is also only addressed once. In this case, the instance operator NEW with appended method call can be used to create the instance. This removes the need to declare a reference variable explicitly.
The methods in the class CL_SQL_STATEMENT should not be used to execute transaction-control statements (COMMIT, ROLLBACK). This is because they are not not detected by the database interface, which then might not execute the actions required at the end of a transaction. Only the appropriate methods in the class CL_SQL_CONNECTION can be used for transaction control.