Embedded SQL 

One of the difficulties of connecting a programming language with an SQL interface is the transfer of retrieved data records. When the system processes an SQL statement, it does not know how big the result will be until it has made the selection. The result consists of table entries, which all have the same structure. The system has to transfer these records to the calling program in the form of a data structure, for example an array, that is known to the calling program.

The disadvantage of an array is its static definition. You have to specify the size of an array before runtime. However, because you cannot know the size of the dataset the system will return, you must define a very large array to avoid an overflow.

To circumvent this problem, the R/3 Basis System translates ABAP Open SQL statements into Embedded SQL. In Embedded SQL, the system defines a cursor that is used to regulate the data transfer between ABAP programs and a database. See also Database Operations.

During every FETCH operation, the database passes one or more data records to the R/3 database interface.