REPORT Z_POSTING_DELIVERY.
DATA: BEGIN OF I_VBKOK OCCURS 11.
INCLUDE STRUCTURE VBKOK.
DATA: END OF I_VBKOK.
DATA: BEGIN OF I_VBPOK_TAB OCCURS 12.
INCLUDE STRUCTURE VBPOK.
DATA: END OF I_VBPOK_TAB.
PARAMETERS: P_VBELN TYPE VBELN.
DATA:G_LIKP LIKE LIKP.
DATA:G_LIPS LIKE LIPS.
DATA GV_14(14) TYPE C.
START-OF-SELECTION.
" ---------创建发票----------------
SELECT SINGLE * INTO G_LIKP FROM LIKP
WHERE VBELN = P_VBELN.
SELECT * INTO G_LIPS FROM LIPS WHERE
VBELN = G_LIKP-VBELN.
"-----VL02N--------
I_VBKOK-VBELN_VL = P_VBELN. "<- Delivery number
I_VBKOK-WABUC = 'X'. " <- Automatic PGI
I_VBKOK-WADAT_IST = G_LIKP-BLDAT.
APPEND I_VBKOK.
I_VBPOK_TAB-VBELN_VL = P_VBELN. "<- Delivery number
I_VBPOK_TAB-POSNR_VL = G_LIPS-POSNR.
I_VBPOK_TAB-VBELN = P_VBELN .
I_VBPOK_TAB-POSNN = G_LIPS-POSNR.
I_VBPOK_TAB-MATNR = G_LIPS-MATNR. "Material Number
* I_VBPOK_TAB-WERKS = '3000'. "LIPS-WERKS.
* I_VBPOK_TAB-LGORT = 'ATPR'. "'FU01'."'ATPR'.
GV_14 = G_LIPS-LFIMG .
CONDENSE GV_14.
I_VBPOK_TAB-PIKMG = GV_14 .
APPEND I_VBPOK_TAB.
ENDSELECT.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
VBKOK_WA = I_VBKOK
COMMIT = 'X'
DELIVERY = P_VBELN
UPDATE_PICKING = 'X'
TABLES
VBPOK_TAB = I_VBPOK_TAB
* PROT = I_PROTT
EXCEPTIONS
ERROR_MESSAGE = 1
OTHERS = 2.
BREAK-POINT.
阅读(6208) | 评论(1) | 转发(0) |