01_如何调用SAP的长文本编辑器

本文介绍了两种调用SAP长文本编辑器的方法。方法一是通过FUNCTION 'TERM_CONTROL_EDIT' 弹出编辑器并使用SAVE_TEXT函数保存内容。方法二是直接利用SAP的TEXT EDITOR控件,提供更丰富的功能和灵活性。每个方法都有详细的步骤示例。
摘要由CSDN通过智能技术生成

如何调用SAP长文本编辑器,把输入的文字存为长文本呢?这个问题根据不同需要,有2个方法。

 

方法1:

 

这个比较简单,当你仅需要使文本编辑器以窗口方式弹出,输入文字blablabla,并保存为长文本时可选择使用此方法。

 

a.调用FUNCTION弹出长文本编辑器

 

Data: Begin of int_text occurs 0,
      Text(100),
      End of int_text.

CALL FUNCTION 'TERM_CONTROL_EDIT'
 EXPORTING
   TITEL                = P_title
   LANGU                = 'E'
  TABLES
    TEXTLINES            = int_text
 EXCEPTIONS
   USER_CANCELLED       = 1
   OTHERS               = 2
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


b.调用SAVE_TEXT函数保存长文本内容

 

data:header LIKE thead.

 

header-tdobject = object.

header-tdname = name.

header-tdid = id.

header-tdspras = sy-langu.

 

CALL FUNCTION 'SAVE_TEXT'

  EXPORTING

     header = header

     insert = 'X'

     savemode_direct = 'X'

     owner_specified = 'X'

  TABLES

     lines = int_text

  EXCEPTIONS

     id = 1

     language = 2

     name = 3

     object = 4

     others = 5.

IF sy-subrc <> 0.

    MESSAGE 'error with long text' TYPE 'E'.

ENDIF.

 

CALL FUNCTION 'COMMIT_TEXT'

  EXPORTING

    object = object

    name = name

    id = id

    language = sy-langu

    savemode_direct = 'X'.

 

 

 方法二:

 

直接调用SAP的TEXT EDITOR控件,可用的功能比较多,灵活性较强,方法如下(转自SAP喔,比较长)。

 

*********************************************************************

Use SE75 to create your own custom text ID for SAVE_TEXT object
  1. Example 1: Creating the TextEdit control
  2. Example 2: Event handling - Application event
  3. Example 3: Event handling - System event
  4. Example 4: Calling a methods of the control
  5. Example 5: Responding to an event
  6. Example 6: Protect a line in the TextEdit control and the importance of FLUSH
  7. Example 7: Using multiple controls
See the whole program code
Example 1: Creating the TextEdit control
This is a simple example of how to implement a text edit control.
Steps
  1. Create a report
  2. In the start of selection event add: SET SCREEN '100'.
  3. Create screen 100
  4. Place a custom control on the screen by choosing the custom control icon which can be recognized by the letter 'C', and give it the nameMYCONTAINER1.
  5. To be able to exit the program, add a pushbutton with the function code EXIT.
  6. In the elements list enter the name OK_CO
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值