TEXT_EDITOR应用

本文详细介绍了如何在自定义对话框中整合文本编辑器,以方便操作长文本。通过展示具体的源码摘录,文章指导开发者实现这一功能。

很多时候我们需要在自己做的dialog上放置一个文本编辑器,用于操作长文本  ,通常做法是做一个text_editor 

暂时上传不了图片

源码摘录:

module frm_1018_text_edit output.
  data: texttable type table of textline .
  create object editor_container
    exporting
      container_name              = 'TC_TEXT'
    exceptions
      cntl_error                  = 1
      cntl_system_error           = 2
      create_error                = 3
      lifetime_error              = 4
      lifetime_dynpro_dynpro_link = 5.

  create object text_editor
    exporting
      parent                     = editor_container
      wordwrap_mode              = cl_gui_textedit=>wordwrap_at_fixed_position
      wordwrap_position          = line_length
      wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
  clear g_name.
  g_name = wa_vbak-vbeln.


  call function 'READ_TEXT'
    exporting
    client                        = sy-mandt
      id                            = 'Z006'
      language                      = sy-langu
      name                          = g_name
      object                        = 'VBBK'
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
* IMPORTING
*   HEADER                        =
    tables
      lines                         = tline[]
 exceptions
   id                            = 1
   language                      = 2
   name                          = 3
   not_found                     = 4
   object                        = 5
   reference_check               = 6
   wrong_access_to_archive       = 7
   others                        = 8
            .
  if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

  call function 'CONVERT_ITF_TO_STREAM_TEXT'
    exporting
      language    = sy-langu
    tables
      itf_text    = tline[]
      text_stream = texttable.

  call method text_editor->set_text_as_stream
    exporting
      text            = texttable
    exceptions
      error_dp        = 1
      error_dp_create = 2
      others          = 3.

  call method text_editor->set_readonly_mode
    exporting
      readonly_mode = '1'.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值