Skip to main content

Actions

The ballerinax/sap.businessone.production package exposes the following clients:

Available clients:

ClientPurpose
ClientManage SAP Business One production and MRP objects — bills of materials, production orders, resources, resource capacities and groups, routing stages, and sales forecasts — via the Service Layer OData API.

Client

The Client provides access to all production and MRP objects exposed by the SAP Business One Service Layer — bills of materials (product trees), production orders, resources, resource capacities, resource groups, resource properties, route stages, routing date calculations, and sales forecasts.

Configuration

Session credentials (businessone:SessionConfig, from ballerinax/sap.businessone)

FieldTypeDefaultDescription
companyDbstringRequiredThe SAP Business One company database to connect to
usernamestringRequiredThe SAP Business One user name
passwordstringRequiredThe SAP Business One user's password

ConnectionConfig

FieldTypeDefaultDescription
httpVersionhttp:HttpVersionhttp:HTTP_2_0The HTTP version understood by the client
http1Settingshttp:ClientHttp1SettingsConfigurations related to HTTP/1.x protocol
http2Settingshttp:ClientHttp2SettingsConfigurations related to HTTP/2 protocol
timeoutdecimal30The maximum time to wait (in seconds) for a response before closing the connection
forwardedstring"disable"The choice of setting forwarded/x-forwarded header
followRedirectshttp:FollowRedirectsRequiredConfigurations associated with Redirection
poolConfighttp:PoolConfigurationRequiredConfigurations associated with request pooling
cachehttp:CacheConfigHTTP caching related configurations
compressionhttp:Compressionhttp:COMPRESSION_AUTOSpecifies the way of handling compression (accept-encoding) header
circuitBreakerhttp:CircuitBreakerConfigRequiredConfigurations associated with the behaviour of the Circuit Breaker
retryConfighttp:RetryConfigRequiredConfigurations associated with retrying
cookieConfighttp:CookieConfigRequiredConfigurations associated with cookies
responseLimitshttp:ResponseLimitConfigsConfigurations associated with inbound response size limits
secureSockethttp:ClientSecureSocketRequiredSSL/TLS-related options
proxyhttp:ProxyConfigRequiredProxy server related options
socketConfighttp:ClientSocketConfigProvides settings related to client socket configuration
validationbooleantrueEnables the inbound payload validation functionality provided by the constraint package
laxDataBindingbooleantrueEnables relaxed data binding on the client side. nil values are treated as optional, and absent fields are handled as nilable types

Initializing the client

import ballerinax/sap.businessone.production;

configurable string serviceUrl = ?;
configurable string companyDb = ?;
configurable string username = ?;
configurable string password = ?;

production:Client b1Client = check new (
{companyDb, username, password},
serviceUrl = serviceUrl
);

Operations

Product Trees (BOM)

listProductTrees

Queries the ProductTrees collection, returning a page of bill-of-materials entities.

Parameters:

NameTypeRequiredDescription
headersListProductTreesHeadersNoPrefer header for Service Layer paging control, e.g. odata.maxpagesize=100
queriesListProductTreesQueriesNo$skip, $top, $filter, $orderby, $expand, $inlinecount, $select

Returns: ProductTreesCollectionResponse|error

Sample code:

production:ProductTreesCollectionResponse trees = check b1Client->listProductTrees(
queries = {dollarTop: 10, dollarSelect: "TreeCode,TreeType,Quantity"}
);

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#ProductTrees",
"value": [
{"TreeCode": "A00001", "TreeType": "iProductionTree", "Quantity": 1}
]
}
createProductTrees

Creates a new ProductTree (product tree/BOM) entity.

Parameters:

NameTypeRequiredDescription
payloadProductTreeYesThe product tree to create
headersmap<string|string[]>NoAdditional request headers

Returns: ProductTree|error

Sample code:

production:ProductTree created = check b1Client->createProductTrees({
TreeCode: "A00001",
TreeType: "iProductionTree",
Quantity: 1,
ProductTreeLines: [{ItemCode: "B00001", Quantity: 2}]
});

Sample response:

{
"TreeCode": "A00001",
"TreeType": "iProductionTree",
"Quantity": 1
}
getProductTrees

Retrieves a single ProductTree by its key.

Parameters:

