Show TOC

Background documentationConcepts Used in Queries Locate this document in the navigation structure

 

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 interface IF_OS_QUERY and is created by what is called a Query Manager.

A query is a logical expression that compares the attributes of a persistent class with parameters or values of your choice, called the filter condition. The objects whose attributes meet the filter conditions are loaded. A query also contains what is known as a sort condition, which determines the sequence of the loaded objects in the result table.

When a query is created with the Query Manager’s 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 interface method IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_QUERY in the class actor 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.

Note 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.

End of the note.