2005 Sep 21 3:40 PM
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)
Import param:
- string (or chars?)
- length of output lines
Export param:
- standard table
I can't remember what FM it was. Could anyone help me ?
Thanks in advance !
Manuel
2005 Sep 21 4:25 PM
Try Function SOTR_SERV_STRING_TO_TABLE
Pass TEXT & LINE LENGTH.
Cheers
Hi,
You need to fill LEN as well as MAXLEN..
LEN should be the length of your string..
Hope this helps.
It works for me
Pass '' for SEP_BEFORE and SEP_BEHIND and COMMENT if you dont need them.
Sri
2005 Sep 21 3:43 PM
2005 Sep 21 3:43 PM
2005 Sep 21 4:02 PM
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 ?
Many thanks,
Manuel
2005 Sep 21 4:13 PM
Hi,
You need to fill LEN as well as MAXLEN..
LEN should be the length of your string..
Hope this helps.
It works for me
Pass '' for SEP_BEFORE and SEP_BEHIND and COMMENT if you dont need them.
Sri
2005 Sep 21 4:11 PM
You can pass your string in the LINES table of the FORMAT_TEXTLINES, can't you ?
2005 Sep 21 4:25 PM
Try Function SOTR_SERV_STRING_TO_TABLE
Pass TEXT & LINE LENGTH.
Cheers
2005 Sep 21 4:32 PM
Hi all (and really thanks for your help)
For Guillaume:
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).
For Sri:
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
aaaaaaaaaa
instead of:
aaaaaaaaaa
bbbbbbbbbb
cccccccccc
dddddddddd
eeeeeeeeee
Regards,
Manuel
2005 Sep 21 4:32 PM
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.
Regards,
Rich Heilman
2005 Sep 21 4:33 PM
2005 Sep 21 4:34 PM
Hi Manuel,
len should be really the length of the entire text..
use STRLEN function and then pass it as LEN..
Sri
2016 Feb 10 12:24 PM
While FM SOTR_SERV_STRING_TO_TABLE works, it has an internal maximum string length of 255 characters! This is because it uses data element SOTR_TXT.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |