Strings are character fields, which don't really have a size. As field type in a (DDIC) table that's not possible - but in Abap memory it is ! If you are not used to strings yet, you will be soon. They reflect a certain freedom to the developer. Instead of an internal table of 100-character fields holding 1000 lines, the same table defined as strings consumes a lot less memory space. How ? Smart SAP memory management.
The length of a text field or string can be determined with
STRLEN or with the
DESCRIBE FIELD statement.
When using strings (or character fields), a nice alternative to the
CONCATENATE statement is the
&& operator. The example shows it all.
str = 'Hello' &&
' my' && ' friend'.
There is also the & literal, which does something very similar, but with a maximum of 255 characters (performed at compile time).
SAP has this simple short and sweet function module called
STRING_CENTER which does what it's name implies. Center a string, align in the middle. However: the function module is marked as obsolete and I can't find it's replacement/successor.. So here's the coding.
Large strings: type
XSTRING can be used to hold large XML file content or even in the process of creating a PDF file.
XSTRING is a predefined data type in Abap/4. It works pretty much like a string, but with no limits to it's size. Both
XSTRING have a variabele maximum size.