问题: 在交货单做过PGI/PGR之后,显示物料凭证已归档,但是实际上并不是人为归档
MIGO去显示物料凭证的时候显示不存在
VL09 无法冲销
如下图所示
原因:1.人为做了归档
2.在做PGI的时候出现了异常。导致出现了问题
解决方法是: 1.首先去VBFA检查凭证流是否存在
2.去MKPF,MSEG 中检查是否不存在
以上条件都满足 按照如下操作修复
1.创建一个修复程序如下
*&---------------------------------------------------------------------*
*& Report ZZRB_VBFA_NO_GI_DOC_5
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZZRB_VBFA_NO_GI_DOC_5 .
* This report deletes document flow entries for GI in delivery where
* no material document exsists on database. Afterwards, you have to run
* the report ZZDELSTA or RVDELSTA to correct the delivery status.
DATA: BEGIN OF XVBFA OCCURS 0.
INCLUDE STRUCTURE VBFAVB.
DATA: END OF XVBFA.
DATA: XVBFA2 LIKE VBFAVB.
DATA: UPDATE(1) TYPE C,
LF_HELP1 LIKE SY-DATUM,
LF_HELP2 LIKE SY-DATUM..
TABLES: MKPF, LIPS, VBFA, VEKP.
PARAMETERS: DELIVERY LIKE LIPS-VBELN OBLIGATORY, "delivery no.
MATDOC LIKE MKPF-MBLNR OBLIGATORY, "material document no.
MATYEAR LIKE MKPF-MJAHR OBLIGATORY DEFAULT SY-DATUM+0(4),
TEST TYPE XFELD DEFAULT 'X'. "Test or Update
CLEAR UPDATE.
LF_HELP1(4) = LF_HELP2(4) = MATYEAR.
LF_HELP1+4 = '0101'.
LF_HELP2+4 = '1231'.
SELECT * INTO CORRESPONDING FIELDS OF TABLE XVBFA FROM VBFA
WHERE VBELN = MATDOC
AND VBTYP_N = 'R'
AND ERDAT >= LF_HELP1
AND ERDAT <= LF_HELP2.
IF NOT SY-SUBRC IS INITIAL.
FORMAT COLOR COL_NEGATIVE.
WRITE:/ 'No document flow items could be found!'.
FORMAT RESET.
ELSE.
SELECT SINGLE * FROM MKPF WHERE MBLNR = MATDOC
AND MJAHR = MATYEAR.
IF SY-SUBRC IS INITIAL.
FORMAT COLOR COL_NEGATIVE.
WRITE:/ 'Material document exsists on database!'.
FORMAT RESET.
ELSE.
LOOP AT XVBFA WHERE STUFE = '00'
AND ERDAT(4) = MATYEAR.
IF NOT XVBFA-VBELV EQ DELIVERY.
WRITE:/ 'Please input correct delivery!'.
EXIT.
ENDIF.
IF NOT TEST IS INITIAL.
FORMAT RESET.
FORMAT COLOR COL_POSITIVE.
WRITE:/ 'Document flow item:',
XVBFA-VBELV,
XVBFA-POSNV,
XVBFA-VBELN,
XVBFA-POSNN,
XVBFA-VBTYP_N,
'would be deleted!'.
FORMAT RESET.
IF UPDATE IS INITIAL.
MOVE 'X' TO UPDATE.
ENDIF.
ELSE. "Update database
DELETE FROM VBFA WHERE VBELV = XVBFA-VBELV
AND POSNV = XVBFA-POSNV
AND VBELN = XVBFA-VBELN
AND POSNN = XVBFA-POSNN
AND VBTYP_N = XVBFA-VBTYP_N.
IF UPDATE IS INITIAL AND SY-SUBRC IS INITIAL.
MOVE 'X' TO UPDATE.
ENDIF.
ENDIF.
ENDLOOP.
IF NOT UPDATE IS INITIAL.
LOOP AT XVBFA WHERE STUFE = '01'
AND ERDAT(4) = MATYEAR.
IF NOT TEST IS INITIAL.
FORMAT COLOR COL_POSITIVE.
WRITE:/ 'Document flow item:',
XVBFA-VBELV,
XVBFA-POSNV,
XVBFA-VBELN,
XVBFA-POSNN,
XVBFA-VBTYP_N,
'would be deleted!'.
FORMAT RESET.
ELSE. "Update database
DELETE FROM VBFA WHERE VBELV = XVBFA-VBELV
AND POSNV = XVBFA-POSNV
AND VBELN = XVBFA-VBELN
AND POSNN = XVBFA-POSNN
AND VBTYP_N = XVBFA-VBTYP_N.
IF UPDATE IS INITIAL AND SY-SUBRC IS INITIAL.
MOVE 'X' TO UPDATE.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
2.SE38执行,去删除VBFA 里面的不存在的凭证流
3.如果交货单有批次拆分,还需要删除服务单
4.执行报表 RVDELSTA 重置交货状态
To prevent the inconsistency from happening, please:
- Check if the note 1776807 is already implemented in your system. If not, please implement it.
- Furthermore create the new form routine USER_EXIT_EARLY_UNLOCK_MM at the end of the include MV50AFZ1 to set the changing parameter CP_EARLY_UNL to X.
为了预防此问题的再次发生,请参考note1776807 .
相关参考note:1855641