NameTypeRequiredDescription
treeCodestringYesKey property TreeCode (Edm.String)
headersmap<string|string[]>NoAdditional request headers
queriesGetProductTreesQueriesNo$expand, $select

Returns: ProductTree|error

Sample code:

production:ProductTree tree = check b1Client->getProductTrees("A00001");

Sample response:

{
"TreeCode": "A00001",
"TreeType": "iProductionTree",
"Quantity": 1
}
deleteProductTrees

Deletes a ProductTree by its key.

Parameters:

NameTypeRequiredDescription
treeCodestringYesKey property TreeCode (Edm.String)
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->deleteProductTrees("A00001");
updateProductTrees

Partially updates a ProductTree using PATCH/MERGE semantics.

Parameters:

NameTypeRequiredDescription
treeCodestringYesKey property TreeCode (Edm.String)
payloadProductTreeYesFields to update
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->updateProductTrees("A00001", {Quantity: 2});

Production Orders

listProductionOrders

Queries the ProductionOrders collection, returning a page of production order entities.

Parameters:

NameTypeRequiredDescription
headersListProductionOrdersHeadersNoPrefer header for Service Layer paging control
queriesListProductionOrdersQueriesNo$skip, $top, $filter, $orderby, $expand, $inlinecount, $select

Returns: ProductionOrdersCollectionResponse|error

Sample code:

production:ProductionOrdersCollectionResponse orders = check b1Client->listProductionOrders(
queries = {dollarFilter: "ProductionOrderStatus eq 'boposReleased'", dollarTop: 20}
);

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#ProductionOrders",
"value": [
{"AbsoluteEntry": 101, "ItemNo": "B00001", "ProductionOrderStatus": "boposReleased", "PlannedQuantity": 10}
]
}
createProductionOrders

Creates a new ProductionOrder.

Parameters:

NameTypeRequiredDescription
payloadProductionOrderYesThe production order to create
headersmap<string|string[]>NoAdditional request headers

Returns: ProductionOrder|error

Sample code:

production:ProductionOrder order = check b1Client->createProductionOrders({
ItemNo: "B00001",
ProductionOrderType: "bopotStandard",
PlannedQuantity: 10,
DueDate: "2026-08-01",
Warehouse: "01"
});

Sample response:

{
"AbsoluteEntry": 101,
"ItemNo": "B00001",
"ProductionOrderStatus": "boposPlanned",
"PlannedQuantity": 10
}
getProductionOrders

Retrieves a single ProductionOrder by its key.

Parameters:

