Batch Determination Setup Scenario in S/4HANA Cloud
In this blog, we will cover the end to end setup of a basic batch determination scenario including master data and configuration settings required. We will focus on batch determination for the Sales and Distribution perspective, but the same concepts apply in inventory management and production planning as well. Our scenario is as follows:
Our company sells product TG211 to multiple customers based on a “first-in first-out” approach. The date we are considering for identifying our “first-in” batch is the date we last received that batch into the warehouse.
In addition, we also track product purity. One of our critical customers 17100001, requires any product that is sent to them be above 90% purity.
We want the option to determine the batch at on the sales order but if not specified at that point, we want the batch to be automatically determined on the delivery.
Master Data Setup
Create Batch Characteristics
Our first task is to create our batch characteristics and batch class. Batch characteristics represent specific qualities which can be used to describe a batch. A batch class identifies which characteristics should be tracked as part of a batch. In this case, we need two characteristics for our class, one to represent our “goods receipt date”, and another to represent “purity.”
To create a batch characteristic, we need to enter the application “Manage Characteristics.” We then enter a characteristic name and choose “create.”
Here we enter some basic information including description and release status as well as some more detailed parameters on how the data should be recorded and formatted. For this scenario, the characteristic for product purity should be a single value, have a unit of percent by mass, with two characters and no decimals, and be required data for the batch. A user will therefore be required to provide a purity value when creating a batch where this characteristic is relevant.
Choose save to finish the setup.
For our second batch characteristic for goods receipt date, we can use one of the pre-delivered SAP characteristics LOBM_LWEDT – Date of Last Goods Receipt. To view details behind this characteristic, we can enter the same application, search the characteristic by name or by dropdown selection, and choose display.
This characteristic is setup with a date data type and will automatically record a value based on the most recent goods receipt date pulled from the referenced table and field. Because this is done automatically, the procedure “not ready for input” indicates that a user does not input the value manually.
Our characteristics are now ready for use.
Create Batch Class
Our next step is to assign our batch characteristics to a batch class.
To create a batch class, we must enter the application “Manage Classes.” Here we enter a name of our class and the class type “023” for batch class. Then choose create.
First we enter basic information about the class including description, validity date, and release status. Next we must add our two batch characteristics on the “Char.” tab.
Then choose save to finish creating the class.
Create Sort Sequence
Next we must create a sort sequence which determines how batches with the assigned batch characteristics and batch class should be prioritized. Enter application “Create Sort Sequence” and choose “create” after entering an ID for the sort sequence. Add a description and then choose “characteristics.” Here we will add characteristic “LOBM_LWEDT – Date of Last Goods Receipt” and sort this as “ascending” to bring the oldest date (lowest value) to the top of the list. This satisfies our general “first in first out” requirement.
We do not want to sort by purity so we will not add this characteristic to the sort sequence.
Choose save to finish setting up the sort sequence.
Assign Batch Class to Material
Our final step in master data setup is to add our newly created batch class to our material TG211. To do so we need to enter application “Change Material” for material TG211 in the relevant plant, and select the “classification” view. When prompted, choose class type 023 – batch class.
In the assignment table, we add our batch class and hit enter to see the assigned batch characteristics pull in. If needed, we could enter default values for these characteristics here, but this is not a requirement in this case.
We now choose save to finish assigning the batch class to the material.
We have now completed the setup on what information should be contained in our batches for material TG211. We now need to tell the system how to determine which batches should be sent to a customer depending on the information contained in these batches. The general rules behind this decision are built in configuration. We then use these general rules to define specific conditions (customer 17100001 needs 90% purity) called search strategies.
First enter the application “Manage your Solution” to access the configuration steps. Then search for “Batch Determination for Sales and Distribution” and click into the line to view the relevant steps.
Create Condition Tables
We need to setup what key combinations we can use to define our search strategies later on. Per our requirements we have two levels of detail. We want to define one general FIFO strategy for material TG211 that applies to all customers. We also want one strategy using FIFO and greater than 90% purity for material TG211 and customer 17100001. Therefore, we need one condition table containing the key “material” and another containing the keys “customer” and “material”
Enter configuration step 2. “Change Condition Tables to Determine Batches for Sales and Distribution” by choosing the button “configure” on the corresponding row.
When prompted for the table number, we see that condition tables 001-material and 002-customer/material already exist as pre-delivered content by SAP. We can then confirm that the selected fields for the tables correspond with our required keys.
If your key combinations are not already pre-delivered in existing condition tables, Enter configuration step 1. “Create Condition Tables to Determine Batches for Sales and Distribution.”
Create Access Sequence
We now need to describe which sequence the system should check for our key combination when looking for a search strategy. To do so, we should create an access sequence and assign the condition tables in the proper sequence.
Enter configuration step 3. “Define Sales and Distribution Access Sequences” by choosing the button “configure.” Access sequence SD01 is pre-delivered by SAP and appears to already meet our needs but lets verify by selecting the row and choosing the “accesses” level from the dialog structure.
Here we need to organize the accesses by most specific to most general. In our case, we want the system to first check if both a customer and material number are specified to ensure customer 17100001 receives 90% purity or greater. If the customer number is not 17100001, we then want the system to only consider material number for the general FIFO based selection.
We can now choose save and exit the configuration.
Create Strategy Type
Our next step is to create a strategy type which links our batch class and sort sequence to our access sequence and thus the key combinations based on which we will define our search strategies. This will tell the system that generally we want our batches sorted from oldest to newest based on goods receipt date, but we also want to create specific conditions (90% purity) depending on material and customer.
Enter configuration step 4. “Define Sales and Distribution Strategy Types.” Choose “new entries” to create a new strategy type. After choosing an ID and description for the strategy type, assign the batch class, sort sequence and access sequence previously created.
Choose “save” to finish setting up the strategy type.
Define Search Procedure
We next must define a search procedure which is a collection of strategy types we would like the system to consider. There is a sequence associated so that if a batch is able to be determined using a strategy type, the process is completed and no other strategies types are checked.
Enter configuration step 5. “Define Sales and Distribution Search Procedure.” Click the button for “new entries” and add an ID and description for the new search procedure.
Flag the row of the new search procedure and click “control data” and then “new entries.” Here we will add our strategy type as well as a step and counter number to indicate sequence in case of any other strategy types.
Choose “save” to finish setting up the search procedure.
Assign Search Procedure to Sales Area and Document Type
Our final mandatory setup step is to assign our search procedure to the combination of sales area (sales org, dist channel, division) and sales document that is relevant to our material and scenario respectively.
Enter the configuration step 6. “Allocate SD Search Procedure/Activate Check.” Find or create the relevant combination of sales area and document type, and assign the search procedure. In this case, we are looking for standard sales orders and therefore choose document type OR.
Choose “save” to finalize the changes.
Activate Automatic Batch Determination for Sales Order / Delivery Item Categories
The next step is to maintain which item categories should have their batches determined automatically when either a sales order or delivery are created. For our scenario, the relevant item category is “TAN – Standard Item.” We want our batch to be left blank on the sales order, and determined automatically when creating the delivery.
Enter configuration steps 7. and 8. “Activate Automatic Batch Determination for Sales Item Categories” and “Activate Automatic Batch Determination for Delivery Item Categories.” Ensure that the automatic determination flag is not set for item category TAN on the sales order, but is set on item category TAN for the delivery.
Choose “save” to finish the changes.
Transacting with Batch Determination
Build Batch Search Strategies
We are finally ready to create our batch determination search strategies. These search strategies determine which batch to use based on the given set of conditions.
To create our search strategy, access the application “Manage Search Strategies – Sales and Distribution.” Enter the strategy type that was created earlier and choose “change.” We will first setup our most specific case that indicates customer 17100001 requires that material TG211 be above 90% purity. Therefore, choose the “customer/material” key combination, enter the customer and material number, and choose execute.
Add a line for our material TG211 and hit enter. Consider the additional parameters in the table. For our case, we will allow selection from as many different batches as needed to fulfill the required quantity. Therefore “No. batch splits” will be 99. We will use top-down quantity proposal, and also allow over-delivery.
To specify our product purity, flag the row and choose “selection criteria” from the top menu. In the characteristic “product purity,” add the expression “>90” to indicate that this value should be 90% or more to be valid for this customer.
We do not need to add any selection criteria for “last goods receipt date” since the sort sequence we previously created will prioritize based on this.
Choose the back arrow and then “save.”
We then need to setup our general “first-in first-out” search strategy. Re-enter the application “Manage Search Strategies – Sales and Distribution” choose the same strategy type, but this time choose the “material” key combination since we will not be specifying a customer.
Enter Material TG211 and choose “execute.” Add a row for TG211 and add the table options used above. For first-in first-out based on last goods receipt date, we don’t need to enter any specific date in the selection criteria window where we added a minimum purity in the previous step. We can instead rely on our sort sequence to prioritize batches based on this date. Therefore, in column “selection type” add value “o – selection with no selection criteria.”
Choose save to finish making changes.
We have now completed all the setup required for the end-to-end batch determination process. We can now test our results to ensure batches are assigned in the designed way.
To test the results, three batches are created for material TG211 with the following characteristic values.
Batch 1000A – purity 88% – last GR date 4/30
Batch 1000B – purity 86% – last GR date 4/15
Batch 1000C – purity 92% – last GR date 4/30
Two sales orders are then created, one for customer 17100001 who requires 90% purity, and the second for customer 17100002 who has no specific purity requirement at this time.
After running batch determination for each, we can see that the batch 1000C with 92% purity is selected for customer 17100001 as it is the only batch above the 90% requirement. The batch 1000B with the oldest GR date is selected for customer 17100002.