关于文本(Read_text,Save_text)

来源:互联网 发布:淘宝外贸原单店铺 编辑:程序博客网 时间:2024/05/17 05:44
2006年11月21日 17:11:00

1 相关tCode -列出相关文本对象

2 相关函数
read_text

save_text

create_text
data: it_tlines like tline occurs 0 with header line,
call function 'CREATE_TEXT'
exporting
fid = 'Z01'
flanguage = '1'
fname = l_name
fobject = 'ZHTBZ'
save_direct = 'X'
tables
flines = it_tlines
exceptions
no_init = 1
no_save = 2.

DELETE_TEXT

3 相关表
STXH :STXD SAPscript 文本文件抬头

stxl:STXD SAPscript 文本文件行

4、编辑长文本一般步骤
a)使用c_textedit_control类,如: g_editor105 type ref to c_textedit_control。
b)创建控件
if g_editor105 is initial.
create object g_editor105
exporting
repid = l_repid
dynnr = l_dynnr
dynpro_container = con_textedit_container105
exceptions
others = 1.
if sy-subrc ne 0.
message s888 with 'EDITOR_CREATE' sy-subrc.
endif.
endif.
if l_dynnr >< g_link_dynnr105.
call method g_editor105- exporting
repid = l_repid
dynnr = l_dynnr
dynpro_container = con_textedit_container105.
g_link_dynnr105 = l_dynnr.
endif.
c)设置控件属性
"设置读写性
if g_state = 2 or g_state = 4.
call method g_editor105- exporting
readonly_mode = c_textedit_control= else.
call method g_editor105- exporting
readonly_mode = c_textedit_control= endif.

call method g_editor105- exporting
wordwrap_mode = c_textedit_control= wordwrap_position = l_textedit_wrappos
wordwrap_to_linebreak_mode = c_textedit_control= exceptions
others = 1.

call method g_editor105-c)读取文本内容并设置控件文本
call function 'READ_TEXT'
exporting
id = 'Z01'
language = '1'
name = l_name
object = 'ZHTBZ'
importing
header = gs_textedit_header105
tables
lines = it_tlines
exceptions
not_found = 01.

if it_tlines[] is not initial.
loop at it_tlines.
append it_tlines-tdline to gt_textedit_lines105.
endloop.
endif.

call method g_editor105- exporting
table = gt_textedit_lines105.
d)读取控件的文本并保存文本
if g_editor105 is not initial.
call method g_editor105- exporting
only_when_modified = c_textedit_control= importing
table = gt_textedit_lines105
is_modified = l_text_modified_status
exceptions
others = 1.

"设置文本修改状态
if l_text_modified_status eq c_textedit_control= g_moditext105 = 'X'.
endif.
endif.

* call method g_editor105-* importing
* handle = g_editor105handle.

* call function 'CONTROL_SET_PROPERTY'
* exporting
* h_control = g_editor105handle
* property = 'TextModified'
* value = c_textedit_control=* exceptions
* cntl_error = 1.
"创建新的长文本
it_tlines-tdformat = '* '.
loop at gt_textedit_lines105 into it_tlines-tdline.
append it_tlines.
endloop.

call function 'CREATE_TEXT'
exporting
fid = 'Z01'
flanguage = '1'
fname = l_name
fobject = 'ZHTBZ'
save_direct = 'X'
tables
flines = it_tlines
exceptions
no_init = 1
no_save = 2.



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1401954


原创粉丝点击