Text Editor using CL_GUI_TEXTEDIT & Reading Text

 DATA lr_custom_cont TYPE REF TO cl_gui_custom_container,
              lr_text_edit TYPE REF TO cl_gui_textedit,
              lt_text TYPE TABLE OF char255.



MODULE create_pf_staus OUTPUT.
*  MODULE create_container OUTPUT
MODULE create_container OUTPUT.
  IF lr_custom_cont IS NOT BOUND.

    CREATE OBJECT lr_custom_cont
        container_name ‘EDITOR’ ” Name of the Screen CustCtrl
        repid          syrepid
        dynnr          sydynnr.
ENDMODULE.                    “create_container OUTPUT

*  MODULE create_text_editor OUTPUT
MODULE create_text_editor OUTPUT.
  IF lr_text_edit IS NOT BOUND.

    CREATE OBJECT lr_text_edit
        wordwrap_mode     ” 0: OFF; 1: wrap a window border; 2: wrap at fixed pos
        wordwrap_position 254   ” pos of wordwrap, only makes sense with wordwrap_mode=2
        parent   lr_custom_cont.     ” Parent Container
ENDMODULE.                    “create_text_editor OUTPUT
MODULE read_editor_text INPUT.
  CASE syucomm.
    WHEN ‘SAVE’.

      CALL METHOD lr_text_edit->get_text_as_r3table
          table lt_text.   ” text as R/3 table


 Instead of above method ‘get_text_as_r3table’  to read the editor text content as an alternative another method get_text_as_stream can be used

      CALL METHOD lr_text_edit->get_text_as_stream
text                   lt_text     ” text as stream with carrige retruns and linefeeds
*         is_modified            =     ” modify status of text
error_dp               1
error_cntl_call_method 2
OTHERS                 3. 

Here is the flow logic of the screen.

 Here is the  pf status tool bar button details.

 Once the user Clicks on the  SAVE button, Then the editor text will be placed on the internal table.

 Run the program and enter some text and save.

The editor text now available in the internal table which can be stored DB table.



One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s