*&---------------------------------------------------------------------* *& REPORT YBO_NOTE06 *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT YBO_NOTE06. DATA: LS_LIPS TYPE LIPS, LS_VBKOK TYPE VBKOK, LS_HEADER_DATA TYPE BAPIOBDLVHDRCHG, LS_HEADER_CONTROL TYPE BAPIOBDLVHDRCTRLCHG, LV_DELIVERY TYPE BAPIOBDLVHDRCHG-DELIV_NUMB, LS_TECHN_CONTROL TYPE BAPIDLVCONTROL. DATA: LT_VBPOK TYPE TABLE OF VBPOK WITH HEADER LINE, LT_ITEM_DATA TYPE TABLE OF BAPIOBDLVITEMCHG WITH HEADER LINE, LT_ITEM_CONTROL TYPE TABLE OF BAPIOBDLVITEMCTRLCHG WITH HEADER LINE, LT_ITEM_DATA_BATCH TYPE TABLE OF /SPE/DOCUBATCH_DLV_ITEM_STY WITH HEADER LINE, LT_RETURN TYPE TABLE OF BAPIRET2 WITH HEADER LINE, LT_ITEM_DATA_SPL TYPE TABLE OF /SPE/BAPIOBDLVITEMCHG WITH HEADER LINE. LV_DELIVERY = '8000000647' . LS_HEADER_DATA-DELIV_NUMB = LV_DELIVERY. LS_HEADER_CONTROL-DELIV_NUMB = LV_DELIVERY. SELECT SINGLE * INTO LS_LIPS FROM LIPS WHERE VBELN = LV_DELIVERY . CLEAR LT_ITEM_DATA. LT_ITEM_DATA-DELIV_NUMB = LV_DELIVERY. "交货 LT_ITEM_DATA-DELIV_ITEM = '000010' . "交货项目 APPEND LT_ITEM_DATA. * CLEAR LT_ITEM_CONTROL. LT_ITEM_CONTROL-DELIV_NUMB = LV_DELIVERY. "交货 LT_ITEM_CONTROL-DELIV_ITEM = '000010' . "交货项目 LT_ITEM_CONTROL-CHG_DELQTY = 'X'. APPEND LT_ITEM_CONTROL. CLEAR LT_ITEM_DATA_SPL. LT_ITEM_DATA_SPL-DELIV_NUMB = LV_DELIVERY. "交货 LT_ITEM_DATA_SPL-DELIV_ITEM = '000010'. "交货项目 LT_ITEM_DATA_SPL-STGE_LOC = '3010'. APPEND LT_ITEM_DATA_SPL. CLEAR LT_ITEM_DATA. LT_ITEM_DATA-DELIV_NUMB = LV_DELIVERY. "交货 LT_ITEM_DATA-DELIV_ITEM = '900010'. "交货项目 LT_ITEM_DATA-DLV_QTY = '1'. "数量 LT_ITEM_DATA-SALES_UNIT = 'KG'. LT_ITEM_DATA-BATCH = '-1-2'. LT_ITEM_DATA-FACT_UNIT_NOM = LS_LIPS-UMVKZ. LT_ITEM_DATA-FACT_UNIT_DENOM = LS_LIPS-UMVKN. LT_ITEM_DATA-HIERARITEM = '000010'. "项目层次中的高级项目 LT_ITEM_DATA-USEHIERITM = '1'. "使用层次项目(1:批次拆分) APPEND LT_ITEM_DATA. CLEAR LT_ITEM_CONTROL. LT_ITEM_CONTROL-DELIV_NUMB = LV_DELIVERY. "交货 LT_ITEM_CONTROL-DELIV_ITEM = '900010'. "交货项目 LT_ITEM_CONTROL-CHG_DELQTY = 'X'. APPEND LT_ITEM_CONTROL. CLEAR LT_ITEM_DATA_SPL. LT_ITEM_DATA_SPL-DELIV_NUMB = LV_DELIVERY. "交货 LT_ITEM_DATA_SPL-DELIV_ITEM = '900010'. "交货项目 LT_ITEM_DATA_SPL-STGE_LOC = '3010'. APPEND LT_ITEM_DATA_SPL. CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE' EXPORTING HEADER_DATA = LS_HEADER_DATA HEADER_CONTROL = LS_HEADER_CONTROL DELIVERY = LV_DELIVERY TECHN_CONTROL = LS_TECHN_CONTROL TABLES ITEM_DATA = LT_ITEM_DATA ITEM_CONTROL = LT_ITEM_CONTROL RETURN = LT_RETURN ITEM_DATA_SPL = LT_ITEM_DATA_SPL. LOOP AT LT_RETURN . WRITE: /,LT_RETURN-TYPE, LT_RETURN-ID, LT_RETURN-NUMBER, LT_RETURN-MESSAGE . ENDLOOP. COMMIT WORK AND WAIT . LS_VBKOK-VBELN_VL = LV_DELIVERY . CLEAR: LT_VBPOK. LT_VBPOK-VBELN_VL = LV_DELIVERY. LT_VBPOK-POSNR_VL = '900010'. LT_VBPOK-VBELN = LV_DELIVERY. LT_VBPOK-POSNN = '900010'. LT_VBPOK-PIKMG = '1'. "数量 LT_VBPOK-MEINS = 'M'. *LT_VBPOK-CHARG = '-1-2'. "批次 *LT_VBPOK-MATNR = XLIPS-MATNR. "物料 APPEND LT_VBPOK. CALL FUNCTION 'SD_DELIVERY_UPDATE_PICKING' EXPORTING VBKOK_WA = LS_VBKOK SYNCHRON = 'X' * NO_MESSAGES_UPDATE = ' ' * NICHT_SPERREN = ' ' * AUFRUFER_T = ' ' * IF_ERROR_MESSAGES_SEND = 'X' TABLES VBPOK_TAB = LT_VBPOK * PROT = . COMMIT WORK AND WAIT .
标签:CONTROL,ITEM,分批,DELIV,DELIVERY,修改,LT,交货单,DATA From: https://www.cnblogs.com/icebo/p/18196594