DB02测试
DATA: ls_data TYPE zmms029,
lt_data TYPE TABLE OF zmms029.
DATA: g_obj_sqldb TYPE REF TO cx_sy_native_sql_error,
g_error_text TYPE string.
DATA: gw_dbs TYPE dbcon-con_name VALUE 'DL_Test'.
DATA: lv_date TYPE char20,
lv_date_update TYPE char20.
INCLUDE zfunc_top. "RFC日志管理-定义抬头文件
lv_user3 = sy-datum && sy-uzeit.
INCLUDE zfunc_begin. "RFC日志管理-记录接收数据
CLEAR: lt_data[].
lt_data[] = CORRESPONDING #( it_data[] ) .
lv_date = sy-datum && sy-uzeit.
TRY.
" 连接数据库
EXEC SQL.
CONNECT TO :GW_DBS
ENDEXEC.
CATCH cx_sy_native_sql_error INTO g_obj_sqldb.
CALL METHOD g_obj_sqldb->get_text
RECEIVING
result = g_error_text.
ENDTRY.
IF g_error_text IS INITIAL.
EXEC SQL.
SET CONNECTION 'DL_Test'
ENDEXEC.</