WMS函数组:18.WMS创建交货单LIPS
FUNCTION ZRFC_WMS_LIPS_CREATE .
*"----------------------------------------------------------------------
*"*"Local interface:
*" TABLES
*" ET_LOG STRUCTURE BAPIRET2
*"----------------------------------------------------------------------
DATA:
EP_EBELN LIKE EKKO-EBELN,
EP_FRGKX TYPE FRGKX,
* EX_VLELN LIKE EKKO-EBELN,
IP_VBELN LIKE LIPS-VBELN,
EP_SUBRC0 TYPE SY-SUBRC.
DATA:
******** VL10B
EX_VBELN LIKE LIPS-VBELN,
IP_INPUT LIKE ZWMS_VL10B_INPUT OCCURS 0 WITH HEADER LINE,
ET_LOG_1 LIKE BAPIRET2 occurs 0 with header line,
IT_EBELN LIKE ZWMS_CONVERT OCCURS 0 WITH HEADER LINE.
SELECT * FROM ZWMS_CONVERT AS C INTO TABLE IT_EBELN WHERE C~VBELN = '' and C~ISOK <> 'X'.
****2.将采购订单转为交货单
*------------CHA JWY_20170811
SORT IT_EBELN.
*------------CHA JWY_20170811
LOOP AT IT_EBELN.
* IP_INPUT-ST_RESWK_LOW = '8100'. "调整到8100
IP_INPUT-ST_EBELN_LOW = IT_EBELN-EBELN.
APPEND IP_INPUT.
CLEAR: EX_VBELN.
CALL FUNCTION 'ZRFC_WMS_VL10B'
IMPORTING
EP_SUBRC = EP_SUBRC0
EX_VBELN = EX_VBELN
TABLES
IP_INPUT = IP_INPUT
ET_LOG = ET_LOG_1.
WAIT UP TO 10 SECONDS.
UPDATE ZWMS_CONVERT SET VBELN = EX_VBELN
VBELN_DAT = SY-DATUM
FLAG = EP_SUBRC0
WHERE BILLNO = IT_EBELN-BILLNO .
ENDLOOP.
* WAIT UP TO 3 SECONDS.
*
*******3.对交货单进行过帐
* CLEAR:
* IT_EBELN[].
*
*
* SELECT * FROM ZWMS_CONVERT AS C INTO TABLE IT_EBELN WHERE C~FLAG <> '0' AND VBELN <> ''.
*
* DATA : SV(10).
*
*
* LOOP AT IT_EBELN.
*
* SV = IT_EBELN-VBELN.
* PERFORM F_ADD_ZERO USING SV.
* EP_SUBRC0 = -1.
*
* CALL FUNCTION 'ZRFC_WMS_CONVER2'
* EXPORTING
* IP_CHARG = IT_EBELN-CHARG
* IPX_VBELN = sv
* IMPORTING
* EP_SUBRC = EP_SUBRC0
* TABLES
* ET_LOG = ET_LOG_1.
* WAIT UP TO 1 SECONDS.
* APPEND LINES OF ET_LOG_1 TO ET_LOG.
* CLEAR ET_LOG_1[].
* IF EP_SUBRC0 = 0 .
* UPDATE ZWMS_CONVERT SET FLAG = EP_SUBRC0
* WHERE BILLNO = IT_EBELN-BILLNO .
* ELSE.
* UPDATE ZWMS_CONVERT SET FLAG = ET_LOG_1-MESSAGE
* WHERE BILLNO = IT_EBELN-BILLNO .
* ENDIF.
*
* ENDLOOP.
ENDFUNCTION.