NameTypeRequiredDescription
absoluteEntryint:Signed32YesKey property AbsoluteEntry (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers
queriesGetProductionOrdersQueriesNo$expand, $select

Returns: ProductionOrder|error

Sample code:

production:ProductionOrder order = check b1Client->getProductionOrders(101);

Sample response:

{
"AbsoluteEntry": 101,
"ItemNo": "B00001",
"ProductionOrderStatus": "boposReleased",
"PlannedQuantity": 10
}
deleteProductionOrders

Deletes a ProductionOrder by its key.

Parameters:

NameTypeRequiredDescription
absoluteEntryint:Signed32YesKey property AbsoluteEntry (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->deleteProductionOrders(101);
updateProductionOrders

Partially updates a ProductionOrder using PATCH/MERGE semantics.

Parameters:

NameTypeRequiredDescription
absoluteEntryint:Signed32YesKey property AbsoluteEntry (Edm.Int32)
payloadProductionOrderYesFields to update
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->updateProductionOrders(101, {DueDate: "2026-08-15"});
productionOrdersCancel

Invokes the bound action Cancel on a ProductionOrder (binding type ProductionOrder).

Parameters:

NameTypeRequiredDescription
absoluteEntryint:Signed32YesKey property AbsoluteEntry (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->productionOrdersCancel(101);

Resource Capacities

listResourceCapacities

Queries the ResourceCapacities collection, returning a page of resource capacity entities.

Parameters:

NameTypeRequiredDescription
headersListResourceCapacitiesHeadersNoPrefer header for Service Layer paging control
queriesListResourceCapacitiesQueriesNo$skip, $top, $filter, $orderby, $expand, $inlinecount, $select

Returns: ResourceCapacitiesCollectionResponse|error

Sample code:

production:ResourceCapacitiesCollectionResponse capacities = check b1Client->listResourceCapacities(
queries = {dollarFilter: "Code eq 'R00001'", dollarTop: 20}
);

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#ResourceCapacities",
"value": [
{"Id": 1, "Code": "R00001", "Date": "2026-07-13", "Capacity": 8, "Type": "rctInternal"}
]
}
createResourceCapacities

Creates a new ResourceCapacity.

Parameters:

NameTypeRequiredDescription
payloadResourceCapacityYesThe resource capacity to create
headersmap<string|string[]>NoAdditional request headers

Returns: ResourceCapacity|error

Sample code:

production:ResourceCapacity capacity = check b1Client->createResourceCapacities({
code: "R00001",
date: "2026-07-13",
capacity: 8,
'type: "rctInternal"
});

Sample response:

{
"Id": 1,
"Code": "R00001",
"Date": "2026-07-13",
"Capacity": 8,
"Type": "rctInternal"
}
getResourceCapacities

Retrieves a single ResourceCapacity by its key.

Parameters:

NameTypeRequiredDescription
idint:Signed32YesKey property Id (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers
queriesGetResourceCapacitiesQueriesNo$expand, $select

Returns: ResourceCapacity|error

Sample code:

production:ResourceCapacity capacity = check b1Client->getResourceCapacities(1);

Sample response:

{
"Id": 1,
"Code": "R00001",
"Date": "2026-07-13",
"Capacity": 8
}
deleteResourceCapacities

Deletes a ResourceCapacity by its key.

Parameters:

NameTypeRequiredDescription
idint:Signed32YesKey property Id (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->deleteResourceCapacities(1);
updateResourceCapacities

Partially updates a ResourceCapacity using PATCH/MERGE semantics.

Parameters:

NameTypeRequiredDescription
idint:Signed32YesKey property Id (Edm.Int32)
payloadResourceCapacityYesFields to update
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->updateResourceCapacities(1, {capacity: 10});
resourceCapacitiesServiceGetList

Calls the ResourceCapacitiesService_GetList function import to get the full list of resource capacity parameter sets.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional request headers

Returns: inline_response_200|error

Sample code:

production:inline_response_200 result = check b1Client->resourceCapacitiesServiceGetList();

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#ResourceCapacitiesService_GetList",
"value": [
{"Code": "R00001", "Date": "2026-07-13", "Capacity": 8}
]
}
resourceCapacitiesServiceGetListWithFilter

Calls the ResourceCapacitiesService_GetListWithFilter function import to get a filtered list of resource capacity parameter sets.

Parameters:

NameTypeRequiredDescription
payloadResourceCapacitiesService_GetListWithFilter_bodyYesFilter parameters wrapping a ResourceCapacityWithFilterParams
headersmap<string|string[]>NoAdditional request headers

Returns: inline_response_200_1|error

Sample code:

production:inline_response_200_1 result = check b1Client->resourceCapacitiesServiceGetListWithFilter({
resourceCapacityWithFilterParams: {code: "R00001", 'type: "rctInternal", date: "2026-07-13"}
});

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#ResourceCapacitiesService_GetListWithFilter",
"value": [
{"Code": "R00001", "Date": "2026-07-13", "Capacity": 8}
]
}

Resource Groups

listResourceGroups

Queries the ResourceGroups collection, returning a page of resource group entities.

Parameters:

NameTypeRequiredDescription
headersListResourceGroupsHeadersNoPrefer header for Service Layer paging control
queriesListResourceGroupsQueriesNo$skip, $top, $filter, $orderby, $expand, $inlinecount, $select

Returns: ResourceGroupsCollectionResponse|error

Sample code:

production:ResourceGroupsCollectionResponse groups = check b1Client->listResourceGroups(
queries = {dollarTop: 20}
);

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#ResourceGroups",
"value": [
{"Code": 1, "Name": "Machines", "Type": "rtMachine"}
]
}
createResourceGroups

Creates a new ResourceGroup.

Parameters:

NameTypeRequiredDescription
payloadResourceGroupYesThe resource group to create
headersmap<string|string[]>NoAdditional request headers

Returns: ResourceGroup|error

Sample code:

production:ResourceGroup group = check b1Client->createResourceGroups({
name: "Machines",
'type: "rtMachine"
});

Sample response:

{
"Code": 1,
"Name": "Machines",
"Type": "rtMachine"
}
getResourceGroups

Retrieves a single ResourceGroup by its key.

Parameters:

NameTypeRequiredDescription
codeint:Signed32YesKey property Code (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers
queriesGetResourceGroupsQueriesNo$expand, $select

Returns: ResourceGroup|error

Sample code:

production:ResourceGroup group = check b1Client->getResourceGroups(1);

Sample response:

{
"Code": 1,
"Name": "Machines",
"Type": "rtMachine"
}
deleteResourceGroups

Deletes a ResourceGroup by its key.

Parameters:

NameTypeRequiredDescription
codeint:Signed32YesKey property Code (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->deleteResourceGroups(1);
updateResourceGroups

Partially updates a ResourceGroup using PATCH/MERGE semantics.

Parameters:

NameTypeRequiredDescription
codeint:Signed32YesKey property Code (Edm.Int32)
payloadResourceGroupYesFields to update
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->updateResourceGroups(1, {name: "Heavy Machines"});
resourceGroupsServiceGetList

Calls the ResourceGroupsService_GetList function import to get the full list of resource group parameter sets.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional request headers

Returns: inline_response_200_2|error

Sample code:

production:inline_response_200_2 result = check b1Client->resourceGroupsServiceGetList();

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#ResourceGroupsService_GetList",
"value": [
{"Code": 1, "Name": "Machines"}
]
}

Resource Properties

listResourceProperties

Queries the ResourceProperties collection, returning a page of resource property entities.

Parameters:

NameTypeRequiredDescription
headersListResourcePropertiesHeadersNoPrefer header for Service Layer paging control
queriesListResourcePropertiesQueriesNo$skip, $top, $filter, $orderby, $expand, $inlinecount, $select

Returns: ResourcePropertiesCollectionResponse|error

Sample code:

production:ResourcePropertiesCollectionResponse properties = check b1Client->listResourceProperties(
queries = {dollarTop: 20}
);

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#ResourceProperties",
"value": [
{"Code": 1, "Name": "Requires Certification"}
]
}
createResourceProperties

Creates a new ResourceProperty.

Parameters:

NameTypeRequiredDescription
payloadResourcePropertyYesThe resource property to create
headersmap<string|string[]>NoAdditional request headers

Returns: ResourceProperty|error

Sample code:

production:ResourceProperty prop = check b1Client->createResourceProperties({
name: "Requires Certification"
});

Sample response:

{
"Code": 1,
"Name": "Requires Certification"
}
getResourceProperties

Retrieves a single ResourceProperty by its key.

Parameters:

NameTypeRequiredDescription
codeint:Signed32YesKey property Code (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers
queriesGetResourcePropertiesQueriesNo$expand, $select

Returns: ResourceProperty|error

Sample code:

production:ResourceProperty prop = check b1Client->getResourceProperties(1);

Sample response:

{
"Code": 1,
"Name": "Requires Certification"
}
deleteResourceProperties

Deletes a ResourceProperty by its key.

Parameters:

NameTypeRequiredDescription
codeint:Signed32YesKey property Code (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->deleteResourceProperties(1);
updateResourceProperties

Partially updates a ResourceProperty using PATCH/MERGE semantics.

Parameters:

NameTypeRequiredDescription
codeint:Signed32YesKey property Code (Edm.Int32)
payloadResourcePropertyYesFields to update
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->updateResourceProperties(1, {name: "Certification Required"});
resourcePropertiesServiceGetList

Calls the ResourcePropertiesService_GetList function import to get the full list of resource property parameter sets.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional request headers

Returns: inline_response_200_3|error

Sample code:

production:inline_response_200_3 result = check b1Client->resourcePropertiesServiceGetList();

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#ResourcePropertiesService_GetList",
"value": [
{"Code": 1, "Name": "Requires Certification"}
]
}

Resources

listResources

Queries the Resources collection, returning a page of resource entities.

Parameters:

NameTypeRequiredDescription
headersListResourcesHeadersNoPrefer header for Service Layer paging control
queriesListResourcesQueriesNo$skip, $top, $filter, $orderby, $expand, $inlinecount, $select

Returns: ResourcesCollectionResponse|error

Sample code:

production:ResourcesCollectionResponse resources = check b1Client->listResources(
queries = {dollarFilter: "Type eq 'rtMachine'", dollarTop: 20}
);

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#Resources",
"value": [
{"Code": "R00001", "Name": "CNC Machine 1", "Type": "rtMachine"}
]
}
createResources

Creates a new Resource.

Parameters:

NameTypeRequiredDescription
payloadResourceYesThe resource to create
headersmap<string|string[]>NoAdditional request headers

Returns: Resource|error

Sample code:

production:Resource resource = check b1Client->createResources({
Code: "R00001",
Name: "CNC Machine 1",
Type: "rtMachine"
});

Sample response:

{
"Code": "R00001",
"Name": "CNC Machine 1",
"Type": "rtMachine"
}
getResources

Retrieves a single Resource by its key.

Parameters:

NameTypeRequiredDescription
codestringYesKey property Code (Edm.String)
headersmap<string|string[]>NoAdditional request headers
queriesGetResourcesQueriesNo$expand, $select

Returns: Resource|error

Sample code:

production:Resource resource = check b1Client->getResources("R00001");

Sample response:

{
"Code": "R00001",
"Name": "CNC Machine 1",
"Type": "rtMachine"
}
deleteResources

Deletes a Resource by its key.

Parameters:

NameTypeRequiredDescription
codestringYesKey property Code (Edm.String)
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->deleteResources("R00001");
updateResources

Partially updates a Resource using PATCH/MERGE semantics.

Parameters:

NameTypeRequiredDescription
codestringYesKey property Code (Edm.String)
payloadResourceYesFields to update
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->updateResources("R00001", {Name: "CNC Machine 1 (Refurbished)"});
resourcesCreateLinkedItem

Invokes the bound action CreateLinkedItem on a Resource (binding type Resource), creating the linked inventory item for the resource.

Parameters:

NameTypeRequiredDescription
codestringYesKey property Code (Edm.String)
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->resourcesCreateLinkedItem("R00001");
resourcesServiceGetList

Calls the ResourcesService_GetList function import to get the full list of resource parameter sets.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional request headers

Returns: inline_response_200_4|error

Sample code:

production:inline_response_200_4 result = check b1Client->resourcesServiceGetList();

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#ResourcesService_GetList",
"value": [
{"Code": "R00001"}
]
}

Route Stages

listRouteStages

Queries the RouteStages collection, returning a page of route stage entities.

Parameters:

NameTypeRequiredDescription
headersListRouteStagesHeadersNoPrefer header for Service Layer paging control
queriesListRouteStagesQueriesNo$skip, $top, $filter, $orderby, $expand, $inlinecount, $select

Returns: RouteStagesCollectionResponse|error

Sample code:

production:RouteStagesCollectionResponse stages = check b1Client->listRouteStages(
queries = {dollarTop: 20}
);

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#RouteStages",
"value": [
{"InternalNumber": 1, "Code": "S1", "Description": "Cutting"}
]
}
createRouteStages

