โ2009 Apr 17 5:49 PM
Hi all,
I have to split a long text @ every 72 characters .But the split should not break any word in betwwen .
For example : ABAP READ_TEXT functions to read the SAP Long Text. ... Procedure to create SD text types ยท Read sales document flow using a function .... Example of READ_TEXT functions reading tables PBIM - Independent requirements for material. ...
the split should not break the word like this
ABAP READ_TEXT FUNCTIONS TO READ THE SAP LONG TEXT. ... PROCEDURE TO CRE
ATE SD TEXT TYPES ยท READ SALES DOCUME
the CREATE should come in to next line .
Is there any dynamic way to do that ?
Please let me know asap
โ2009 Apr 17 5:56 PM
Hi Tashvi,
LOOP AT t_texts WHERE kunnr IS NOT INITIAL.
w_tabix1 = sy-tabix.
t_lines-tdformat = '* '.
w_len = STRLEN( t_texts-text ).
w_cnt = 72.
w_tot = 1500.
* Now split the text into line lengths of 72 or less
WHILE w_len GT 0.
w_cnt = 72.
* Now need to make sure a word is not split in the middle
IF w_len GT 72 AND
t_texts-text+72(1) NE ' ' .
WHILE w_cnt GT 0.
w_cnt = w_cnt - 1.
IF t_texts-text+w_cnt(1) EQ ' '.
t_lines-tdline = t_texts-text+0(w_cnt).
EXIT.
ENDIF.
ENDWHILE.
ELSE.
t_lines-tdline = t_texts-text+0(w_cnt).
w_cnt = 72.
ENDIF.
APPEND t_lines. "Append to another internal table for further process to save text
endloop.
Regards,
Prabhudas
Edited by: Prabhu Das on Apr 17, 2009 10:27 PM
โ2009 Apr 17 5:56 PM
Hi Tashvi,
LOOP AT t_texts WHERE kunnr IS NOT INITIAL.
w_tabix1 = sy-tabix.
t_lines-tdformat = '* '.
w_len = STRLEN( t_texts-text ).
w_cnt = 72.
w_tot = 1500.
* Now split the text into line lengths of 72 or less
WHILE w_len GT 0.
w_cnt = 72.
* Now need to make sure a word is not split in the middle
IF w_len GT 72 AND
t_texts-text+72(1) NE ' ' .
WHILE w_cnt GT 0.
w_cnt = w_cnt - 1.
IF t_texts-text+w_cnt(1) EQ ' '.
t_lines-tdline = t_texts-text+0(w_cnt).
EXIT.
ENDIF.
ENDWHILE.
ELSE.
t_lines-tdline = t_texts-text+0(w_cnt).
w_cnt = 72.
ENDIF.
APPEND t_lines. "Append to another internal table for further process to save text
endloop.
Regards,
Prabhudas
Edited by: Prabhu Das on Apr 17, 2009 10:27 PM
โ2009 Apr 17 6:11 PM
โ2009 Apr 17 6:52 PM