Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2008 at 11:39 AM

    Refer this link -

    text-editor

    Please have a look at my answer.

    Regards,

    Aparna Gaikwad

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.