标签:处理 lang splay roc port exce message stand 控制
Note: BAPI_DELIVERYPROCESSING_EXEC 未发布
FORM CREATE_INBOUND_DELIVIRY.
DATA: _RET TYPE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE,
_CREATED_ITMES TYPE STANDARD TABLE OF BAPIDELICIOUSCREATEDITEMS WITH HEADER LINE,
_REQUEST TYPE STANDARD TABLE OF BAPIDELICIOUSREQUEST WITH HEADER LINE.
LOOP AT GT_DO_ITEMS ASSIGNING FIELD-SYMBOL(<lfs_do>).
CLEAR: _REQUEST.
_REQUEST-ID = sy-tabix.
_REQUEST-DOCUMENT_NUMB = <lfs_do>-VGBEL."我这儿参考的单据为内部采购订单
_REQUEST-DOCUMENT_ITEM = <lfs_do>-VGPOS."参考行项目确认控制为0001
_REQUEST-DOCUMENT_TYPE = ‘B‘. "B: 处理采购订单 See domain : LESHP_DOCUMENT_TYPE
_REQUEST-PLANT = <lfs_do>-WERKS.
_REQUEST-STGE_LOC = <lfs_do>-LGORT.
_REQUEST-QUANTITY_BASE__UOM = <lfs_do>-LFIMG.
_REQUEST-DELIVERY_DATE = SY-DATUM.
_REQUEST-DELIVERY_TIME = ‘‘.
APPEND _REQUEST.
ENDLOOP.
CALL FUNCTION ‘BAPI_DELIVERYPROCESSING_EXEC‘
TABLES
REQUEST = _REQUEST
CREATEDITEMS = _CREATED_ITMES
RETURN = _RET.
PERFORM DEAL_BAPI_RET TABLES _RET CHANGING G_ERR_FLAG.
DATA(LV_VBELN) = VALUE #( _CREATED_ITEM[ 1 ] OPTIONAL ).
IF G_ERR_FLAG = ABAP_TRUE OR LV_VBELN IS INITIAL.
RETURN.
ENDIF.
MESSAGE S001(00) WITH |内向交货单{ LV_VBELN }创建成功.|.
ENDFORM.
FORM DEAL_BAPI_RET TABLES RET_ERRMSG USING STEP CHANGING ERR_FLAG.
FIELD-SYMBOLS: <FS_RET> TYPE BAPIRET2.
DATA: ERRMSG TYPE SMESG.
CLEAR ERR_FLAG.
REFRESH GT_SMESG.
DATA(LV_ZEILE) = LINES( GT_SMESG_ALL[] ).
LOOP AT RET_ERRMSG ASSIGNING <FS_RET>.
IF ERR_FLAG = ABAP_FALSE AND ( <FS_RET>-TYPE = ‘E‘
OR <FS_RET>-TYPE = ‘A‘ OR <FS_RET>-TYPE = ‘X‘ ).
ERR_FLAG = ABAP_TRUE. "失败
ENDIF.
CLEAR ERRMSG.
ERRMSG-ZEILE = LV_ZEILE + SY-TABIX.
ERRMSG-MSGTY = <FS_RET>-TYPE.
ERRMSG-ARBGB = <FS_RET>-ID.
ERRMSG-TXTNR = <FS_RET>-NUMBER.
ERRMSG-MSGV1 = <FS_RET>-MESSAGE_V1.
ERRMSG-MSGV2 = <FS_RET>-MESSAGE_V2.
ERRMSG-MSGV3 = <FS_RET>-MESSAGE_V3.
ERRMSG-MSGV4 = <FS_RET>-MESSAGE_V4.
APPEND ERRMSG TO GT_SMESG.
ENDLOOP.
APPEND LINES OF GT_SMESG TO GT_SMESG_ALL.
IF ERR_FLAG = ABAP_TRUE.
CALL FUNCTION ‘BAPI_TRANSACTION_ROLLBACK‘.
CALL FUNCTION ‘FB_MESSAGES_DISPLAY_POPUP‘
EXPORTING
IT_SMESG = GT_SMESG[]
EXCEPTIONS
NO_MESSAGES = 1
POPUP_CANCELLED = 2
OTHERS = 3.
RETURN.
ENDIF.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT‘
EXPORTING
WAIT = ‘X‘.
ENDFORM.
BAPI_DELIVERYPROCESSING_EXEC - 创建内向交货单
标签:处理 lang splay roc port exce message stand 控制
原文地址:https://www.cnblogs.com/imimjx/p/13163739.html