‎2009 Jun 05 12:24 PM
Hi experts,
I need to pre-define a constant string with over 100 characters, so I want to split and span it over multiple lines. In Java-like languages I can do so with a backslash as last character in the line. Is there any similar technique in ABAP?
Kind regards, Matthias
‎2009 Jun 05 12:30 PM
Well i didnt understand your question .
If you are using a pre-defined constant and if your intention is to split it into multiple lines, why do you have to use one single constant for it? At the definition itself, can't you split it into multiple constants?
‎2009 Jun 05 12:30 PM
Well i didnt understand your question .
If you are using a pre-defined constant and if your intention is to split it into multiple lines, why do you have to use one single constant for it? At the definition itself, can't you split it into multiple constants?
‎2009 Jun 05 12:36 PM
No, it's the other way round: I want to create one constant with over 100 characters in length. But I don't want do write all those 100+ characters into one single line in the ABAP editor. So I want to do something like this:
CONSTANTS: lc_string TYPE string VALUE
'this is the first line of the constant' \
'and this is the second line, but still the same constant'.Kind regards, Matthias
‎2009 Jun 05 12:37 PM
‎2009 Jun 05 12:39 PM
Yes I know about the string table. I could also just create two constants and then concatenate them.
But I would prefer the solution as I know it from other programming languages ...
‎2009 Jun 05 12:42 PM
Hi,
Try this , use &
CONSTANTS: lc_string TYPE string VALUE
'this is the first line of the constant' &
'and this is the second line, but still the same constant'.
data var1 type string.
var1 = lc_string.
write var1.Regards
‎2009 Jun 05 12:47 PM
‎2009 Jun 05 12:52 PM
Hi,
Please try like below: Each line ends with 70 char's so if u want to print from second line use Offset like below (71, 142)
CONSTANTS: lc_string TYPE string VALUE
'this is the first line of the constant
and this is the second line, but still the same constant
second line'.
write : lc_string+71(3).
Rgds,
Pavan
‎2009 Jun 05 12:55 PM
‎2009 Jun 08 5:22 AM
hi you can use
cl_abap_char_utilities=>newline.
see other special characters...
http://erpbuzz.com/abap-new-line-tab-space-backspace-characters-char-util-class.php