ABAP-使用BDC的删除订单函数(接上一篇)
作者:互联网
FUNCTION zbdc_f02_002.
*"----------------------------------------------------------------------
*"*"本地接口:
*" IMPORTING
*" VALUE(VBELN_IN) TYPE VBELN_VA
*" EXPORTING
*" REFERENCE(STATUS) TYPE CHAR1
*" REFERENCE(MSG) TYPE CHAR50
*" TABLES
*" I_MESSTAB STRUCTURE BDCMSGCOLL
*"----------------------------------------------------------------------
*&---BDC录屏返回消息
* DATA i_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
DATA: lv_mode TYPE char1 VALUE 'N'.
PERFORM bdc_dynpro USING 'SAPMV45A' '0102'.
PERFORM bdc_field USING 'BDC_CURSOR'
'VBAK-VBELN'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENT2'.
PERFORM bdc_field USING 'VBAK-VBELN'
vbeln_in.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/ELOES'.
PERFORM bdc_transaction TABLES i_messtab
USING 'VA02'
'X'
lv_mode
'L'."UPDATE.
*&---错误消息处理
DATA:e_mess(50).
CLEAR:e_mess.
LOOP AT i_messtab .
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = i_messtab-msgid
msgnr = i_messtab-msgnr
msgv1 = i_messtab-msgv1
msgv2 = i_messtab-msgv2
msgv3 = i_messtab-msgv3
msgv4 = i_messtab-msgv4
IMPORTING
message_text_output = e_mess.
"MESSAGE e_mess TYPE 'S'.
ENDLOOP.
*关闭BDC
PERFORM close_group USING 'X'.
WAIT UP TO 1 SECONDS.
SELECT SINGLE * INTO @DATA(ls_vbak) FROM vbak WHERE vbeln = @vbeln_in .
IF ls_vbak IS INITIAL.
"vbeln_out = lv_vbeln.
status = 'S'.
msg = '删除成功!'.
ELSE.
"vbeln_out = lv_vbeln.
status = 'E'.
msg = e_mess.
ENDIF.
ENDFUNCTION.
INCLUDE zbdc_include.
标签:vbeln,bdc,BDC,接上,PERFORM,ABAP,messtab,USING 来源: https://www.cnblogs.com/eagle-dtq/p/15637618.html