FUNCTION ZRFC_WMS_LIPS_CONFIM.
*"----------------------------------------------------------------------
*"*"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.
******3.对交货单进行过帐
CLEAR:
IT_EBELN[].
**查找未生成的单据
SELECT * FROM ZWMS_CONVERT AS C INTO TABLE IT_EBELN WHERE ISOK <> 'X' AND FLAG <> '' AND VBELN = ' '.
*---------------CHA JWY_20170811
SORT IT_EBELN.
*---------------CHA JWY_20170811
LOOP AT IT_EBELN.
SELECT SINGLE BELNR INTO IT_EBELN-VBELN FROM EKBE WHERE BEWTP = 'L' AND EBELN = IT_EBELN-EBELN.
UPDATE ZWMS_CONVERT SET VBELN = IT_EBELN-VBELN
WHERE BILLNO = IT_EBELN-BILLNO .
ENDLOOP.
CLEAR:
IT_EBELN[].
SELECT * FROM ZWMS_CONVERT AS C INTO TABLE IT_EBELN WHERE ISOK <> 'X' AND VBELN <> ''.
DATA: t_XCHPF LIKE MARA-XCHPF.
DATA : SV(10),
t_vbeln like likp-vbeln,
t_charg like lips-charg,
t_lgort like lips-lgort,
t_LFIMG like LIPSD-G_LFIMG .
*---------------CHA JWY_20170811
SORT IT_EBELN.
*---------------CHA JWY_20170811
LOOP AT IT_EBELN.
clear: sv,t_vbeln,t_charg,t_lgort,t_LFIMG.
SV = IT_EBELN-VBELN.
perform f_add_zero using IT_EBELN-MATERIAL .
SELECT SINGLE XCHPF INTO t_XCHPF FROM MARA WHERE MATNR = IT_EBELN-MATERIAL .
IF t_XCHPF = 'X'.
t_CHARG = IT_EBELN-CHARG.
ELSE.
t_CHARG = ' '.
ENDIF.
t_VBELN = IT_EBELN-VBELN.
t_LGORT = IT_EBELN-LGPBE2.
t_LFIMG = IT_EBELN-Quantity.
PERFORM F_ADD_ZERO USING SV.
EP_SUBRC0 = -1.
*******查看是否已经过帐完成
DATA: P_WBSTK LIKE VBUK-WBSTK.
SELECT SINGLE WBSTK INTO P_WBSTK FROM VBUK WHERE VBELN = SV .
IF P_WBSTK = 'C'.
ET_LOG-TYPE = 'W'.
ET_LOG-ID = IP_VBELN.
ET_LOG-MESSAGE = 'Goods Post Can''t Do Many Times!'.
APPEND ET_LOG.
ELSE.
CALL FUNCTION 'ZRFC_WMS_VL02N'
EXPORTING
IP_CHARG = t_CHARG
IP_VBELN = t_VBELN
IP_LGORT = t_LGORT
IP_LFIMG = t_LFIMG
IMPORTING
EP_SUBRC = EP_SUBRC0
TABLES
ET_LOG = ET_LOG_1.
APPEND LINES OF ET_LOG_1 TO ET_LOG.
CLEAR ET_LOG_1[].
******更新信息
UPDATE ZWMS_CONVERT SET FLAG = ET_LOG_1-MESSAGE
WHERE BILLNO = IT_EBELN-BILLNO .
ENDIF.
*******查看是否已经过帐完成
SELECT SINGLE WBSTK INTO P_WBSTK FROM VBUK WHERE VBELN = SV .
IF P_WBSTK = 'C'.
UPDATE ZWMS_CONVERT SET ISOK = 'X'
WHERE BILLNO = IT_EBELN-BILLNO .
ENDIF.
DATA: it_convert like ZWMS_CONVERT.
clear it_convert.
select single * into it_convert from ZWMS_CONVERT WHERE BILLNO = IT_EBELN-BILLNO .
insert into ZWMS_CONVERT_log values it_convert.
ENDLOOP.
ENDFUNCTION.
***** 检查单据是否已经完成-START
* CLEAR IP_WBSTK.
* SELECT SINGLE WBSTK INTO IP_WBSTK FROM VBUK WHERE VBELN = IP_VBELN.
*
* IF IP_WBSTK = 'C'.
* ET_LOG-TYPE = 'W'.
* ET_LOG-ID = IP_VBELN.
* ET_LOG-MESSAGE = 'Goods Post Can''t Do Many Times!'.
* APPEND ET_LOG.
* ITAB_RETURN-SUBRC = 0.
* ITAB_RETURN-MSG = ET_LOG-MESSAGE.
* APPEND ITAB_RETURN.
* CONTINUE.
* ENDIF.
***** 检查单据是否已经完成-END