Warehouse To Warehouse
The simplest type of stock transfer is warehouse to warehouse that are not bin enabled as the payload data is easier to construct. The data must contain one or more stock transfer lines At the very minimum each line must contain an ItemCode, the Quantity to transfer and the WarehouseCode the item is being transferred to. Listing 1 below shows a sample JSON payload that also includes the FromWarehouse, which as you would expect defines the warehouse the stock is transferring from.
Listing 1
POST https://localhost:50000/b1s/v1/StockTransfers
{
FromWarehouse: "From Warehouse code",
StockTransferLines: [
{
ItemCode: "v100001",
Quantity: 100,
WarehouseCode : "Target Warehouse Code",
}
]
}
Warehouse To Bin Enabled Warehouse
Stock can be transferred to a bin enabled warehouse by specifying the bin location using the StockTransferLinesBinAllocations property for each item. This property contains an array of one or more bins that the item should be transferred to. The bin object must contain the bin abs entry, the quantity to move and an enum action type. The action type indicates the to/from warehouse movement. The sample code below will help make this a little clearer.
Listing 2
{
FromWarehouse: "From Warehouse code",
StockTransferLines: [
{
ItemCode: "v100001",
Quantity: 100,
StockTransferLinesBinAllocations : [
{
BinAbsEntry : 35369,
Quantity : 100,
BinActionType : 1
}
]
}
]
}
The sample payload data above specifies that 100 units of item v100000 should be transferred to bin location 35369 using action type 1, which means the item is moving to the target warehouse. In the previous code sample in listing 1, the target warehouse is explicitly set using the property WarehouseCode. In this example however the target warehouse is determined by the bin location abs entry.
Lets take a look at another example. The following payload data in listing 3 below shows how to transfer stock for one item to multiple bins. Notice that the total quantity 200 is split between the two bins. When specifying multiple bins, the total quantity for all bins must add up to the total quantity at the item level. Omitting the item level Quantity property will result in an error.
Listing 3
{
FromWarehouse: "From Warehouse code",
StockTransferLines: [
{
ItemCode: "v100001",
Quantity: 200,
StockTransferLinesBinAllocations : [
{
BinAbsEntry : 35369,
Quantity : 100,
BinActionType : 1,
},
{
BinAbsEntry : 35370,
Quantity : 100,
BinActionType : 1,
}
]
}
]
}
The last example below shows a payload that contains multiple items with one ore more bins.
Listing 4
{
FromWarehouse: "From Warehouse code",
StockTransferLines: [
{
ItemCode: "v100001",
Quantity: 200,
StockTransferLinesBinAllocations : [
{
BinAbsEntry : 35369,
Quantity : 100,
BinActionType : 1,
},
{
BinAbsEntry : 35370,
Quantity : 100,
BinActionType : 1,
}
]
},
{
ItemCode: "v100002",
Quantity: 10,
StockTransferLinesBinAllocations : [
{
BinAbsEntry : 35369,
Quantity : 10,
BinActionType : 1,
}
]
}
]
}
Summary
In this article I explained how to do simple stock transfers from warehouse to warehouse and warehouse to bin enabled warehouses. In Stock Transfer Part 2, I'll explain how to construct the payload data for batch managed items.
-
php-sapb1-v2 Library Documentation v2
This library has been updated and includes bug fixes from V1.
07 November 2024 - 166 views -
Stock Transfer Part 2
In the previous article I exaplined how to transfer stock between warehouses and bin enabled warehouses. In this article, I discuss how to transfer batch enabled items.
07 August 2020 - 4427 views -
php-sapb1 Library Documentation v1
A simple and easy to use PHP library for SAP Business One Service Layer API.
16 August 2019 - 8965 views -
node-sapb1 Library Documentation v1
This article provides documentation on the SAPb1 NodeJs library.
01 August 2019 - 8625 views -
PHP Service Layer Example Part 2
This article is part 2 of PHP Service Layer Example. In the previous article, I explained how to initiate an authentication request to get a Service Layer session id and route id. In this article we use these details to execute a request to retrieve a list of business partners.
25 January 2018 - 10919 views -
PHP Service Layer Example Part 1
This article explains how to get connected to the Service Layer using PHP.
09 January 2018 - 14724 views -
Introduction To SAP Business One Service Layer
An introduction to the SAP Business One Service Layer.
08 December 2017 - 10888 views