2006 Mar 24 2:20 PM
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####
2006 Mar 24 2: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.
2006 Mar 24 2:31 PM
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
2006 Mar 24 2: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
2006 Mar 24 2:32 PM
data : text(100) value 'yourtext with hashes'.
data: begin of it_text occurs 0,
char(20),
end of it_text.
split text at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into table it_text.
loop at it_text.
write : / it_text-char.
endloop.
2006 Mar 24 2:33 PM
Hi sekhar, the problem is that i think that it doesn´t works because they are special character, not a simple #,
thanks in advance
2006 Mar 24 2:34 PM
Try this ....
data : text(100) value 'yourtext with hashes'.data: begin of it_text occurs 0,
char(20),
end of it_text.
split text at CL_ABAP_CHAR_UTILITIES=>CR_LF into table it_text.
loop at it_text.
write : / it_text-char.
endloop.Regards
Vijay
2006 Mar 24 2: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.
2006 Mar 24 2:39 PM
Sorry, but the CL_ABAP_CHAR_UTILITIES=>CR_LF gives me a syntax error, is there any declaration else needed?
Thaks in advance
2006 Mar 24 2:43 PM
Hi again,
1. just check out in SE24,
whether this class is there or not.
CL_ABAP_CHAR_UTILITIES
2. U can try like this also.
report abc.
<b>data : m type ref to CL_ABAP_CHAR_UTILITIES.</b>
data : a(100) type c.
data: BEGIN OF ITAB occurs 0,
WORD(20),
END OF ITAB.
<b>split a at m->CR_LF into table itab.</b>
regards,
amit m.
2006 Mar 24 2:45 PM
I don´t have this class in my sap version 4.6C, or at least it doesn´t appear in se24
2006 Mar 24 2:46 PM
what error you got, and check it in SE24 for that class.
class cl_abap_char_utilities definition load.
then use split...etc.
regards
Vijay
2006 Mar 24 2:46 PM
Hi again, The program doesn´t works too, is there any other solution please?
Thanks in advance
2006 Mar 24 2:51 PM
Hi Carl,
then you need take help of hexadecimal values . using them only you can split.
Regards
Vijay
2006 Mar 24 3:01 PM
2006 Mar 24 3:04 PM
Take the following example program. Here, I am not seeing any ## when entering text and writing it out to the list.
report zrich_0001 .
data:
dockingleft type ref to cl_gui_docking_container,
text_editor type ref to cl_gui_textedit,
repid type syrepid.
data: textlines type table of tline-tdline,
wa_text type tline-tdline.
parameters: p_check.
at selection-screen output.
repid = sy-repid.
create object dockingleft
exporting repid = repid
dynnr = sy-dynnr
side = dockingleft->dock_at_left
extension = 1070.
create object text_editor
exporting
parent = dockingleft.
start-of-selection.
call method text_editor->get_text_as_r3table
importing
table = textlines
exceptions
others = 1.
loop at textlines into wa_text.
write:/ wa_text.
endloop.
Regards,
Rich Heilman
2006 Mar 24 3:17 PM
Hi Rich,
i am in 4.6C, but i think that i have obtain the solution with the ascii characters, the # returns a 0D.
My code:
CALL METHOD o_editor->GET_TEXT_AS_STREAM
IMPORTING
TEXT = it_memo[]
IS_MODIFIED = modificat.
data: begin of it_text occurs 0,
char(120),
end of it_text.
data: a(120), b(120).
if modificat = 1.
loop at it_memo.
data texto(1).
data texto2(2).
data contador type i value 0.
do 120 times.
contador = contador + 1.
clear texto.
if contador = 1.
texto = it_memo-linea(1).
else.
clear contador2.
texto = it_memo-linea+contador(1).
endif.
CALL FUNCTION 'URL_ASCII_CODE_GET'
EXPORTING
TRANS_CHAR = texto
IMPORTING
CHAR_CODE = texto2.
enddo.
Thanks in advance for everybody
2006 Mar 24 3:18 PM
2006 Mar 24 3:24 PM
Hi Rich, my problem was that i have pharagraphs and i wanted to know if i have make a jump line or not, but with ascii characters i have resolved the problem,
Thank you very much
2006 Mar 24 3:32 PM
Since you are in 46c, you can use SPLIT at a hex value as follows. This is not allowed in higher versions, but in 46c, it is allowed.
data: v_tab type x value '09'.
split mytext at v_tab into a b c......
Use the corresponding hex equivalents for line feed, soft line feed, new line etc.
Here is the complete list of<a href="http://www.laynetworks.com/ASCII%20to%20hex%20value%20chart.htm">hex conversions</a>.
2006 Mar 24 3: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.