‎2008 Jan 03 3:47 PM
I want to make a line break in a string. Is this possible??
In Java it looks like "Hello
World".
The Output will look like
Hello
World
Greetings Volker
Edited by: Volker Schäfer on Jan 3, 2008 4:55 PM
‎2008 Jan 04 9:24 AM
try this....
REPORT ZSAMPLE. .
start-of-selection.
write: 'hello', /1 'world'.
Reward points if useful.
‎2008 Jan 03 4:11 PM
Hello Volker,
is your requirement to have it in one string?
Otherwise you can use the write statement:
write: 'Hello',
/ 'World'.
Best regards
Stephan
‎2008 Jan 03 4:16 PM
Yes in one String. I want to give a paramter string to another program und this makes write STRING
and the output is
Hello
World
‎2008 Jan 03 4:21 PM
we can declare a variable with value '/OD' hex value and concatenate to get a line break..
data: lv_line_feed type X value 'OD'
or
09.
‎2008 Jan 04 8:33 AM
I try this, but it don´t work. Type x? Can you write the exact code please? Thank you very much!
‎2008 Jan 04 8:46 AM
data:word(10) type c.
start-of-selection.
word = 'HelloWorld'.
write: word+0(5).
write:/ word+5(5).
‎2008 Jan 04 8:43 AM
I seyrch something like:
data test type string value 'test'.
data linebreak ?????
concatenate test linebreak test
‎2008 Jan 04 8:54 AM
data: ch type string.
data: ch1(2) type c.
ch1 = CL_ABAP_CHAR_UTILITIES=>CR_LF.
concatenate 'abc' 'def' into ch seperated by ch1.
write:/ ch.
it will display like abc##def.
the ## means line break here...
‎2008 Jan 04 9:04 AM
I really get the output abc##def. But what is the profit of this for me??
Edited by: Volker Schäfer on Jan 4, 2008 10:16 AM
‎2008 Jan 04 9:17 AM
Friend,
OK Sir, please don't mind...
One more way is there...try this...
data: itab2 type table of string.
data: str type string value 'Hello World'.
split str at space into table itab2.
loop at itab2 into str.
write:/ str.
endloop.
‎2008 Jan 04 9:23 AM
in ABAP the line break is done by '/'.
so where ever it finds '/' in the write statement it goes to next line....it user decision to locate the position to be splitted.
you can do it this way too
data:word(10) type c.
data:word_length type i.
start-of-selection.
word = 'HelloWorld'.
word_length = strlen( word ).
if word_length > 5.
write: word+0(5).
write:/ word+5(word_length).
else.
write: word+0(5).
endif.
‎2008 Jan 04 9:24 AM
try this....
REPORT ZSAMPLE. .
start-of-selection.
write: 'hello', /1 'world'.
Reward points if useful.
‎2008 Jan 04 9:25 AM
‎2008 Jan 04 9:41 AM
This are good ideas, but i want to give a string into a smartform and for this the line break must be "in the string". It must be possible in abap to do this like in Java:
String test = "hello""/n""world";
Or is this not possible?
Greetings Volker
‎2008 Jan 04 9:46 AM
I GUESS ITS NOT POSSIBLE...
BUT I THINK SO ITS POSSIBLE TO FORMAT THE STRING IN THE SMART FORM CODE.