Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Read only

Long text

Former Member
0 Likes
653

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
572

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

3 REPLIES 3
Read only

Former Member
0 Likes
573

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

Read only

Former Member
0 Likes
572

HI,

Try this FM IQAPI_WORD_WRAP

Read only

former_member156446
Active Contributor
0 Likes
572

use the FM : RKD_WORD_WRAP

Sample Code::>>