Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Character String and Byte String Processing →  Statements for Character String and Byte String Processing →  FIND 

FIND - section_of

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


... SECTION [OFFSET off] [LENGTH len] OF ... 

Effect

This addition restricts the search of the statements FIND and REPLACE in dobj to the section from the offset specified in off with the length specified in len. Without the addition, the whole data object is searched. off and len are numeric expression positions of operand type i. At least one of the additions OFFSET or LENGTH must be specified.

If an offset is specified without specifying the length, the data object dobj is scanned from the offset off to its end. If a length is specified but no offset, the offset 0 is used implicitly. The values of off and len must be greater than or equal to 0 and the section specified by off and len must be located within the length of dobj.


Example

The FIND statement searches from offset 12 and finds the "html" substring at offset 20.

FIND 'html' IN SECTION OFFSET 12 
            OF `<html><body>This is html</body></html>` 
            MATCH OFFSET DATA(moff). 
cl_demo_output=>display( moff ).