Want to analyze the accuracy of your inventory? Using Extended Warehouse Management (EWM) on S/4 HANA? Keep reading and I'll show you how!
Step 1 - Where's the Beef?!...I mean data.
If you look in Eclipse or use the View Browser app in Fiori Launchpad, you'll notice delivered ABAP CDS Views I_PHYSINVTRYDOCHEADER and I_PHYSINVTRYDOCITEM. At this point, you may be thinking...great! Delivered content, let's start pulling data! Unfortunately, there is a catch. These delivered views read the Inventory Management (IM tables), making them not so helpful if you are using EWM.
EWM uses an entirely different set of tables in S/4 than IM or WM. The tables in question are in the /LIME namespace. So instead of IKPF, ISEG (IM tables) or LINK, LINP (WM tables), data is stored in tables /LIME/PI_LOGHEAD, /LIME/PI_LOG_ITEM, /LIME/PI_DOC_IT, /LIME/PI_PAR_BIZ, /LIME/DOC_TB, /LIME/PI_IT_BIZ, etc. The records are joined using a GUID instead of a document number and line item.
For my requirements, I'm going to want the following fields:
- Document Number, Line Item, Log Category, Document Type
- Reference Document, Reference Document Type
- Count Date, Count User
- Warehouse, Storage Type, Storage Bin
- Material
- Booked, Counted and Difference Quantities, Units and Values
Following are the tables mentioned, which some notable fields listed:
- Table /LIME/PI_LOGHEAD contains the GUID (GUID_DOC), the physical inventory document (DOC_NUMBER), the warehouse (LGNUM), and the document year (DOC_YEAR).
- Table /LIME/PI_LOGITEM contains the GUID, as well as, the item (ITEM_NO), log category (LOG_TYPE), reference document (REF_DOC_NO), and reference document type (REF_DOC_TYPE).
- Table /LIME/PI_DOC_IT contains the GUID, item, document type (DOC_TYPE), document status (DOC_STATUS), as well as, the count date (COUNT_DATE), count user (COUNT_USER, and direction of movement (DIF_DIRECTION) - Important! Which way is the count being adjusted? This is used to calculate either absolute difference or relative difference.
- Table /LIME/PI_PAR_BIZ contains the GUID, item, warehouse, storage type (LGTYP), and storage bin (LGPLA).
- Table /LIME/PI_DOC_TB contains the GUID, item, item type (ITEM_TYPE) - Important! This identifies if it is the booked, counted, or difference quantity, unit (UNIT), and quantity (QUANTITY).
- Table /LIME/PI_IT_BIZ contains the GUID, item, and material id (MATID)
Want to see the material that is being counted? You'll need to join an additional set of tables to get to the material number. The material is stored in the /LIME/PI_IT_BIZ as a code. That code can be translated into the material product code in /SCMB/MATID_MAP and then translated into MATNR using /SAPAPO/MATKEY. Use the following joins to get from the material in the physical inventory document to the traditional material number.
- /LIME/PI_IT_BIZ.MATID = /SCMB/MATID_MAP.MATID_X16
- /SCMB/MATID_MAP.MATID_C22 = /SAPAPO/MATKEY.MATID
- /SAPAPO/MATKEY contains field MATNR, whew!
Here is an example from a test system:
In this example, material 1814957 is being counted.
You will want to categorize the counts using the cycle count indicator. When using EWM, this indicator is stored in table /SAPAPO/MATLWH. Plug in the MATID from /SAPAPO/MATKEY and you will get the cycle count indicator (CCIND). Depending on your configuration, you will also want to specify the SCUGUI and ENTITLED_ID.
If you need the SCUGUID and ENTITLED_ID, tables /SCMB/TOENTITY and /SCWM/T300_MD will help you get these GUIDs from the warehouse and entitled party which are available in /LIME/PI_IT_BIZ.
I look forward to your questions and comments!
Next up, Step 2 - Building CDS Views
Check back next time for the steps to build custom CDS views to leverage these tables!