• 传入采购订单项目建交货单


    *"----------------------------------------------------------------------
    *"*"本地接口:
    *"  EXPORTING
    *"     REFERENCE(O_RETURN) TYPE  ZMMS0021
    *"  TABLES
    *"      IT_ITEM STRUCTURE  ZMMS0106
    *"----------------------------------------------------------------------
      DATA:lt_stock_items TYPE TABLE OF bapidlvreftosto.
      DATA:ls_stock_items TYPE bapidlvreftosto.
      DATA:lt_created_items TYPE TABLE OF bapidlvitemcreated.
      DATA:ls_created_items TYPE bapidlvitemcreated.
      DATA:lv_delivery TYPE bapishpdelivnumb-deliv_numb.
      DATA:lv_vstel TYPE vstel.
      DATA:lv_ledat TYPE ledat.
      DATA:lt_return TYPE TABLE OF bapiret2.
    
    
      LOOP AT it_item INTO DATA(ls_item).
        ls_stock_items-ref_doc = ls_item-ebeln."参考凭证
        ls_stock_items-ref_item = ls_item-ebelp."参考项
    *    ls_stock_items-dlv_qty = ls_item-menge."数量
        APPEND ls_stock_items TO lt_stock_items.
    
        ls_created_items-ref_doc = ls_item-ebeln."参考凭证
        ls_created_items-ref_item = ls_item-ebelp."参考项
        ls_created_items-material = ls_item-matnr."物料编号
        ls_created_items-material_long = ls_item-matnr."物料编号
    *    ls_created_items-dlv_qty = ls_item-menge."数量
        APPEND ls_created_items TO lt_created_items.
      ENDLOOP.
    
      CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_STO'
        EXPORTING
          ship_point        = lv_vstel
          due_date          = lv_ledat
        IMPORTING
          delivery          = lv_delivery
        TABLES
          stock_trans_items = lt_stock_items
          created_items     = lt_created_items
          return            = lt_return.
    
      FREE MEMORY ID 'ZPOS_LGORT_FLAG'.
    
      DELETE lt_return WHERE type = 'E' AND id = 'BAPI' AND number = '001'.
    
      LOOP AT lt_return INTO DATA(ls_return) WHERE type = 'E'.
        CONCATENATE o_return-message ls_return-message INTO o_return-message SEPARATED BY '/'.
      ENDLOOP.
    
      IF sy-subrc = 0.
    
        "创建失败
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    
        o_return-type = 'E'.
        CONCATENATE '交货单创建失败:' o_return-message INTO o_return-message.
    
      ELSE.
        "创建成功
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = 'X'.
    
        o_return-zdjh = lv_delivery."交货单
        o_return-type = 'S'.
        o_return-message = '交货单创建成功'.
    
      ENDIF.
  • 相关阅读:
    Activity 生命周期
    Java 单列模式(Singleton)
    Android SQLiteOpenHelper(二)
    Android SQLiteOpenHelper(一)
    Android Listview & Adapter
    Android 微信UI 、点击操作
    Android RadioGroup 及资源文件 & selector
    Java中&与&&的区别
    android几种定时器机制及区别(转载整理)
    Java 之 Date 和 Calendar 实例
  • 原文地址:https://www.cnblogs.com/rainysblog/p/11026958.html
Copyright © 2020-2023  润新知