Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
Showing results for 
Search instead for 
Did you mean: 

Use Case: Your business requires a more flexible way of using Physical Inventory in SAP Business ByDesign. For Example: You want to create physical inventory count documents for a changing set of products or you might want to upload count task result via Excel.

This blog guides how to achieve more flexibility through SAP Cloud Applications Studio (CAS) with regards to:

  • Create Physical Inventory Document

  • Complete Count Task

  • Approve Physical Inventory Document

For all 3 cases, you can achieve it with simple custom developments.

Note: The blog is explained considering a business use case where one count document will have one task only. Underlying assumption for this use case is that business already knows how to split their documents. Further-more to keep the use case simple, only one item is considered in the task to demonstrate the CAS capabilities for enabling counting process. The following document explains the same with details.

In case, your use case demands multiple tasks and multiple items to be created against one count document, the use case is scalable by modeling the BO and the UI accordingly.


Let us now look into the above functionalities one by one:

1. Creating Physical Inventory Document

Physical Inventory Document can be created in the system based on Product count or on Logistics Area count. To achieve this, create a Custom BO as shown below with the following mentioned fields.

BO Fields

locID – To Capture Location ID

cmCode – Product or LoA count

loa – LoA where the count must be performed

prodID – Product for which the count document must be created

qty – Counted quantity for the product

taskID – Task ID to count the quantity

cDocID – Count Document ID

BO Action           

createDoc – This action will create count document

Save and activate the BO. Create ABSL scripts for required events and actions.

createDoc Action ABSL

In this ABSL create the count document based on the below approach:

  • Create an instance of Root PhysicalInventoryCount BO

  • Pass user input of Storage Location ID & Count Method to corresponding fields in the root node

  • For the created Root instance, create an instance of OperationCount Node under the same BO

  • Pass value as “4” for CountScopeCode field under the OperationCount Node

  • Create an instance of OperationActivity from OperationCount Node

  • Call the Action “CreateTask” from OperationActivity Node

  • Once the task is created, navigate to ReferenceObject from OperationActivity

  • Create CountInventory instance

  • Pass value of LoA here under this node

  • Create instance of InventoryItem from CountInventory Node

  • Pass Product ID value under this node

  • Finally create the instance of ItemQuantity Node from InventoryItem

Sample snippet of the code with only one Product per count document.

To achieve create document process, User Interface would be required. The screens are generated from studio for created custom BO with Work Center, Work Center View, OWL, OIF & QAF.

UI to Create ‘Count Document’

User enters the required information by clicking on ‘New’ from the Custom Work Center View and then clicks on ‘createDoc’ Button and then clicks on Save. Close the screen.

The Count Document will be created in the system which can be verified under Physical Inventory Work Center -> By PI Count Document -> PI Count Not Started and find for recent created count document.


2. Recording Count results against the Task

In the defined BO, add a new Action by name updateTask as below:

In the createDoc ABSL, TaskID is stored in the custom BO. This TaskID would now be used to query from PhysicalInventoryTask BO and then pass the captured Counted Quantity to the ItemQuantity Node and finally Finish the task.

Sample snippet of the code to update ONE task and finish.

UI to record the results of the count against a Task

Enhance the UI with updateTask button as shown below.

Once the document is created, click on Edit from custom OWL, which will then launch the screen where user can record the count quantity.

After entering quantity, user clicks on updateTask button and finally clicks on Save. Close the screen.

The count document can now be seen under Physical Inventory Work Center -> By PI Count Document -> PI count “In Process” and click on Edit and navigate to Count Tasks to verify the counted quantity being filled and task in Finished Status.


3. Approve Document

In the defined BO, add a new Action by name approveTask as below:

In the updateTask ABSL, Count Document ID is stored in the custom BO. This ID would now be used to query from PhysicalInventoryCount BO and then call the Action Approve to complete the process.

Sample snippet of the code to Approve Count Document.

UI to Approve Task

Click on Edit from custom OWL and then user clicks on approveTask button and finally clicks on Save.

The count document can now be seen under Physical Inventory Work Center -> By PI Count Document -> PI Count Finished and click on Edit. Here the status of the document can be found as Finished and under Count Items the status to be as Approved.

Note: In the above blog post, all the actions in terms of creation/recording count result/approving the document are all shown as manual action. If the data volumes are high, then you can also explore the option of mass upload (For Ex: via XLS) to perform those steps. Refer to the blog Mass Upload for more details..