如何调用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喔,比较长)。
*********************************************************************