SAP 参照sto订单创建外向交货BAPI

 
DATA: SHIP_POINT        TYPE TVST-VSTEL,            "装运点/接收点
      NUM_DELIVERIES    TYPE VBNUM,
      STOCK_TRANS_ITEMS LIKE BAPIDLVREFTOSTO OCCURS 0 WITH HEADER LINE,
      DELIVERIES        TYPE STANDARD TABLE OF BAPISHPDELIVNUMB,
      EXTENSION_OUT     TYPE STANDARD TABLE OF BAPIPAREX,
      CREATED_ITEMS     LIKE BAPIDLVITEMCREATED OCCURS 0 WITH HEADER LINE ,
      SERIAL_NUMBERS    LIKE BAPIDLVSERIALNUMBER OCCURS 0 WITH HEADER LINE ,
      RETURN            TYPE STANDARD TABLE OF BAPIRET2,
      LF_VBELN          TYPE VBELN_VL.

SHIP_POINT = '1000'.                                "装运点

STOCK_TRANS_ITEMS-REF_DOC    = '4500048888'.        "参考凭证
STOCK_TRANS_ITEMS-REF_ITEM   = '000010'.
STOCK_TRANS_ITEMS-DLV_QTY    = 10.
STOCK_TRANS_ITEMS-SALES_UNIT = 'PCS'.
STOCK_TRANS_ITEMS-SALES_UNIT_ISO = 'PCS'.

APPEND STOCK_TRANS_ITEMS.


CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_STO'
  EXPORTING
    SHIP_POINT         = SHIP_POINT
*   DUE_DATE                =
*   DEBUG_FLG               =
*   NO_DEQUEUE              = ' '
  IMPORTING
    DELIVERY                = LF_VBELN
    NUM_DELIVERIES          = NUM_DELIVERIES
  TABLES
    STOCK_TRANS_ITEMS       = STOCK_TRANS_ITEMS
    SERIAL_NUMBERS          = SERIAL_NUMBERS
    DELIVERIES              = DELIVERIES
    CREATED_ITEMS           = CREATED_ITEMS
    EXTENSION_OUT           = EXTENSION_OUT
    RETURN                  = RETURN.
          .

IF NOT LF_VBELN IS INITIAL.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT = 'X'.
ENDIF.

 

 

posted @ 2017-05-11 13:32  明大叔  阅读(1576)  评论(0编辑  收藏  举报