Creates a new RouteStage.

Parameters:

NameTypeRequiredDescription
payloadRouteStageYesThe route stage to create
headersmap<string|string[]>NoAdditional request headers

Returns: RouteStage|error

Sample code:

production:RouteStage stage = check b1Client->createRouteStages({
code: "S1",
description: "Cutting"
});

Sample response:

{
"InternalNumber": 1,
"Code": "S1",
"Description": "Cutting"
}
getRouteStages

Retrieves a single RouteStage by its key.

Parameters:

NameTypeRequiredDescription
internalNumberint:Signed32YesKey property InternalNumber (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers
queriesGetRouteStagesQueriesNo$expand, $select

Returns: RouteStage|error

Sample code:

production:RouteStage stage = check b1Client->getRouteStages(1);

Sample response:

{
"InternalNumber": 1,
"Code": "S1",
"Description": "Cutting"
}
deleteRouteStages

Deletes a RouteStage by its key.

Parameters:

NameTypeRequiredDescription
internalNumberint:Signed32YesKey property InternalNumber (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->deleteRouteStages(1);
updateRouteStages

Partially updates a RouteStage using PATCH/MERGE semantics.

Parameters:

NameTypeRequiredDescription
internalNumberint:Signed32YesKey property InternalNumber (Edm.Int32)
payloadRouteStageYesFields to update
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->updateRouteStages(1, {description: "Cutting (updated)"});
routeStagesServiceGetList

Calls the RouteStagesService_GetList function import to get the full list of route stage parameter sets.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional request headers

Returns: inline_response_200_5|error

Sample code:

production:inline_response_200_5 result = check b1Client->routeStagesServiceGetList();

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#RouteStagesService_GetList",
"value": [
{"InternalNumber": 1, "Code": "S1", "Description": "Cutting"}
]
}

Routing Date Calculation

routingDateCalculationServiceCalculate

Calls the RoutingDateCalculationService_Calculate function import to compute a resulting date/proportion for a routing stage over a given resource and date range.

Parameters:

NameTypeRequiredDescription
payloadRoutingDateCalculationService_Calculate_bodyYesWraps a RoutingDateCalculationInput with the resource code, capacity sum, and date range
headersmap<string|string[]>NoAdditional request headers

Returns: RoutingDateCalculationOutput|error

Sample code:

production:RoutingDateCalculationOutput result = check b1Client->routingDateCalculationServiceCalculate({
routingDateCalculationInput: {
resourceCode: "R00001",
capacitySum: 16,
calculateFromDate: "2026-07-13",
calculateUntilDate: "2026-07-20",
resourceAlloc: "raStartDateForwards"
}
});

Sample response:

{
"Proportion": 0.5,
"ResultDate": "2026-07-15"
}

Sales Forecasts

listSalesForecast

Queries the SalesForecast collection, returning a page of MRP sales forecast entities.

Parameters:

NameTypeRequiredDescription
headersListSalesForecastHeadersNoPrefer header for Service Layer paging control
queriesListSalesForecastQueriesNo$skip, $top, $filter, $orderby, $expand, $inlinecount, $select

Returns: SalesForecastCollectionResponse|error

Sample code:

production:SalesForecastCollectionResponse forecasts = check b1Client->listSalesForecast(
queries = {dollarTop: 20}
);

Sample response:

{
"odata.metadata": "https://host:50000/b1s/v1/$metadata#SalesForecast",
"value": [
{"Numerator": 1, "ForecastCode": "FC2026", "ForecastName": "2026 Forecast", "View": "fvtMonthly"}
]
}
createSalesForecast

Creates a new SalesForecast.

Parameters:

NameTypeRequiredDescription
payloadSalesForecastYesThe sales forecast to create
headersmap<string|string[]>NoAdditional request headers

Returns: SalesForecast|error

Sample code:

production:SalesForecast forecast = check b1Client->createSalesForecast({
ForecastCode: "FC2026",
ForecastName: "2026 Forecast",
ForecastStartDate: "2026-01-01",
ForecastEndDate: "2026-12-31",
View: "fvtMonthly",
SalesForecastLines: [{ItemNo: "B00001", Warehouse: "01", Quantity: 100, ForecastedDay: "2026-08-01"}]
});

Sample response:

{
"Numerator": 1,
"ForecastCode": "FC2026",
"ForecastName": "2026 Forecast",
"View": "fvtMonthly"
}
getSalesForecast

Retrieves a single SalesForecast by its key.

Parameters:

NameTypeRequiredDescription
numeratorint:Signed32YesKey property Numerator (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers
queriesGetSalesForecastQueriesNo$expand, $select

Returns: SalesForecast|error

Sample code:

production:SalesForecast forecast = check b1Client->getSalesForecast(1);

Sample response:

{
"Numerator": 1,
"ForecastCode": "FC2026",
"ForecastName": "2026 Forecast",
"View": "fvtMonthly"
}
deleteSalesForecast

Deletes a SalesForecast by its key.

Parameters:

NameTypeRequiredDescription
numeratorint:Signed32YesKey property Numerator (Edm.Int32)
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->deleteSalesForecast(1);
updateSalesForecast

Partially updates a SalesForecast using PATCH/MERGE semantics.

Parameters:

NameTypeRequiredDescription
numeratorint:Signed32YesKey property Numerator (Edm.Int32)
payloadSalesForecastYesFields to update
headersmap<string|string[]>NoAdditional request headers

Returns: error?

Sample code:

check b1Client->updateSalesForecast(1, {ForecastName: "2026 Forecast (Revised)"});

Session

logout

Ends the active SAP Business One Service Layer session.

Parameters:

None

Returns: error?

Sample code:

check b1Client->logout();