SAP MM修改交货单的库存地点LGORT

改STO创建的DN(内向交货单,外向交货单)单项目中的库存地点,就是LIPS-LGORT。

只能是使用DN单的更新BAPI函数,在过账前进行修改一下,

REPORT  ZTEST10.
TABLES: LIPS.
 
PARAMETERS: P_VBELN TYPE LIPS-VBELN.
  
DATA:   LS_STR_HEADER_DATA     LIKE BAPIOBDLVHDRCHG,
        LT_STR_HEADER_CONTROL  LIKE BAPIOBDLVHDRCTRLCHG,
        LS_TECHN_CONTROL        LIKE BAPIDLVCONTROL.
 
DATA:   LT_ITEM_DATA            LIKE TABLE OF BAPIOBDLVITEMCHG,
        LS_ITEM_DATA            LIKE BAPIOBDLVITEMCHG,
        LT_ITEM_CONTROL         LIKE TABLE OF BAPIOBDLVITEMCTRLCHG,
        LS_ITEM_CONTROL         LIKE BAPIOBDLVITEMCTRLCHG,
        LT_ITEM_DATA_SPL        LIKE TABLE OF /SPE/BAPIOBDLVITEMCHG,
        LS_ITEM_DATA_SPL        LIKE  /SPE/BAPIOBDLVITEMCHG,
        LT_RETURN               LIKE TABLE OF BAPIRET2,
        LS_RETURN               LIKE BAPIRET2.
DATA: LT_LIPS LIKE TABLE OF LIPS,
      LS_LIPS LIKE LIPS.
 
SELECT *
  INTO TABLE LT_LIPS
  FROM LIPS
  WHERE VBELN = P_VBELN.
  
LS_STR_HEADER_DATA-DELIV_NUMB         = P_VBELN.
LT_STR_HEADER_CONTROL-DELIV_NUMB         = P_VBELN.
LS_TECHN_CONTROL-UPD_IND = 'U'.
  
LOOP AT LT_LIPS INTO LS_LIPS.
 
  LS_ITEM_DATA-DELIV_NUMB = LS_LIPS-VBELN.
  LS_ITEM_DATA-DELIV_ITEM = LS_LIPS-POSNR.
  LS_ITEM_DATA-MATERIAL = LS_LIPS-MATNR.
  LS_ITEM_DATA-BATCH = LS_LIPS-CHARG.
  LS_ITEM_DATA-DLV_QTY = LS_LIPS-LFIMG.
  LS_ITEM_DATA-DLV_QTY_IMUNIT = LS_LIPS-LFIMG.
  LS_ITEM_DATA-HIERARITEM = LS_LIPS-POSNR.
 
  LS_ITEM_DATA-USEHIERITM = 1.
  LS_ITEM_DATA-FACT_UNIT_NOM = LS_LIPS-UMVKZ.
  LS_ITEM_DATA-FACT_UNIT_DENOM = LS_LIPS-UMVKN.
  LS_ITEM_DATA-BASE_UOM = LS_LIPS-MEINS.
  LS_ITEM_DATA-SALES_UNIT = LS_LIPS-VRKME.
 
  APPEND LS_ITEM_DATA TO LT_ITEM_DATA.
  
    LS_ITEM_CONTROL-DELIV_NUMB = LS_LIPS-VBELN.
    LS_ITEM_CONTROL-DELIV_ITEM = LS_LIPS-POSNR.
    LS_ITEM_CONTROL-CHG_DELQTY = 'X'.
    APPEND LS_ITEM_CONTROL TO LT_ITEM_CONTROL.
 
  LS_ITEM_DATA_SPL-DELIV_NUMB = LS_LIPS-VBELN.
  LS_ITEM_DATA_SPL-DELIV_ITEM = LS_LIPS-POSNR.
  LS_ITEM_DATA_SPL-PICK_DENIAL = 'X'.
  LS_ITEM_DATA_SPL-STGE_LOC =  'C001'.       "库存地点
  APPEND LS_ITEM_DATA_SPL TO LT_ITEM_DATA_SPL.
  
  LS_ITEM_DATA_SPL-DELIV_NUMB = LS_LIPS-VBELN."交货
  LS_ITEM_DATA_SPL-DELIV_ITEM = LS_LIPS-POSNR."原行项目
  LS_ITEM_DATA_SPL-STGE_LOC   = 'C001'.       "库存地点
  APPEND LS_ITEM_DATA_SPL TO LT_ITEM_DATA_SPL.
 
ENDLOOP.

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
  EXPORTING
    HEADER_DATA      = LS_STR_HEADER_DATA
    HEADER_CONTROL   = LT_STR_HEADER_CONTROL
    DELIVERY         = P_VBELN
    TECHN_CONTROL    = LS_TECHN_CONTROL
  TABLES
*    HEADER_DEADLINES = IT_HEADER_DEADLINES
    ITEM_DATA           = LT_ITEM_DATA
    LS_ITEM_CONTROL     = LT_ITEM_CONTROL
    ITEM_DATA_SPL       = LT_ITEM_DATA_SPL
    RETURN              = LT_RETURN.
 
IF SY-SUBRC = 0.
  COMMIT WORK.
ENDIF.
*   IF lt_return[] IS INITIAL.
*      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*        EXPORTING
*          wait = 'X'.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ᝰ随心ꦿེএ

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值