Wednesday, 21 February 2024

Reporting daily material stocks using CDS views

Core Data Service Views (CDS) offer the possibility of reporting daily inventory values without the need to set up and fill info structures.

Every company must be able to show and report its inventories and, above all, be able to control them. For some companies, it is also important to be able to see the development of their stock on a weekly or even daily basis. For retail companies in particular, there is also the need to track not only the quantities but also the development of inventory values. In SAP ECC, this was made possible by updating information structures and transferring data to an SAP BW system using so-called 2LIS extractors. In this blog, I would like to discuss the possibilities in S/4HANA systems using CDS views, as in certain scenarios it is no longer possible to update the required info structures. In addition, the approach using CDS views offers the avoidance of non-posting times and the extraction of values without an S-API. This can be used within SAP Datasphere scenarios using CDS-CDC datasources.

General challenge in reporting inventory quantities and values:


In order to be able to display the inventory key figures as time series accurate to the day in the past, the required data was and is loaded into corresponding BW systems (SAP BW, SAP BW on HANA or SAP BW/4HANA) via the 2LIS_03* DataSources. This is done by extracting the current stock via the DataSource 2LIS_03_BX and adding the movements of the materials come via 2LIS_03_BF. These two sources can be used to generate the time series for the quantities. To be able to display the values accurately, we also need all documents that generate price changes. These can be, for example, revaluations for own products or adjustment invoices for third-party products that were not yet known at the time of the actual material movement. We receive these revaluations via the DataSource 2LIS_03_UM (or 2LIS_40_REVAL). The corresponding transactions in ECC, such as MC.5, are based on information structures such as S033, which are maintained via transaction OM09. Without these methods, the reporting of a stock value is only possible at the end of the period.

It is also possible in SAP S/4HANA systems using the options mentioned above. However, challenges arise if SAP Datasphere is to be used instead of an SAP Business Warehouse. This cannot read the above-mentioned DataSources directly but requires the SAP BW Bridge. On the other hand, the S/4HANA source system can no longer manage info structure S033 with data if late locks are to be used when posting goods movements. However, this is particularly required by retailers with a high volume of documents, who in turn often rely on the daily value representations. In the following sections I will describe how this can be done.

Options for data extraction in SAP S/4HANA


The CDS-based extraction of data is the current and future data extraction method to be selected, primarily due to the Change Data Capture procedure.

By now it is possible to extract the goods movements via the CDS view I_GoodsMovementDocumentDEX. However, the revaluations are missing here. There are standard views for extracting the current material valuations. However, these do not enable the creation of valid time series for the stock value.

Possibilities in SAP S/4HANA Embedded Analytics


SAP S/4HANA Embedded Analytics enables real-time reporting within the operational transactional SAP S/4HANA system. This is based on analytical CDS views. For stock evaluations, SAP Virtual Data Model (VDM) offers these two CDS views, among others:

C_StockQtyCurrentValue_3 - Material stock for current valuation

C_MaterialStockTimeSeries - Material stock quantities over time

However, it is not possible to evaluate the stock values over time.

How to get relevant documents for revaluation from ACDOCA


In both scenarios described above,, the standard options provided by SAP do not include the revaluations that 2LIS_03_UM used to provide in order to be able to display daily time series for stock values.

For my customers' initial prototypes, I took the route of selecting the values via ACDOCA.

A corresponding representation of a model in an SAP BW/4HANA system is shown below and is based on the CDS view I_GLAccountLineItemRawData for the ACDOCA postings:

Possible Datamodell in SAP BW/4HANA:

Reporting daily material stocks using CDS views
Possible Datamodell in SAP BW/4HANA

Unfortunately, there is currently no standard view delivered by SAP for selecting the relevant postings. I am currently using the following filters:

Filter Settings Part 1:
Reporting daily material stocks using CDS views

Filter Settings Part 2
Reporting daily material stocks using CDS views

For reporting in S/4HANA Embedded Analytics, this report could be modeled by implementing the revaluations in an analytical cube, which is combined with the inventory quantities via Union. However, the values of the goods movements would also have to be updated in the standard cube for the quantities.

No comments:

Post a Comment