My Best Wishes To All Of you!!
Hope you Have Already read my blog mentioned below to have basic understanding of the physical Inventory Process.
Considering you have basic understanding of the process as discussed above let us jump in to the functional and technical process of the same.
Now let us discuss the same steps as above in the functional point of view.
Before getting into the process I would like to show you the stock of the articles that will be considered for this process. Below screen shots will display the MMBE and MB5B report of the two articles that are considered. The same report will be displayed again at the end of the document to show the differences registered through the physical inventory process.
First Article MMBE and MB5B Report:
Second Article MMBE and MB5B Report:
- Creating Physical Inventory Document:
This is the T-code which will create the physical Inventory Document, the document number will be used as the reference further with respect to all the materials in them. The initial screen of the t-code will be as below. You have to input the details like Plant, storage location as mandatory and other details in the screen if needed.
Once the Plant and storage locations are inputted, on enter we will get the screen as below where we enter the articles that needs to be counted.
We have to keep adding the materials that needs to be counted, remember we cannot enter quantity here.
This step is only to register materials that will be counted against the inventory document that is about to be created. In the below example am entering only two materials for explaining the concept.
Once the material is entered they will disappear from the screen and the screen will prompt for next input. You can find the same with the help of item number in the left. Since I have entered two materials already the screen is prompting for third entry as shown below.
On saving the T-code we will get the inventory record number generated as shown below in the bottom:
One Key point here is we are allowed to enter only 333 items as part of one inventory document. If we need to add more items then we need to create new inventory document.
- Changing Physical Inventory Document:
Now to know all the materials that has been entered or to add /delete any materials from the physical inventory document we can reach out to MI02. The initial screen will be as below, input the inventory document number along with the fiscal year and press enter.
The next screen will be as below, in case you want to delete any material click on the deletion indicator as marked below in red. For confirmation you can find deleted check box checked as marked in blue.
If there is a need to add any other material then you can navigate through edit option a shown below, this will take you to the screen similar to MI01 t-code. Both are shown below:
- Counting Physical Inventory Document:
Now we should be good to proceed ahead with counting as we are sure on the materials as part of the process. The T-code used for counting is MI04.
The initial screen looks as below, we are required to enter the inventory number and enter.
Once you enter the next screen we will be allowed to enter the quantity for all the materials that are part of the inventory document number as shown below. As part of our cycle am inputting quantities of 100 and 200 for the two articles as shown below.
One important point to note here is we must check the zero count indicator (Marked in Green above) in case we don’t have any quantity to enter or the quantity is Zero.
Upon saving we will get the confirmation for the count entered at the bottom as shown below.
- Change the Count of Physical Inventory Document:
This step involves recounting your already counted inventory document number. The t-code is MI05, you can straight away enter into the Inventory document number after inputting the details in the initial screen. You will get the details of the inventory document number and the quantity field will be editable here hence we can enter our new quantity here. Both the screen shots are given below, here am increasing the quantity of one material from 100 to 101. If we don’t have any change we can ignore this step.
Post changing the quantity we get a confirmation as shown in the below image at the bottom.
- Processing the differences and Posting the inventory document:
This T-code is used clear out the differences of the quantity that was counted against the quantity that is present in the system. The initial screen is as below, enter the inventory document number and proceed.
On entering on to the next screen we will find the difference of each material between the quantity counted and quantity present. The difference in the sales value will also be displayed in the fields to the right as shown below.
This step also gives us a chance to check whether there is a huge differences or there are any suspicious materials to be checked again, in case yes those materials can be rechecked again. We can manually recheck the quantity. In case if there is a need to change the quantity we can do the recount using T-code MI05 as explained above.
If everything is positive we can go ahead and post the same quantity that has been counted. In this step the counted quantity will be posted in the back end system. We can also find a material document number created against it.
Please Note that MI07 is the transaction to process one inventory document at a time, in case multiple inventory documents needs to be posted you can use MI37. The initial screen is shown below for reference.
Now we can see the standard MM reports to inspect the quantity, it should reflect the quantity that was counted and posted during the inventory process as discussed above.
First Article MMBE and MB5B Report:
Second Article MMBE and MB5B Report:
Now since we have better understanding about the functional cycle, achieving the same requirement through technical program will be easy to understand.
If you follow above process, we did the entire cycle with just two articles. Hence forth the complete cycle can be completed in a very short span. Consider if we have more than 50K materials to count either within the same storage location or with different storage location or sometimes may be with different plants as well. In this case completing the entire cycle as discussed above is going be a herculean task, none of us in our organization will be given that much time to complete this cycle through the process discussed above. Henceforth programming the entire cycle and bringing the process into the technical world is very important and also helps us in finishing the cycle real quick.
As discussed above the maximum time that will be taken during the cycle will be only during creation of physical inventory document and counting the same. The rest of process like postings can actually happen real quick since we have mass processing option.
So in this technical discussion am going to elaborate to accomplish creating the inventory document and counting the same. One key factor here is just ensure you always input correct quantity to be posted just to avoid detour and save time.
The first step of the technical implementation is collecting the data into an internal table. This purely based on the business scenario. You can either collate the data in an excel and later you can convert into an internal table or you can record the data in a custom table and pick it up from there directly into an internal table. Now considering the humongous data in our internal table let us discuss how we accomplish it through code.
First step: Creating Physical Inventory Document Number (MI01)
As we know the first step is to create the inventory number, we are also aware of the fact that we can have only 333 items per inventory document. So it’s imperative that we to have run the cycle with only 333 items at one instant. Ensure your loop continues on the internal table by dividing the entries into 333.
One technical tip here is you can use Appending lines of statement as shown below.
APPEND LINES OF gt_count_data FROM count_start TO count_end TO gt_data.
Here the internal table GT_COUNT_DATA will be holding our humongous data and the variables COUNT_START and COUNT_END will be holding starting and ending line item number that must be fetched. In the first cycle COUNT_START will be holding 1 and COUNT_END will be holding 333. After that during each iteration the variable values will be increased by 333. The internal table GT_DATA will be holding the 333 entries that should be processed during each cycle run.
Now coming back to inventory document creation. The FM that helps for creating inventory document is BAPI_MATPHYSINV_CREATE_MULTI. The BAPI will be called as shown below:
Now let us discuss on what needs to be fed to the BAPI for successful creation of Inventory document number.
The Parameter LS_HEAD should be fed with following field values.
|PLANT||Plant on which the materials are to be posted. Considering the above functional cycle it must be 1010|
|STGE_LOC||Storage Location on which the materials are to be posted. Considering the above functional cycle it must be 1000|
|PLAN_DATE||This must be the date on which the count was made for the materials.|
|DOC_DATE||This is the data on which the inventory document is created, by default it must be current date.|
|PHYS_INV_REF||If we wanted to refer all the materials entered to some value we can input the same. It can be any value, basically this is for referring the materials that are grouped under each iteration|
|FREEZEBOOKINV||By marking this field as X, the materials involved in this iteration cannot be counted again until this document is either deleted or posted successfully. In other words two cycles for the same material cannot run in parallel.|
The table ITEMS should be fed as below:
Initially this table must be only filled with below fields:
- MATERIAL = Materials that are involved
- STOCK_TYPE = Defaulted to value 1.
MAXITEMS à The value here must be 333, this is the maximum item count that can be entered.
Once all the values are passed above and the BAPI is executed, it returns back the inventory number on successful execution.
In case if there are any issues with input, the errors will be provided through the internal table RETURNS.
If there are no errors with input then the RETURNS table will have 334 (One entry more than ITEMS table) entries as result. The entries will also posses the physical inventory document created against all the 333 materials which should be one.
Kindly note that the 333 is the maximum entry that is allowed, you can also have entries less than that.
During this process there are few issues that are very common returned by BAPI. I would like to highlight those and their remedies. This would aid you during your implementation.
- Material Lock Issue: Ensure that the material is not in use in any other transaction, this would stop us from creating the inventory document Number.
- Material Does not Exist with respect to storage Location: This error occurs when the materials are not extended to the subjective storage location. You have to ensure that the materials is extended to the storage location.
- Material Not Extended to EP Storage Location: This error is similar to the above one but it requires different parameter to update. This Error occurs when the subjective Storage location is not maintained in the EP. Storage Location (MARC-LGFSB). This is usually returned as a error with Error Number 006, this assignment can be fixed by updating the field with the required storage location using BAPI:
CALL FUNCTION ‘BAPI_MATERIAL_MAINTAINDATA_RT’.
- Few Master Data Errors with Respect UOMs and other parameters.
- An inventory Document already exist: This Happens when there are certain inventory documents already existing for the same data that we are processing now. The former inventory documents must be cleared first before processing the current data.
The issues discussed above are common issues that can be handled easily.
Second step: Counting Physical Inventory Document Number (MI04)
Up-to this step we have our materials connected with the physical inventory document. We will now be ended up with physical inventory documents each containing maximum of 333 materials.
In this step we are supposed to count the materials, in other words we have to enter the counted quantity against each material. Assuming that we have all the required data in the internal table we can proceed to fetch the quantity and update it with the required materials. Technically this is achieved through below BAPI Implementation.
Now let us discuss on what needs to be fed to the BAPI for successful count of Inventory document number.
|PHYSINVENTORY||Input the physical inventory Document Number that has been generated in the above step.|
|FISCALYEAR||Current Fiscal Year during which this cycle is run|
|COUNT_DATE||This must be date on which the count was made for the materials, usually the current date.|
The table ITEMS should be fed as below, Initially this table must be only filled with below fields:
- ITEM = Item Number which must incremented from 1 up-to maximum of 333.
- MATERIAL = Materials that are involved
- ENTRY_UOM = UOM using which the count is made.
- ENTRY_QNT = Respective Quantity against the Material.
- ZERO_COUNT = In case if the quantity is Zero then this Indicator Must be marked as X.
Now once all the above parameters has been passed correctly we can run the BAPI and check for its results. This will complete the counting Process of the cycle.
Now as you see unlike functional cycle the technical cycle does not encourages options like deleting any material after entered or changing the count after entered etc. so it’s imperative that you need to have correct data to process. In case you wanted options to change the document or re-count then you have to code separately which is not advised.
Now considering we are successful until this point, there is only one step that is pending as stated below.
- Posting the differences through MI07. As discussed above if we wanted to process each document one after another then we can go through MI07 else we can use MI37 to process Mass Data.
Thus we complete the MM Inventory cycle both through Functional cycle and Technical cycle. Hope this document helps to understand the concept better.
Few Important T-codes For Quick Reference:
- MI01 –> Creation of Physical Inventory Document
- MI02 –> Changing Physical Inventory Document
- MI04 –> Counting Physical Inventory Document
- MI05 –> Changing Physical Inventory Document Count
- MI07 –> Posting Individual Physical Inventory Document
- MI37 –> Mass Posting of Physical Inventory Document
Hope this blog helped you understanding the basic flow. Thanks for your time.
Hope you Enjoyed Reading!!! I would love to receive your feed backs and corrections.
Thanks to SCN for giving this wonderful opportunity!!!
AN INVESTMENT IN KNOWLEDGE PAYS BEST INTEREST!!! 🙂
“Lets Learn Share and Collaborate” 🙂 🙂 🙂
Thanks and Regards,
Satish Kumar Balasubramanian