Skip to Content
avatar image
Former Member

Long text editor

Hi,

I have a requirement in program to have below:

I need long text editor which displays already existing texts in DISPLAY mode and simantaneously allows me to enter texts in CREATE mode in same editor.

How can i achieve it?

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 22, 2008 at 12:41 PM

    Hi,

    SAP itself has many sample programs for Text editor.

    In SE38 give SAPTEXTEDIT* and press F4 to get a list of texteditor demo and sample programs.

    Go through the programs, you will surely get some idea as well as you can implement the code to your requirements.

    Regards

    Karthik D

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2008 at 06:03 AM

    Hi ,

    U just go to the transaction se39 ( ABAP Split Screen Editor ) . In Fist Tab give old program Name and in second tab give the editable program name .

    Regards ,

    Venkat JD

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 22, 2008 at 11:35 AM

    Use the FM READ_TEXT for reading the existing data and use the FM EDIT_TEXT to change/create data and use FM SAVE_TEXT to save the long text.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 22, 2008 at 11:39 AM

    Refer this link -

    text-editor

    Please have a look at my answer.

    Regards,

    Aparna Gaikwad

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 22, 2008 at 11:51 AM

    Check out this code:

    *&---------------------------------------------------------------------*
    *& Report  ZTEST_SOURAV7
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    report  ztest_sourav7.
    data:
    i_text_tab  type standard table of tdline initial size 0,
    v_init(1) type c,
    container type ref to cl_gui_custom_container,
    editor    type ref to cl_gui_textedit,
    ok_code type syucomm.
    
    
    clear v_init.
    
    call screen '0100'.
    
    
    
    
    
    
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *       PBO Module
    *----------------------------------------------------------------------*
    module status_0100 output.
      set pf-status '0100'.
    *  SET TITLEBAR 'xxx'.
    
    
      if v_init is initial.
        refresh i_text_tab.
    "create a screen 0100 with custom container CONT1
        create object: container exporting container_name = 'CONT1',
                       editor    exporting parent = container    .
        v_init = 'X'.
      endif.
    
      call method editor->set_text_as_stream
        exporting
          text = i_text_tab.
    
      call method editor->set_wordwrap_behavior
       exporting
    *    wordwrap_mode              = -1
         wordwrap_position          = '72'
    *    wordwrap_to_linebreak_mode = BOOL_INITIAL
        exceptions
          error_cntl_call_method     = 1
          others                     = 2
              .
      if sy-subrc <> 0.
      endif.
    
    endmodule.                 " STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_0100  INPUT
    *&---------------------------------------------------------------------*
    *       PAI Module
    *----------------------------------------------------------------------*
    module user_command_0100 input.
      case ok_code.
    
        when 'BACK'.
          clear ok_code.
    *free Containers for Text Editor
          call method container->free.
          free container.
          leave to screen 00.
    
        when 'SAVE'.
          call method editor->get_text_as_stream
            importing
              text = i_text_tab.
    
          break sbhadur.
      endcase.
    endmodule.                 " USER_COMMAND_0100  INPUT
    
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 22, 2008 at 12:31 PM

    Hi,

    You have to use instance of 'cl_gui_textedit' in the container.

    To put the editor in display mode,

    CALL METHOD editor->set_enable

    EXPORTING

    enable = '0'.

    Otherwise,it is in enable mode only.

    To get the text into an internal table and store it,do the following:

    *get text from control

    CALL METHOD editor->get_text_as_stream

    EXPORTING

    only_when_modified = 0

    IMPORTING

    text = it_texttable

    is_modified = w_modified

    EXCEPTIONS

    error_dp = 1

    error_cntl_call_method = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    CLEAR: it_texttable, it_texttable[].

    ENDIF.

    CLEAR: it_textlineslong, it_textlineslong[].

    CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'

    TABLES

    text_stream = it_texttable

    itf_text = it_textlineslong.

    Regards,

    Jeet K Bhatt

    Add comment
    10|10000 characters needed characters exceeded