FORM bdc_transaction USING tcode ctumode.
DATA: _ret TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
REFRESH messtab.
CALL TRANSACTION tcode USING bdcdata
MODE ctumode"A:调试 N:不显示 E:错误时调试
UPDATE 'A'"A:异步 B:同步 L:本地更新
MESSAGES INTO messtab.
LOOP AT messtab.
IF messtab-msgtyp = 'S' AND ( messtab-msgv1 = '内向交货'
OR messtab-msgv1 = '已保存' ).
gs_do_header-vbeln = messtab-msgv2.
EXIT.
ENDIF.
ENDLOOP.
CALL FUNCTION 'CONVERT_BDCMSGCOLL_TO_BAPIRET2'
TABLES
imt_bdcmsgcoll = messtab
ext_return = _ret.
* PERFORM deal_bapi_ret TABLES _ret USING 1 CHANGING g_err_flag.
REFRESH bdcdata.
ENDFORM.