SAP NEWS-610-STRINGS



Get Example source ABAP code based on a different SAP table
  



Character Strings in ABAP Release 6.10
The following new functions are available for character strings in ABAP_RELEASE 6.10:
ITOC

ABAP_MODIFICATION_NN Identify the Length and Number of a Character

New functions:
The function 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.

ABAP_MODIFICATION_NN New Statements FIND and REPLACE

There is a new statement, FIND, for searching in character strings. This replaces the SEARCH statement. For replacing characters in character strings, the statement REPLACE has been expanded to include position-based replacements.

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

ABAP_MODIFICATION_NN Support for Strings in the Database

From ABAP_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:
Short strings consist of a maximum of 256 characters, do not have trailing blanks, and can be compared on the database.
Long strings can be of any length and do have trailing blanks; however they cannot be compared on the database.
When working with strings, some restrictions have to be observed. Further details are available here .

ABAP_MODIFICATION_NN Definition of String Constants

Strings can now also be defined as constants and can be given an initial value using the keyword VALUE. CONSTANTS str1 TYPE string VALUE 'ABC'.
DATA str2 TYPE string VALUE 'XYZ'.
str2 = str1.
str1 = str2. 'Syntax error
WRITE: / str1, str2.

ABAP_MODIFICATION_NN Introduction of Text String Literals

Text string literals are enclosed by backquotes in the form str = `ABC`. Text string literals are of data type string and trailing blanks are not ignored, unlike in text field literals.



Example ABAP Coding

ABEXA 01156
The length for the string str1 is cnt1 = 3 and the length for the string str2 is cnt2 = 5.
ABAP_EXAMPLE_END