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: 

Long text editor

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

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

0 Kudos

I am talking about long text.. not the spilt screen.

0 Kudos

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.

Former Member
0 Kudos

Refer this link -

Please have a look at my answer.

Regards,

Aparna Gaikwad

former_member212653
Active Contributor

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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