Please find the original document at https://launchpad.support.sap.com/#/notes/1856641
Symptom
GI (goods issue) / GR (goods receipt) document shows “Archived” status in document flow, although it
wasn’t actually archived it.
•
Not possible to display the GI / GR document from document flow. Error message M7 062 (Document
does not exist in calendar year ****).
•
After posting GI / GR, material document is not generated. There is no movement posted in MM-IM.
Stock remains unchanged.
•
• After posting GI / GR, stock (IM / WM) is not changed (reduced / increased).
GI / GR document doesn’t exist. It can be neither displayed it in tcode MB03 nor found it in table MKPF
and MSEG.
•
Not possible to cancel “Archived” material document. GI / GR cannot be canceled in tcode VL09
because of error VL 622.
•
Delivery has goods movement status (VBUK-WBSTK, VBUP-WBSTA) ‘C’ (complete). However, the
stock is not moved. Goods movement hasn’t happened.
•
VBFA table contains a GI / GR document (VBFA-VBTYP_n = ‘R’ ), which doesn’t exist in table MKPF
and MSEG.
•
VL09 -> get error Message no. VL 622
“No material document could be found for cancellation”
•
“Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to
real data is purely coincidental.”
Environment
• Sales And Distribution (SD)
• Logistics Execution (LE)
• Materials Management (MM)
• SAP ERP Central Component
• SAP ERP
• SAP enhancement package for SAP ERP
• SAP enhancement package for SAP ERP, version for SAP HANA
Cause
Why is material document displayed as “Archived” in document flow?
If the material document doesn’t exist in MKPF (material document header) table, system will
display it as “Archived”.
○
“Archived” doesn’t really mean that it’s archived. It means that the material document doesn’t
exist.
○
○ This is an inconsistency across LE-SHP (VBFA table) and MM-IM (MKPF table).
Generally, there are two possible reasons why material document is gone.
The material document has actually been archived. This is normal for very old documents. In
case the material document has been archived, the delivery should not be changed any more.
Then, please check with business user about what to do for the next step.
•
• The material document has never been generated. This is an inconsistency.
Why is material document NOT created when posting GI / GR? What’s the root cause of this
inconsistency?
Usually, this problem is caused by customer coding. Please check whether if there is any
userexit in delivery processing and material document posting. If so, please check whether there
is any COMMIT work or ROLLBACK in your coding.
•
Please check whether there was any update termination (tcode SM13) or short dumps (tcode
ST22) when GR was posted.
•
To find out the exact root cause, it’s necessary to have a reproducible example. If this
inconsistency can be reproduced, please create a SAP message.
•
Resolution
• How to check the inconsistency:
Run tcode SE16 to display table VBFA with selection fields:
VBELV = delivery number
VBTYP_n = ‘R’ (upper case)
Run tcode SE16 to display table MKPF with selection fields:
MBLNR = material document number (VBFA-VBELN selected in step 1)
MJAHR = material document year (VBFA-MJAHR selected in step 1)- Run tcode SE16 to display table MSEG with the same selection fields as step 2.
- If nothing can be selected in MKPF and MSEG, this is the inconsistency.
• How to fix the inconsistency: - Create a correction report as in attachment (ZZRB_VBFA_NO_GI_DOC_5).
Run tcode SE38 / SA38. Execute the correction report ZZRB_VBFA_NO_GI_DOC_5 to delete
the non-existing material document from document flow (VBFA table).
Input the parameters as below:
DELIVERY -> delivery number
MATDOC -> material document number (the one to be deleted)
MATYEAR -> material document year (find the value from VBFA-MJAHR)
If there is batch split in the delivery, it is needed to delete the “Confirmation of service” from
VBFA as well. Please execute step3 for the “Confirmation of service”.- Execute report RVDELSTA to reset delivery status.
After step 4 the dummy material document will be removed from document flow. The delivery’s goods
movement status will be reset.
• CAUTION:
Please DONOT use this report, if the material document has really been archived! Please
check with your business team about whether there has been any archiving job for this
material document.
•
Please test all the reports in quality/development system first before executing it in
production system.
•
This correction report is just a workaround for inconsistency correction. It’s just for your
reference.
•
• Please contact SAP support if there is any questions about the inconsistency.
See Also
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
- Execute report RVDELSTA to reset delivery status.
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 '2022',
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.
No responses yet