Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Display/Edit text from se61 in a custom container within a screen

oliver_am
Participant
0 Kudos

Hello,
I want to create a screen with a container to edit/display texts from se61, with the format options like this:

I know there classes to display texts like this:
cl_gui_textedit

And demo programs like:
SAPTEXTEDIT_DEMO_1
SAPTEXTEDIT_DEMO_3
SAPSCRIPT_DEMO_NOTE_EDITOR

But none of these programs show the format and paragrafh options like se61.

In the end in SE61 is calling FM EDIT_TEXT, where you hace a parameter DISPLAY to edit or only display the text.
But this FM is always to display the text in a full screen, not within a container, from the documentation of the FM:


"This function module is used to call the fullscreen editor."

I've tried to debug a bit and within this FM is calling others like RTF_EDITOR_CREATE_FRAME , RTF_EDITOR_CREATE_COMBOBOX . etc.

But couldnt see any class to use it in an easy way, a lot of code to copy/mantain also from the user_command.

Do you know if is there any easy way to call a text editor with this format options within a container?

Thanks in advance.

3 REPLIES 3

Sandra_Rossi
Active Contributor
0 Kudos

Do an ABAP trace (SAT) to know what programs and classes are used when you do SE61. Note that all GUI controls inherit from CL_GUI_CONTROL.

jrgkraus
Active Contributor
0 Kudos

I created a little class for this:

class zcl_tool_dia_docu_show definition
  public
  final
  create public .

  public section.
    methods show_docu
      importing
        object    type doku_obj
        language  type spras default sy-langu
        container type ref to cl_gui_container.
  protected section.
  private section.
    types:
      begin of itf_text,
        header type thead,
        lines  type standard table of tline with default key,
      end of itf_text,
      html_text type standard table of htmlline with default key.

    methods show_in_viewer
      importing
        html_viewer      type ref to cl_gui_html_viewer
        value(html_text) type html_text.

    methods convert_to_html
      importing
        value(itf)    type itf_text
      returning
        value(result) type html_text.

    methods read_raw_text
      importing
        object     type doku_obj
        language   type spras
      returning
        value(result) type zcl_tool_dia_docu_show=>itf_text.
endclass.



class zcl_tool_dia_docu_show implementation.
  method show_docu.
    data(itf) =
      read_raw_text(
        object   = object
        language = language ).

    if itf-lines is not initial.
      show_in_viewer(
        html_viewer = new cl_gui_html_viewer( parent = container )
        html_text = convert_to_html( itf ) ).
    endif.
  endmethod.

  method show_in_viewer.
    data l_url type char255.
    call method html_viewer->load_data
      exporting
        type         = 'text'
        subtype      = 'html'
        size         = 0
      importing
        assigned_url = l_url
      changing
        data_table   = html_text.

    call method html_viewer->show_url
      exporting
        url    = l_url
      exceptions
        others = 0.
  endmethod.

  method convert_to_html.
    call function 'SE_CONVERT_ITF_TO_HTML'
      exporting
        is_header    = itf-header
      tables
        it_itf_text  = itf-lines
        it_html_text = result
      exceptions
        others       = 0.
  endmethod.

  method read_raw_text.
    call function 'DOCU_GET'
      exporting
        id     = 'DT'
        langu  = language
        object = object
      importing
        head   = result-header
      tables
        line   = result-lines
      exceptions
        others = 0.
  endmethod.

endclass.

You can call it like this:

      new zcl_tool_dia_docu_show(
        )->show_docu(
          object    = 'Z_SAMPLE_OBJECT'
          container = instance_of_cl_gui_container  ).

raymond_giuseppi
Active Contributor
0 Kudos

Look at FM such as INT_OI_EDITOR (Word) or INT_SAPSCRIPT_EDITOR, or at the classes behind. You can find those using sandra.rossi's trick.