‎2007 Sep 02 4:27 PM
Hi,
I am using the object cl_gui_textedit to get data from user. To read the data i am using the method 'get_text_as_stream' but i am unable to determine wat variable will be able to receive the data so fetched.
Its a pointer of type standard table inside the method.
I just wanna have 200 words out of the Text edit.
So wat is the var type to be assigned to Field symbol for the same to get the data.
Regards
‎2007 Sep 03 1:17 PM
Hi,
I had used the GET_TEXT_AS_R3TABLE and it was working satisfactorily .
The req. was to understand the stream functionality and to avoid a loop/read on table.
Also as in my requirement there was a word limit of 200. I wanted to use this so i can take the output directly to a var of char200 without actually looping at the table.
The variable declaration was very helpful and new to me.Thnx Vivek.
Anyways if anyne knows why carriage return is represented as ## in the stream .
do reply. Or is it that the carriage return/line feed is ## .
Regards
‎2007 Sep 02 4:35 PM
Hi,
The text of the object will come as records in the table type parameter. Declare an internal table of character type say of length 200.
DATA : itab TYPE STANDARD TABLE OF char200. Take this length as the maximum possible length of the record.
Get the data into this internal table and then read it to get your data.
Thanks and Best Regards,
Vikas Bittera.
‎2007 Sep 02 6:54 PM
Hi Narayanan,
as fasr as I remember you have to SAVE the text then the editor is closed and it is in the internal table you passed before.
Regards,
Clemens
‎2007 Sep 02 7:04 PM
Hi,
Why don't you try this way.
constants: c_line_length type i value 200.
types: begin of t_texttab_line,
line(c_line_length) type c,
end of t_texttab_line.
data : wa_texttab type t_texttab_line.
data : g_texttab type table of t_texttab_line.
If you are using module pool call the editor in PB0.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
module status_1300 output.
if g_editor is initial.
g_repid = sy-repid.
create object g_editor_container
exporting
container_name = 'TEXTEDITOR'
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
if sy-subrc ne 0.
endif.
create object g_editor
exporting
parent = g_editor_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
exceptions
others = 1.
if sy-subrc ne 0.
endif.
endif.
endmodule. "status_1300 OUTPUT
Then for retrieve the value
* retrieve table from control
call method g_editor->get_text_as_r3table
importing
table = g_texttab
exceptions
others = 1.
* Free the container
if not g_editor is initial.
call method g_editor->free
exceptions
others = 1.
if sy-subrc ne 0.
endif.
free g_editor.
endif.
May this will help you
a®
‎2007 Sep 03 12:25 PM
Hi,
That is perfect and solved. but some # is getting introduced in it when user hits enter.
Is there any ways to avoid it. Anyways suggestions are very useful.
Thanx a lot.
Please suggest if any ways to avoid the 2 hash '##' that comes in place of Enter key by user.
Regards.
‎2007 Sep 03 12:55 PM
Hi,
if you are using the method GET_TEXT_AS_R3TABLE ,this problem will be erased.In GET_TEXT_AS_STREAM the table is returned with line feed and carriage return.Thats y that is coming.In r3table there will be no problems like that.The procedures are same as stream only.
reward if useful.
‎2007 Sep 03 1:17 PM
Hi,
I had used the GET_TEXT_AS_R3TABLE and it was working satisfactorily .
The req. was to understand the stream functionality and to avoid a loop/read on table.
Also as in my requirement there was a word limit of 200. I wanted to use this so i can take the output directly to a var of char200 without actually looping at the table.
The variable declaration was very helpful and new to me.Thnx Vivek.
Anyways if anyne knows why carriage return is represented as ## in the stream .
do reply. Or is it that the carriage return/line feed is ## .
Regards
‎2007 Sep 03 1:21 PM
Hi Narayanan ,
1. is the representation for non-printable non-diaplayable characters. See hex representation in debugger.
You way do this
data:
cr_lf type string.
concaténate
cl_abap_char_utilities=>CR
cl_abap_char_utilities=>LF
into cr_lf.
replace all occurences of cr_lf in stream with ' '.
Regards,
Clemens
‎2007 Sep 03 1:43 PM
hi,
while using stream method,the text is stored as a stream with line feeds stored as ##.To work with stream u can use the FM CONVERT_STREAM_TO_ITF_TEXT after calling the method.See the demo program SAPSCRIPT_DEMO_NOTE_EDITOR.
‎2007 Sep 03 1:51 PM
Hi,
Thnkx for help.It was really useful & knowledgeable.
Thnkx Clemens & TT.
Regards
Edited by: Narayanan Nampoothiry K on Aug 1, 2008 10:49 AM