SAP 调用RFC 的时候记录异常报错方式

时间:2022-09-03 14:49:58
 DATA: lv_error TYPE char100.

 CALL FUNCTION 'ZRFC_WM_ZEL001' DESTINATION lv_desc
EXPORTING
process_flag = lv_zclbs
IMPORTING
return_value = lv_subrc
return_message = lv_message
TABLES
zel_stockchange_head = lt_stockchange_head
zel_stockchange_item = lt_stockchange_item
EXCEPTIONS
system_failure = MESSAGE lv_error
communication_failure = MESSAGE lv_error
OTHERS = . IF sy-subrc = .
e_subrc = lv_subrc.
e_message = lv_message.
ELSE.
e_subrc = sy-subrc.
* e_message = 'RFC连接错误'.
e_message = lv_error.
ENDIF.

lv_error 记录报错消息