Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Streaming and Locators 

ABAP SQL - Locators

ABAP SQL supports locators for LOBs in data sources.

Other versions: 7.31 | 7.40 | 7.54

System Classes for Locators

The associated system classes for the two types of LOBs are:


The instances of the classes are LOB handles and implement the corresponding interfaces. Their use in ABAP SQL involves reference variables that point to the relevant LOB handles.

Important Methods

Locators contain the following methods that are implemented as kernel methods . Access to LOBs is completed by the ABAP runtime environment.

Methods in Both Locator Types

  • GET_LENGTH returns the length of the LOB that is connected to a locator.

  • FIND searches from an offset for a sub-sequence of an LOB which is connected to a locator, and returns its position. The length of a character-like substring that can be found using FIND is restricted to 1333 characters. The length of a binary substring is limited to 2666 bytes.

Methods from the IF_ABAP_CLOSE_RESOURCE interface:

  • CLOSE closes the locator.
  • IS_CLOSED returns "X", if the locator is closed.

Methods in Character-Like Locators

  • GET_SUBSTRING returns the sub-sequence specified using offset and length, of a CLOB which is connected to a locator.

Methods in Binary Locators

  • GET_BYTES returns the sub-sequence, specified using offset and length, of a BLOB which is connected to a locator.

Creating Locators for LOBs

A locator bound to an LOB (meaning an instance of the class CL_ABAP_DB_C_LOCATOR or CL_ABAP_DB_X_LOCATOR) can only be created if a LOB from the results set is assigned to a reference variable for a locator in the INTO clause of the statement SELECT.

Refer to SELECT - LOB Handles.


Locators cannot be created in modifying ABAP SQL statements. Locators created in a read statement can, however, be used to make changes.

Closing Locators

Due to high resource consumption, locators must always be closed as soon as possible using their CLOSE method. Especially when creating locators in SELECT loops, it must be remembered that locators are not closed implicitly using ENDSELECT, unlike reader streams, and must be closed explicitly. Furthermore, locators are closed implicitly at the end of a database LUW.


Executable Examples