Hi all !
In the past i used a FM to convert a long string (or sequence of chars) into multiple table lines (rel. 4.6C)
- string (or chars?)
- length of output lines
- standard table
I can't remember what FM it was. Could anyone help me ?
Thanks in advance !
Hi Rich and Sri,
I tried to use the FM you suggested but I dont think they are useful in this case (or maybe i have made a mistake calling the FM).
FORMAT_TEXTLINES: i can't pass any string parameter
SPLIT_LINE: im passing TEXT, LEN and MAXLEN but it seems that it doesn't split anything
I make an example to clarify my problem.
1. I have a very long sring : var_1(1000) type c
2. I need to split this string in string with max length=50
3. the result should be an internal table of strings with 1000/50= 20 lines and length=50 chars.
Any suggestions ?
Hi all (and really thanks for your help)
I think i can't use LINES table.
Unfortunately this table has a structure with length 132 and I need to pass very long strings (1000 chars or more).
Maybe im passing something wrong...
data: text(1000), begin of tab occurs 0, text(10), end of tab. text = 'aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeee'. call function 'SPLIT_LINE' exporting text = text len = 10 maxlen = 10 SEP_BEFORE = '' SEP_BEHIND = '' COMMENT = '' tables result_tab = tab.
at this point table TAB contains
Yes, you pass the text in the TABLES parameter. Please implement the following example program.
report zrich_0002 . data: lines type table of tline with header line. lines-tdline = 'These are the lines that you want to be formatted. '. append lines. lines-tdline = 'You can have as many lines as you want.'. append lines. call function 'FORMAT_TEXTLINES' exporting * CURSOR_COLUMN = 0 * CURSOR_LINE = 0 * ENDLINE = 99999 formatwidth = 20 * LINEWIDTH = 132 * STARTLINE = 1 * LANGUAGE = SY-LANGU * IMPORTING * NEW_CURSOR_COLUMN = * NEW_CURSOR_LINE = tables lines = lines * EXCEPTIONS * BOUND_ERROR = 1 * OTHERS = 2 . if sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. endif. loop at lines. write:/ lines-tdline. endloop.