Building a Serial Number Tracker Report for Production Materials in SAP S/4HANA Cloud
For manufacturing orders producing quantity of one there is an easy way to report product and component serial numbers using analytics extensibility in SAP S/4HANA Cloud. Prerequisite is that you have posted goods receipt from production and component consumption with serial numbers.
Do you want to know more? Then this is the right blog post for you because I am going to show you how to build a Serial Number Tracker which contains all the relevant data.
Which data fields are necessary for this report to include?
- Serial Number
- Manufacturing Order
- Header Material Number, i.e. the material number of the produced material
- Product Name
- Material Number from goods movements, e.g. goods receipt of header material or consumption of component
- Material Document
- Material Document Item
- Material Document Year
- Goods Movement Type to differentiate between components consumed (movement type 261) and goods receipt posting of produced material (movement type 101)
What are the steps (process) for creating a report containing all the above-mentioned data fields?
- First, we need to identify (ideally) one single CDS View that already contains all the necessary data fields. But knowing that there is no available single source of truth, we need to build one ourselves by identifying several CDS Views in the system. And this will be done via the ‘View Browser’ app.
- Next, after we have identified the right CDS Views, we need to combine them all to one Custom CDS View and this will be done via the ‘Custom CDS View’ app.
- Afterwards, we will build a Custom Analytical Query on top of that CDS View to be able to analyze the data via ‘Multi-Dimensional Web Dynpro Report’.
- And in the last step we are going to create an app, so that the report can be accessed immediately with one click from the SAP Fiori Launchpad. And by assigning the app to a business catalog, we will ensure that only the right users have access to it.
Step 1: Open ‘View Browser’ App
- In the search bar we will first search for the field ‘Serial Number’. Make sure that the key user status is always set to ‘Released Views’, because we can only work with released CDS Views.
Among the results there will be a CDS View named I_SerialNumberMaterialDoc_2. This is the right one for our case because it contains the Serial Number in the Material Document.
Remark: Even if equipment is not created with serial number creation this CDS View can be used.
- We have now identified one CDS View containing 1 out of 9 required fields, so we need to continue our search for the other fields across other CDS Views.
- In the search bar we will now search for the field ‘Material Document Item’.
Among the results there will be a CDS View named I_MaterialDocumentItem_2. We will make a note of that because besides the field ‘Material Document Item’, the CDS View further contains the ‘Material’, ‘Material Document’, ‘Material Document Year’ and the ‘Goods Movement Type’. So, with this CDS View we can check additional 5 out of 9 required fields. Only the ‘Product Name’, ‘Header Material Number’ and the ‘Manufacturing Order’ remain.
- Next, if we search for the ‘Product Name’ we will not get the desired result right away. Therefore, we are going to use the ‘Alternative Search’ option right next to the search bar, select ‘Column Names’ and enter ‘Product Name’ as a keyword to narrow down our search. Among these results the CDS View I_ProductText will be listed which contains our designated field and is therefore the right choice.
- Searching for the ‘Manufacturing Order’, a CDS View named I_ManufacturingOrder will be displayed among the results. This CDS View will mark the last piece of the puzzle because it not only contains the ‘Manufacturing Order’ field but also a field named ‘Material’, which corresponds to our requirement of ‘Header Material Number’.
- Finally, we have now identified four CDS Views containing all the relevant data and in the next step we need to combine them to one Custom CDS View.
Step 2: Open ‘Custom CDS Views’ App
- Here we will create a new Custom CDS View and choose ‘Analytical Dimension’ as the applicable scenario because our CDS Views do not contain any measures (for that the right scenario would be ‘Analytical Cube’) but we still want to build a Custom Analytical Query on top of it to be able to analyze the data (a query can only be built upon CDS Views being classified as ‘Analytical Cube’ or ‘Analytical Dimension’).
- The CDS View I_MaterialDocumentItem_2 is going to be the primary data source. Why this one in particular? Well, this CDS View contains the fields ‘Material Document’ and ‘Material Document Item’ which are also included in the I_SerialNumberMaterialDoc_2. And it also contains the fields ‘OrderID’ which corresponds to the ‘Manufacturing Order’ in I_ManufacturingOrder and ‘Material’ which corresponds to ‘Product’ in I_ProductText. Through these fields we will be able to join the other three CDS Views as associated data sources with the I_MaterialDocumentItem_2. If we had selected the I_ManufacturingOrder as the primary data source for example, there would be no joint fields with I_SerialNumberMaterialDoc_2 and the CDS Views could not be joined properly then.
- After we have joined the CDS Views as shown in the four screenshots above, we now must add our 9 fields through the Elements tab (Add > Elements) and ‘Check’ & ‘Publish’ the CDS View.
- Remark: With the additional join condition in I_ProductText (‘Language’ with constant value ‘E’) we are limiting the result to the English name of the material. Otherwise, we will get multiple entries (rows) for one single material number (the material name would be displayed in other languages as well).
Step 3: Open ‘Custom Analytical Query’ App
- Now we will create a Custom Analytical Query with our previously created Custom CDS View as the data source.
- In the Field Selection tab, we need to check the selection boxes of every field in order to get them in our report.
- In the Display tab, we need to move every field from ‘Free’ to ‘Row’ and rearrange the display order to a more meaningful one (here we can also choose to override the label of our field ‘Material’ from I_ManufacturingOrder to ‘Header Material Number’ to distinguish it from the ‘Material’ of I_MaterialDocumentItem_2):
- In the Filters tab we can optionally define, if all or some of the fields should also serve as filters in the report and if the users should be able to enter user input values to search for a specific Material or Serial Number etc.:
- After that, we need to click on ‘Save Draft’ and ‘Publish’ the query.
- If we click on ‘Preview’, the Multi-Dimensional Web Dynpro Report will open, and we can start analyzing the data.
Step 4: Open ‘View Browser’ App
- Instead of having to search for the query among many others in the system each time, we can simply create an app for it, so it will be readily available on the SAP Fiori Launchpad. For that, we need to open the View Browser app, search for our previously created query, select it and click on ‘Create Application’. After we have entered a title and subtitle, the app will be created.
- The creation of the app is now complete, but it is not yet available because it further needs to be assigned to a business catalog, so that users who have a business role where this business catalog is used in, will be able to see and access it.
- And this can be done by clicking on the Application ID link and open ‘View in Catalog’. Now we will be forwarded to the Custom Catalog Extensions app where we can assign such a suitable business catalog. For demo purposes we will assign it to ‘Analytics – Query Design’ but this step is very specific to your organizational restrictions and should be assessed internally, which catalog you assign. After clicking on ‘Publish’ we need to refresh the system and the app can be seen and accessed by every Analytics Specialist who has the business role ‘SAP_BR_ANALYTICS_SPECIALIST’ for example.
- Opening the app, the final report will look like this, and we can start working with it:
In this blog post we have learned how to build a report for tracking the serial number for production materials in SAP S/4HANA Cloud. We went through the whole creation process step by step and have not only seen which apps to use along the process but we also got to know how to utilize them to identify the right data sources, how to combine these data sources to one Custom CDS View as a single source of truth and how to create a Custom Analytical Query with its own app that in the end contains all the relevant data we need.
In case you have any questions, please use the SAP S/4HANA Cloud Q&A area. You are also welcomed to provide your feedback and thoughts in the comment section below. For similar content you can follow my profile or the blog feed SAP S/4HANA Cloud.