Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
PollyGan
Advisor
Advisor

As we all know if we post material document which is relevant to valuation, an FI document will be created subsequently.
A typical MM/FI inconsistency would be the material document is generally while the FI document is however missing.
If ML(material ledger) is activated system will issue error C+048 and no more goods movement is possible for the material.
In the worst situation, period closing activity will be affected and even causing auditing issue.
(This is the same content moved from Chinese forum as per quest from peers)

Here will give a detailed explanation, possible reason and the way to prevent it:

  •   The important user-exit and BAdI

    • material document missing FI document
    • FI document missing material document
    • check mechanism to prevent it
  •    Relevant SAP notes

The important user-exit and BAdI

During goods movement, there're many requirements to implement customer specific checking logic, so BAdI

MB_DOCUMENT_BADI and User-exit  EXIT_SAPLMBMB_001(include ZXMBCU01 / enhancement component MB_CF001)

are the ones to be often used. If there're inappropriate command(from note 92550) below implemented in the BAdI or user exit,

MM missing FI could happen:



  • COMMIT WORK

  • FROM MEMORY

  • Remote Function Call (CALL FUNCTION .. DESTINATION)

  • Own updates on the document or stock tables (for example, an update on the table MBEW, MARD, MSEG)

  • Unlocking data (for example, by DEQUEUE_ALL)

  • ROLLBACK WORK

  • MESSAGE TYPE 'A'

  • Calling a dialog box (POPUP_TO_CONFIRM, for example)





  • material document missing FI document

        Here I'd like to introduce the concept of SAP LUW. LUW is "Unit Logical Unit of Work" and usually there're
        Database LUWs and SAP LUWs. SAP LUW is used to keep consistency of application programs that are executed

        across different work processes, and the updates are first registered and then executed by a single work process.

        One of the techniques is known as update task(via update function modules: CALL FUNCTION...IN UPDATE TASK).

        BAdI MB_DOCUMENT_BADI is called after the update function module MB_UPDATE_TASK, so if there is COMMIT WORK

        in MB_DOCUMENT_BADI method MB_DOCUMENT_BEFORE_UPDATE, SAP LUW will be destroyed.

   Considering sequence below:



  • Material document:


          Call function 'A' in update task.


          Call function 'B' in update task.


      
          BAdI  MB_DOCUMENT_BADI (method MB_DOCUMENT_BEFORE_UPDATE)
          COMMIT WORK -> update of material document is triggered and database MKPF/MSEG will be updated.


      



  • FI document:


          Call function 'C' in update task.


          Call function 'D' in update task.
         ->If there's any error happens at this stage, system can only rollback C and D while material document
            cannot be rolled back any more as it has been already written into database.





You may still have concern, why the issue does not always happen. Sometimes twice or three times in a month?
As shown in above flow, you could understand it only happens when LUW is destroyed i.e. there's error afterwards however
system can no longer roll back the whole transaction completely. If there's no error then with 2 times of COMMT WORK,
you can still see both material document and FI document are created.

  • FI document missing material document

        Similarly, if there's inappropriate ROLLBACK in user-exit, FI document missing MM could happen as well



  • Material document


         Call function 'A' in update task.


         Call function 'B' in update task.


      
        BAdI  MB_DOCUMENT_BADI (method MB_DOCUMENT_BEFORE_UPDATE) ROLLBACK is triggered
        -> material document update is cancelled


      



  • FI document


        Call function 'C' in update task.


        Call function 'D' in update task.



        Standard COMMIT WORK is executed, and only FI document is updated into database



  • check mechanism to prevent it

       
        We've got lots of customer incidents reported with this kind of inconsistency. The correction can only be carried out
        by SAP authorized engineer with debugging so we implement the checking mechanism in note 1776835

        to prevent such inconsistency. This note implement the coding to catch and track the inappropriate COMMIT

        or ROLLBACK in customer coding, and once it's detected system throws short dump to terminate the process.
        In transaction ST22 call stack, you can see in which user-exit or BAdI COMMIT/ROLLBACK is triggered, and then

        you have to review the coding with your ABAPers and correct it accordingly. So we highly recommend you to
        implement the note to prevent MM missing FI inconsistency. It's always necessary that customer development obey
        the rules and keep the completeness of SAP LUW.

SAP notes      
Regarding the MM/FI inconsistency topic, you can also refer to SAP note below for details:

  • Note 968812 MM-FI Differences caused by ROLLBACK or COMMIT
  • Note 92550  Stock inconsistency due to customer enhancement (exit, BAdI)
  • Note 1284654  Caution with implementations of the BAdI: MB_DOCUMENT_BADI
2 Comments