ABAP Keyword Documentation → ABAP - Reference → Processing External Data → ABAP Database Accesses → Object Services → query service
Query Service Overview
A query is used to search for persistent objects in the database using conditions and to create the corresponding instances of the persistent class in the ABAP program.
A query is implemented by an object (query object) that implements the interface IF_OS_QUERY and is created by a query manager.
A query is a logical expression that compares the attributes of a persistent class with parameters or values that comprise the filter condition. The objects whose attributes meet the filter conditions are loaded. A query also contains a sort condition, which determines the order of the loaded objects in the results table.
When a query is created using the query manager method CREATE_QUERY method, the filter conditions and sort conditions are passed to it.
The query itself is merely a container for the filter condition and the sort condition. A query is executed by calling the interface method IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_QUERY in the class agent of a persistent class. Similarly, the result of a query’s execution is not bound to the query, but is returned by the class actor’s method as a table of references.
Other versions:
7.31 | 7.40 | 7.54
Note
When the result quantity of a query is determined, the changes that are made in the current transaction to persistent objects are not considered. The query is executed directly in the database.