Skip to Content
Product Information
Author's profile photo Kanda Balasubramanian

Project Manufacturing Management and Optimization: Costed Stock Gain

SAP Project Manufacturing Management and Optimization in S/4HANA helps achieve greater efficiency with project manufacturing in an Engineer to Order (ETO) environment to deliver complex end products (e.g. military aircrafts, ships and submarines, complex industrial machinery etc.), that often involves complex engineering and production processes. On the other hand, it maintains visibility into detailed actual cost reporting and progress analysis for non-valuated grouped project stock.

I encourage you to check out the new features that were released in S/4HANA 2021 FPS0 release. In this blog post, I would like to explain the costed stock gain feature in Project Manufacturing Management and Optimization (PMMO).

Stock Gain

Inventory gains and losses during inventory counts are exceptional cases but not uncommon within project manufacturing. These inventory adjustments often have an impact on the allocation of project costs. In this release, stock gains in grouped project stock segment can be allocated costs which can be critical for high value parts that are found.

The following are some of the key movement types that result in stock gains:

501/Q – Goods Receipt without Purchase Order

521/Q – Goods Receipt without Production Order

531/Q – Goods Receipt by-product

701/Q – Goods Receipt of Physical Inventory Differences

The default behavior in PMMO when stock gains are posted for a given material is to create a dummy replenishment element (in the format SG + Material Document Number + Material Document Item + Material Document Year) for any quantity exceeding prior loss quantity. This dummy replenishment element is not a cost object and therefore cannot carry any costs. Therefore, from a cost perspective, the dummy replenishment element is allocated at zero cost to the assigned operative WBS element based on the pegging assignments.

PMMO offers the capability to allocate costs to stock gains. Instead of the dummy replenishment element, a production order without header material or components is created in the background during the material document posting of the stock gain movement. This enables assigning costs to this order and later distributing the costs to the individual projects within the group as part of PMMO Distribution.

Let’s take a look at the configuration and an example.

Costed Stock Gain Configuration

Transaction: PMMO_IMG

Integration Materials Management (MM) – Inventory Management (IM) -> Configure Client Specific Setting for Integration

The highlighted fields above control whether a production order without header material and without any component is created in the background when stock gains are posted for grouped project stock. If either or both the fields are left empty, then the dummy replenishment element is created.

The stock gain order type refers to the Production Order type that is configured for stock gains. This way, you can easily identify such production orders to manually post costs. The reference operation set defines the routing and the operation for the stock gain production order created without header material.  The reference operation set can be created via transaction code CA11.

To enable costed stock gain, I have set the stock gain order type and the reference operation set as shown below.

Note that the setting is client wide. You can turn on or off the costed stock gain for the entire client. Therefore, the setting affects all allowed movement types that are assigned the category “Stock Differences”. For more information, see help documentation.

Costed Stock Gain

Now, let’s run the scenario with costed stock gain in PMMO.

Below is the pegging assignment results for an example I setup before the inventory gain is posted.

Next, during inventory count (transaction code MI10), let’s say instead of 10 EA of the semi-assembly PMMO_TEST_S2 material, 11 EA was counted in the group WBS stock segment. Therefore, a material document for 1 EA with movement type 701/Q is posted. While this material document is posted, a production order is created in the background and saved in the PMMO_STOCK table.

Below is the pegging results after the inventory gain is posted. The production order created as a stock gain is now visible in the pegging result.

Navigating to the production order, you will notice the production order does not have a header material and is account assigned to the group WBS element stock segment. The production order is also released automatically when the material document is posted.


With the costed stock gain feature, you can now post primary and secondary costs on this production order using the relevant transactions (KB11N, KB21N). Note that the determination of the actual costs are customer specific. Check out the PMMO roadmap, in S/4HANA 2022 release, there is a roadmap item to deliver a standard report for order cost rollup. This report would be relevant to help determine costs for the same material from a similar order. Once the costs are posted, the stock gain production order can be set to completed and closed. PMMO Distribution will pick up the costs for the stock gain order and distribute the costs to the assigned WBS based on PMMO Pegging assignments.

Note also that inventory count differences for project stock at vendor (Stock Type R) is also supported in PMMO. I plan to publish a blog post on subcontracting features in PMMO, so stay tuned.

I hope you found this blog post useful. I am looking forward to your comments and questions below.

Thank you!

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo PEO Broker LLC
      PEO Broker LLC

      Hi,Lots of useful information. Thanks for sharing.

      Author's profile photo Kanda Balasubramanian
      Kanda Balasubramanian
      Blog Post Author

      Thank you for the feedback.

      Author's profile photo Sunit Rastogi
      Sunit Rastogi

      Thanks Kanda for the nice blog, I have two questions:

      1. Why does the production order not have the header material? Are there any adverse impacts of this? We noticed that PMMO_STOCK table is appropriately populated and PMMO Pegging runs properly for the gained material.
      2. It appears profit center is needed in order to release the production order. We need to use the profit center of the group WBS that is assigned on the order, is there some configuration that would let us do that or we need to invoke an user exit?


      Sunit Rastogi

      Author's profile photo Kanda Balasubramanian
      Kanda Balasubramanian
      Blog Post Author

      Thanks Sunit.

      Regarding 1: The production order does not have a header material so that it does not show as an open order in stock requirements list and also prevent anyone from doing a goods receipt on this order. The main purpose of creating such an order without a header material is to be able to cost it. There should be no adverse impacts, besides the fact that this order could have a different UoM. For example, if you have two materials with 2 different base UoM, one with EA and other with L. If the UoM maintained in the reference operation set header has EA as UoM, then a stock gain for either of the two materials will create a production order without header material and UoM as EA. One way to avoid this is to create multiple group counters in CA11/CA12 transaction for the reference operation to maintain different UoM for each plant. If this is maintained, then the correct UoM will be used when the production order without material is created.

      Regarding 2: The production order without header material that gets created when posting the material document should get automatically released. You might be missing an SAP Note or need to upgrade to a later feature pack. Also, profit center shouldn't be necessary to release the production order. In case you want to fill the profit center, you can do that via subclass enhancement by subclassing the local class LCL_CSG_ORDER method csg_order_create in program SAPLPMMO_COSTED_STOCK_GAIN. The structure ls_orderdata should have the field PROFIT_CENTER that you can fill via this subclass enhancement. You can refer to this blog post that explains how to enhance the local PMMO class.

      Hope this helps.

      Best Regards, Kanda