Skip to end of metadata
Go to start of metadata

Long texts are individual text objects. They consist of several, usually complete sentences that belong together. They can contain links to glossary entries, transactions, and other long text objects.  They determine the layout of the text when it is output. Unlike the short text editor, the long text editor does not have a proposal pool.

These Long texts are entered by using an text editor which can be opened dirctly by transaction se63 as well as at runtime by using abap code,which is given below.

Step 1:First create text object zchd_obj with text id s.(For help you can refer wiki https://www.sdn.sap.com/irj/scn/wiki?path=/display/ABAP/An+Introduction+of+Text+Objects)

Step 2: Now call below function module on click of text editor image button for opening a text editor.

Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
*&---------------------------------------------------------------------*
*&      Form  sub_call_text_editor
*&---------------------------------------------------------------------*
FORM sub_call_text_editor USING ucomm.
  DATA: loc_display(1) TYPE c,
    loc_editor_title LIKE ttxit-tdtext,
    loc_header LIKE thead,
    loc_page LIKE itcth-tdpage,
    loc_window LIKE itcth-tdwindow,
    loc_save(1) TYPE c,
    loc_line_editor(1) TYPE c,
    loc_control LIKE itced,
    loc_program LIKE sy-repid,
    loc_local_cat(1) TYPE c,
    loc_function(1) TYPE c,
    loc_newheader LIKE thead,
    loc_result LIKE itcer,
    loc_lines LIKE TABLE OF tline WITH HEADER LINE,
    loc_first LIKE tline.
  DATA : qctxt_lines LIKE tline OCCURS 0 WITH HEADER LINE,
         txt_funct(1) TYPE c,          " Funktion aus Textver
         loc_inlines LIKE tline OCCURS 0 WITH HEADER LINE,
         loc_tdid LIKE thead-tdid,
         loc_mode TYPE c.

  DATA: tdid_1 LIKE thead-tdid VALUE 'Y0B1', " DEV Comments
        tdid_2 LIKE thead-tdid VALUE 'Y0B2', " UAT Comments.
        tdid_3 LIKE thead-tdid VALUE 'Y0B3'. " UT Comments

  DATA:  g_txt_1 LIKE TABLE OF tline WITH HEADER LINE. "Dev Comments
  DATA:  g_saved_txt_1 LIKE TABLE OF tline WITH HEADER LINE.

  TABLES : thead.

  " Display or edit - it depends on the screen status,
  " some long text fields can be edited or only displayed.
  " Call the long text editor accordingly.

  " Editor title
  CASE ucomm.
    WHEN 'DEVCMNT'.
      loc_editor_title = text-t01.
      loc_tdid = tdid_1.                                   "y0b1
  ENDCASE.

  " Do not save text - only get back the changes.
  " The long text will be saved when the user saves
  " the batch changes.
  CLEAR loc_save.
  loc_header-tdobject = 'ZCHD_UPG'.
  CONCATENATE y0bs_upg_tracker-objid y0bs_upg_tracker-source y0bs_upg_tracker-object_name INTO loc_header-tdname.
  loc_header-tdid = 'Y0B1'.
  loc_header-tdspras = sy-langu.
  loc_header-tdlinesize = 72.
*  IF G_MODE EQ 'D' OR
*     LOC_DISPLAY EQ 'X'.
*    LOC_MODE = 'X'.
*  ENDIF.

  CALL FUNCTION 'READ_TEXT'
      EXPORTING
        client                        = sy-mandt
        id                            = 'Y0B1'
        language                      = 'E'
        name                          = loc_header-tdname
        object                        = 'ZCHD_OBJ'
      TABLES
        lines                         = g_txt_1[]
      EXCEPTIONS
        ID                            = 1
        LANGUAGE                      = 2
        NAME                          = 3
        NOT_FOUND                     = 4
        OBJECT                        = 5
        REFERENCE_CHECK               = 6
        WRONG_ACCESS_TO_ARCHIVE       = 7
        OTHERS                        = 8
              .

  " Provide existing text
  CASE ucomm.
    WHEN 'DEVCMNT'.
      loc_lines[] = g_txt_1[].
      loc_inlines[] = g_txt_1[].
  ENDCASE.

  CALL FUNCTION 'INIT_TEXT'
    EXPORTING
      id       = loc_tdid
      language = loc_header-tdspras
      name     = loc_header-tdname
      object   = loc_header-tdobject
    IMPORTING
      header   = thead
    TABLES
      lines    = qctxt_lines
    EXCEPTIONS
      OTHERS   = 99.

  CALL FUNCTION 'EDIT_TEXT_INLINE'
    EXPORTING
      display      = loc_mode
      editor_title = loc_editor_title
      header       = thead
      inline_count = 1
      textscreen   = 'X '
    IMPORTING
      function     = txt_funct
    TABLES
      inlines      = loc_inlines
      lines        = loc_lines
    EXCEPTIONS
      id           = 1
      language     = 2
      linesize     = 3
      name         = 4
      object       = 5
      OTHERS       = 6.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
  ENDIF.

*  " Cancelled
*  IF LOC_RESULT-USEREXIT = 'C'.
*    EXIT.
*  ENDIF.
*
*  " Write back the text
  CASE ucomm.
    WHEN 'TXBA'.
      g_saved_txt_1[] = g_txt_1[].
      g_txt_1[] = loc_lines[].

      PERFORM sub_corr_first_line TABLES g_txt_1
                                         g_saved_txt_1.
*     move first line to screen field
      dev_comments = loc_inlines-tdline.

*     if none of the lines contain any text
*     then remove all of them
      LOOP AT loc_lines WHERE tdline <> space.
        EXIT.
      ENDLOOP.
      IF sy-subrc <> 0.         "no text found
        CLEAR dev_comments.
        REFRESH g_txt_1.
      ENDIF.
  ENDCASE.

ENDFORM.                    " sub_call_text_editor
*&---------------------------------------------------------------------*
*&      Form  sub_corr_first_line
*&---------------------------------------------------------------------*
FORM sub_corr_first_line TABLES   t STRUCTURE tline
                                  ts STRUCTURE tline.
  CHECK NOT t[] IS INITIAL.
  READ TABLE t INDEX 1.
  IF t-tdformat IS INITIAL.
    IF NOT ts[] IS INITIAL.
      READ TABLE ts INDEX 1.
      t-tdformat = ts-tdformat.
    ELSE.
      t-tdformat = '* '.
    ENDIF.
    MODIFY t INDEX 1.
  ENDIF.
ENDFORM.                    " sub_corr_first_line