Listing 1
{
FromWarehouse: "From Warehouse code",
StockTransferLines: [
{
WarehouseCode: "Target Warehouse Code",
ItemCode: "v100001",
Quantity: 5,
BatchNumbers: [
{
BaseLineNumber: 0,
Quantity: 5,
BatchNumberProperty: "BN0001"
}
]
}
]
}
The BaseLineNumber property of the batch object refers to the index position of the current item contained within the StockTransferLines array. In the example above, the StockTransferLines array contains a single item with the index position 0. This position is used as the BaseLineNumber value for batch objects.
As mentioned, the BatchNumbers property allows you to specify an array of batch number objects. The quantities for each batch object must sum up to the total quantity at the item level as shown in listing 2 below.
Listing 2
{
FromWarehouse: "From Warehouse code",
StockTransferLines: [
{
WarehouseCode: "Target Warehouse Code",
ItemCode: "v100001",
Quantity: 10,
BatchNumbers: [
{
BaseLineNumber: 0,
Quantity: 5,
BatchNumberProperty: "BN0001"
},
{
BaseLineNumber: 0,
Quantity: 5,
BatchNumberProperty: "BN0002"
}
]
}
]
}
The final code sample below shows how to transfer multiple items with multiple batch numbers. Notice how the BaseLineNumber value for each item relates to the items index position.
Listing 3
{
FromWarehouse: "From Warehouse code",
StockTransferLines: [
{
WarehouseCode: "Target Warehouse Code",
ItemCode: "v100001",
Quantity: 10,
BatchNumbers: [
{
BaseLineNumber: 0,
Quantity: 5,
BatchNumberProperty: "BN0001"
},
{
BaseLineNumber: 0,
Quantity: 5,
BatchNumberProperty: "BN0002"
}
]
},
{
WarehouseCode: "Target Warehouse Code",
ItemCode: "v100002",
Quantity: 5,
BatchNumbers: [
{
BaseLineNumber: 1,
Quantity: 5,
BatchNumberProperty: "BN0003"
}
]
}
]
}
-
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 1
The SAP B1 Service Layer provides an API to move stock between warehouses. This article explains the construction of the JSON payload data that is posted to the StockTransfers API.
12 December 2019 - 7013 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 - 14725 views -
Introduction To SAP Business One Service Layer
An introduction to the SAP Business One Service Layer.
08 December 2017 - 10888 views