SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Release-Specific Changes → Changes in Release 6.10 →
Character Strings in Release 6.10
The following new functions are available for character strings in Release 6.10:
1. Establish the length and number of characters
2. New statements FIND and REPLACE
3. Faster access to strings
4. Support for strings in the database
5. Definition of string constants
6. Introduction of text string literals
Establishing the length and number of characters
New statements FIND and REPLACE
There is a new statement, FIND, for
searching in character strings. This replaces the SEARCH
command. For replacing characters in character strings, the statement
REPLACE has been extended to include position-based replacements.
Faster access to strings
Offset/length access is now the fastest way to process a string character by character. This technique is also faster than searching in a field of type C that is assigned to a field symbol.
Support for strings in the database
From Release 6.10, character strings and binary data can be stored in database columns of types STRING or RAWSTRING. The system differentiates between short and long strings:
When working with strings, some restrictions have to be observed. Further details are available here.
Defining string constants
Strings can now also be defined as constants and can be given an initial value using the keyword VALUE.
Introduction of text string literals
Text string literals are enclosed by backquotes in the form str = `ABC`. String literals are of data type STRING and trailing blanks are not ignored, unlike in text field literals.
DATA: str1 TYPE string VALUE 'ABC ',
str2 TYPE string VALUE `ABC `,
cnt1 TYPE i,
cnt2 TYPE i.
cnt1 = strlen( str1 ).
cnt2 = strlen( str2 ).
WRITE: / cnt1, cnt2.
The length for the string str1 is cnt1 = 3 and the length for the string str2 is cnt2 = 5.