1、在通过REPLACE来删除字符串中某些指定的字符串时,比如要删除“ABCDEFGH”中的"DEF"时
我们如果用REPLACE,则语法如下
REPLACE 'DEF' WITH `` INTO 'ABCDEFGH'.
执行出来的结果就是'ABCGH'.
注意这里面WITH 后面用到的是STRING类型的NULL,即··,而不是CHAR类型的‘’,否则执行完之后就会多加一个空格
即‘ABF GH'
2、数据库表更新用TRY.的时候,语法如下
DATA: lcx_error TYPE REF TO cx_root.
DATA: err_text type c length 1000.
try.
xxxxxxxxxxxxxxxxx "更新数据库语句
CATCH cx_sy_open_sql_db INTO lcx_error.
err_text = lcx_error->get_text( ).
endtry.
if err_text is initial.
commit work.
else.
rollback work.
endif.
err_text就是try失败的原因描述
3、弹出对话框选择“是”与“否”
data: str TYPE string.
DATA: re TYPE c.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = ' '
diagnose_object = ' '
text_question = str
text_button_1 = '是'(001)
icon_button_1 = ' '
text_button_2 = '否'(002)
icon_button_2 = ' '
default_button = '1'
display_cancel_button = ' '
userdefined_f1_help = ' '
start_column = 25
start_row = 8
iv_quickinfo_button_1 = ' '
iv_quickinfo_button_2 = ' '
IMPORTING
answer = re
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF re <> 001.
LEAVE PROGRAM.
STOP.
ELSE.
ENDIF.