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. Identify the length and number of a character
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
Other versions: 7.31 | 7.40 | 7.54
Modification 1
Identify the Length and Number of a Character
charlen provides the length of the first character of a string or of a character-like field.
numofchar can be used to obtain the number of characters in a string or a character-like field.
dbmaxlen provides the maximum length of the string as stored in ABAP Dictionary.
Modification 2
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.
Modification 3
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.
Modification 4
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 distinguishes short strings from long strings:
When working with strings, some restrictions have to be observed. Further details are available here.
Modification 5
Definition of String Constants
Strings can now also be defined as constants and can be given an initial value using the keyword VALUE.
DATA str2 TYPE string VALUE 'XYZ'.
str2 = str1.
str1 = str2. "Syntax error
WRITE: / str1, str2.
Modification 6
Introduction of Text String Literals
Text string literals are enclosed by back quotes in the form
str = . String literals are of data type ABCSTRING 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.