11-27-2011 11:11 AM
Hi all,
Im using text editor for saving the long text entered in the text editor as standard text in So10 tcode.
Here im facing an issue in reading the text from text editor. That is, when the text is entered by the user for first time, then the below method reads the text successfully. But when i do some changes in the existing text present in the text editor and try to read, then the modified text is not returned by the below method.
I use the "CALL METHOD g_editor_ftext1->get_text_as_stream" to read the text. Given below is my code.
CALL METHOD g_editor_ftext1->get_text_as_stream
IMPORTING
text = ig_text_table
is_modified = g_xthead_updkz
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
OTHERS = 3.
The return value of "is_modified" is always returned as 0.
Could anyone pls help how to read the modified text using the above method?
11-28-2011 5:35 AM
Hi,
Your code works fine for me
To read the modified text pass like below..Check if this works
call method editor->get_text_as_stream
EXPORTING
only_when_modified = '1' "<--
IMPORTING
text = tlines
is_modified = modon
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
OTHERS = 3.
11-28-2011 12:45 PM
Hi,
I tried passing the "only_when_modified" paramter as 0 and 1 and tried. Still facing the same issue in both the cases..
Pls help me.
11-29-2011 6:06 AM
Check if this works and if it works then there should be some mistake in your coding
REPORT abc.
PARAMETERS:pa1 TYPE bwart.
DATA: container TYPE REF TO cl_gui_docking_container,
editor TYPE REF TO cl_gui_textedit,
report TYPE syrepid,
mod TYPE i,
modon TYPE i.
DATA:tlines TYPE TABLE OF tdline,
wa_tlines TYPE tdline.
AT SELECTION-SCREEN OUTPUT.
report = sy-repid.
IF container IS INITIAL.
CREATE OBJECT container
EXPORTING repid = report
dynnr = sy-dynnr
side = container->dock_at_left
extension = 1070.
CREATE OBJECT editor
EXPORTING
parent = container.
ENDIF.
wa_tlines = 'This is test before a change'.
APPEND wa_tlines TO tlines.
CALL METHOD editor->set_text_as_r3table
EXPORTING
table = tlines
EXCEPTIONS
OTHERS = 1.
CALL METHOD editor->go_to_line( 1 ).
START-OF-SELECTION.
CLEAR tlines[].
CALL METHOD editor->get_text_as_stream
EXPORTING
only_when_modified = '1'
IMPORTING
text = tlines
is_modified = modon
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
OTHERS = 3.
IF modon = 1.
WRITE 'Changed'.
ELSE.
WRITE 'Not changed'.
ENDIF.
WRITE modon.