Skip to Content
author's profile photo Former Member
Former Member

separating lines

I am using GET_TEXT_AS_R3TABLE from cl_gui_textedit class, and i obtein some lines in a table with ## marking the line jump, but i don´t know how to do it, because if i try to split at '##' it doesn´t do it, have i to convert one by one characters to ascii code or is there any way to do it?,

Thanks in advance.

example:

xxxxxxxx##ccc##vv####

i want:

xxxxxxxx##

ccc##

vv####

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 24, 2006 at 02:24 PM

    Hi carl,

    1. when we use this method,

    we don't get any ##,

    we stragith away get the 3 lines

    2.

    CALL METHOD editor->get_text_as_r3table

    • EXPORTING

    • ONLY_WHEN_MODIFIED = FALSE

    IMPORTING

    table = a

    • IS_MODIFIED =

    EXCEPTIONS

    • ERROR_DP = 1

    • ERROR_CNTL_CALL_METHOD = 2

    • ERROR_DP_CREATE = 3

    • POTENTIAL_DATA_LOSS = 4

    OTHERS = 5

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I have tried to use this method, but my problem is that sometimes i have one line that have more than 120 characters, because they can write pharagraphs without enter, so with this another method, how can i know that one line is a new line or not?

      Thanks in advance

  • author's profile photo Former Member
    Former Member
    Posted on Mar 24, 2006 at 02:26 PM
    report ychatest.
    
    data : str(45) value 'xxxxxxxx##ccc##vv####'.
    
    data: BEGIN OF ITAB occurs 0,
            WORD(20),
          END   OF ITAB.
    
    
    split str at '#' into table itab.
    
    loop at itab.
       write : / itab-word.
    endloop.
    
    output is 
    xxxxxxxx
    ccc
    vv
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 24, 2006 at 02:32 PM

    Hi again,

    1. Carriage and LINE FEED.

    2. those two characters ##

    actually must be

    Carriage, and Line Feed.

    3. To split them use like this.

    data : a(100) type c.

    data: BEGIN OF ITAB occurs 0,

    WORD(20),

    END OF ITAB.

    split a at <b>CL_ABAP_CHAR_UTILITIES=>CR_LF</b> into table itab.

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 24, 2006 at 03:15 PM
    try this .. i had assumed that ur text consists of only characters(lower case) and no numericals
    
    REPORT ychatest.
    
    DATA : str(45) VALUE 'xxxxxxxx##ccc##vv####',
           strlength TYPE i,
           i1 TYPE i VALUE 0,
           j1 TYPE i VALUE 1,
           char(1).
    
    DATA: BEGIN OF itab OCCURS 0,
            word(20),
          END   OF itab.
    
    TRANSLATE str TO UPPER CASE.
    strlength = STRLEN( str ).
    
    DO strlength TIMES.
      char = str+i1(j1).
      SEARCH sy-abcde FOR char.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      i1 = i1 + 1.
    ENDDO.
    TRANSLATE str TO LOWER CASE.
    
    SPLIT str AT char INTO TABLE itab.
    
    LOOP AT itab.
      WRITE : / itab-word.
    ENDLOOP.
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.