2014 Aug 20 3:08 PM
Hello,
I need a small logic to convert a text in a internal table so that the line length is restricted to 50 chars from existing 72 char.
Example :-
Currently internal table has the below data
I used TEXT_SPLIT and got the below output into a new IT with 50 char line length but the split line ( 2nd ) and the new line ( 3rd ) do not continue and looks like a split data.
Pls provide me a logic so that I can convert the data to something like this and show continuous text .
Pls let me know.
Regards
Praneeth
2014 Aug 20 3:40 PM
Hi,
FORMAT_TEXTLINES with FORMATWIDTH = 50, especially if the source table is of type TLINE (ITF or SapScript text). Result you can move to your own internal table.
cheers
Janis
Hello,
I need a small logic to convert a text in a internal table so that the line length is restricted to 50 chars from existing 72 char.
Example :-
Currently internal table has the below data
I used TEXT_SPLIT and got the below output into a new IT with 50 char line length but the split line ( 2nd ) and the new line ( 3rd ) do not continue and looks like a split data.
Pls provide me a logic so that I can convert the data to something like this and show continuous text .
Pls let me know.
Regards
Praneeth
2014 Aug 20 3:20 PM
Hi,
i dont think there is any FM that provides a solution. as i had to do a split, i checked if the next word exceed 50 characters. If so, i did a split at SPACE, because i did not want to devide the words.
regards
Stefan Seeburger
2014 Aug 20 3:36 PM
Hi Praneeth.
Why don't you concatenate all text lines inside a string variable and then split it using FM "SALP_POP_SPLIT_TEXT"?
As FM output uses string table, pay attention when some word exceeds line length on your work internal table or variable, because you have to break/split it manually!
Best regards from Brazil!
Alexandre B. Dambrowski
2014 Aug 20 3:40 PM
Hi,
FORMAT_TEXTLINES with FORMATWIDTH = 50, especially if the source table is of type TLINE (ITF or SapScript text). Result you can move to your own internal table.
cheers
Janis
2014 Aug 20 3:52 PM
2014 Aug 20 4:02 PM
For word lengths not exceeding 50 chars... Also, it may be useful to execute
CONDENSE_TEXTLINES after the format FM.
cheers
Janis
2014 Aug 20 3:45 PM
Here we go:
DATA: lv_text72(72),
lv_text50(50),
lv_len TYPE int4,
lt_split TYPE TABLE OF char40,
lr_split TYPE REF TO char40,
lt_char50 TYPE TABLE OF char50,
lt_char72 TYPE TABLE OF char72.
LOOP AT lt_char72 INTO lv_text72.
SPLIT lv_text72 AT space INTO TABLE lt_split.
LOOP AT lt_split REFERENCE INTO lr_split.
lv_len = STRLEN( lv_text50 ) + STRLEN( lr_split->* ).
IF lv_len LT 50.
CONCATENATE lv_text50 lr_split->* INTO lv_text50 SEPARATED BY space.
ELSE.
APPEND lv_text50 TO lt_char50.
lv_text50 = lr_split->*.
ENDIF.
ENDLOOP.
APPEND lv_text50 TO lt_char50.
ENDLOOP.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |