SAP Batch Determination made easy

Recently a colleague encountered the following problem:

His customer tracks perishable products that are bought / inventory managed / sold using the SAP functionality Batch Management (LO-BM). The products have a shelf life and therefore a “Use by/Expiration” date. His problem was that he was able to correctly update the characteristic “Expiration date” of the batch, but was not able to select batches during the delivery stage, based on the “Expiration date” – i.e batches that were still fit for use.

So here is a tutorial on how to select batches during the delivery (but it could be applied to any batch search requirement) for which the shelf life has not expired. It has to be noted that SAP covers all kinds of scenario.

– It might be company practice to ship out the door products with a minimum shelf life of X days
– It might be that a specific customer requires a product with a different, longer minimum remaining shelf life
– It might also be that products that are shipped to a specific country require a yet again different minimum shelf life

It might be that you require all three or a logical combination of all three. SAP will easily cover all those requirements and more.

This tutorial only covers the batch determination process in SD, but once you get the jist of it you should be able to apply this to any other module where that function is covered. I also assume that you have set up your system in such way that you are able to have products batch managed.

Step 1 – Standard SAP characteristics you will import

The first thing you need to do is to check that your SAP client has all the required SAP standard characteristics. To do this go to transaction CT04 and query your system to find all characteristics that are called LOBM*.

If a list of values such as the one below is returned then it means that you are all set to go to Step 2 – Create and assign Batch class to products.

If not it means that you need to copy them from client 000. To do that go to customizing and follow the path indicated: Customizing / Logistics – General / Batch Management / Batch Valuation / Updates Standard Characteristics (or transaction BMSM)

The following messages will be displayed if everything goes well.

Once that is done you might want to go back to transaction CT04 and query for characteristics called LOBM*.

Why do I need to do that do you ask? Well for one thing all the work is done for you. Secondly and more importantly the standard SAP functions that will enable us to dynamically calculate the “Expiration date” based on minimum remaining shelf life, makes use of these standard characteristics – they are hard coded in the ABAP functions.

Moving on to step 2 and getting your basic data right.

Step 2 – Create and assign Batch class to products you will do

In our case we have one product, to which we have assigned one class (of technical type 023 – batches). This class has been conveniently called “EXPIRATION” and contains only one characteristic. That characteristic is one of the standard SAP ones called “LOBM_VFDAT – Expiration date, shelf life”. The system has been set up in such a way that when ever I do a goods receipt on this product, SAP will ask me to input the production date and then based on the shelf life of the product, automatically calculate the expiration date of my batch.

This will update a standard SAP table field (MCHA-VFDAT / MCH1-VFDAT – depending on the validity of your batch across plants). This will in turn update the value of the characteristics LOBM-VFDAT within the batch .

So if we look at the shelf life list report (transaction MB5M) we see that this information concurs with that contained in the classification of our batches.

Step 3 – Create a Batch search class you will do

This is a class that will be used to search and find applicable batches during batch determination. It is not directly assigned to the product – it will be assigned to the batch search strategy of the product.

The question is, what characteristics should we put in this class?

If we go back to basics, what we will want to do, is find batches that have a remaining shelf life of X days. If we view this requirement in a different way, we can say that we will want to find batches that have an expiry date that is equal or greater to “delivery date + X days” . My class will therefore use the following characteristics:
– LOBM-VFDAT : The expiration date of the batch – that value SAP will calculate.
– LOBM-LFDAT : The delivery date – that value will be automatically updated by SAP with the delivery date from the delivery

All we need is a characteristic where we will be able to input the value corresponding to X (minimum remaining shelf life required). Again, we do not need to do anything, SAP provides the characteristic “LOBM_RLZ – Remaining Shelf Life for Batch”, to do just that. We therefore have a class (also of technical type 023 – batches) that looks like this.

Step 4 – Create a sort rule you will do

It’s all good to build a batch search class to find batches, but assuming SAP finds numerous batches, how should they be sorted (i.e which should be the first one used?) ? By batch number? Of course not, we want to sort batches based on the expiration date in ascending order (the batches with the date closest to the present should be the first to go).

To do this, call transaction CU70.

Give your sort sequence a name and in the following screen, give it a description as well.

Then click on the characteristics button and assign the characteristic LOBM-VFDAT to it. Also select/amend the sort order that you want.

Save your sort key.

Step 5 – Create a batch search strategy you will do

We want to create a search strategy during delivery processing, i.e in SD – Sales and distribution. So call transaction VCH1 – to create it. We’ll create a strategy determined based on the customer and the material (standard strategy type SD01 caters for that).

Enter your customer and product (amend the strategy as required).

Click on the “selection Criteria” button to assign the search class. In this case we indicated our search class, which copied across the characteristics associated with it.
We also indicate the value “>=30” in the characteristic “Remaining Shelf Life for Batch” – this means that we will only want to select batches that have an expiration date that is greater or equal to delivery date + 30 days.

Now go back to the previous screen and now click on the “sort” button. There you will assign the sort rule you created in the previous step.

Save your work.

Step 6 – Putting it into practice - the fruit of your efforts you will see

Now that we have created all the required basic data, let’s see how it all hangs together.

We have a sales order for which we create a delivery – batch search will be triggered manually to better follow the process.
In the delivery, we go to the batch determination screen and we see that the system has automatically searched, found and proposed batches that have a remaining shelf life that is greater or equal to 30 days only and it has sorted them according to expiration date – just what we wanted.

The system here proposes 3 batches (yet remember that above, it did indicate that we had 5 batches in the system). To get a better idea of what parameters were calculated/used to determine those three batches, click on the “selection criteria button”.

We see the >=30 that we typed in the batch search strategy. We also see that the system took the delivery date “08.09.2008” added 30 days to it and determined that the batch it was going to search for had to have an expiration date greater or equal to 08.10.2008.

We can also change the search parameters here (this is customizable). We’ll change the value of 30 to 4 right there in the batch determination.

This shows even more batches – logical as we have indicated that batches should only have a remaining shelf life of 4 days or more.