/
Example: Import Bill of Materials

Example: Import Bill of Materials

This example shows how to import bill of material from Perfion to SAP B1.

The most common way of implementing a bill of material in Perfion is using a Swap Relation Table feature.

This example assume you have a feature on the Product configuration with swapped relation to model af Bill of materials.

Prerequisites

This examples requires that the Perfion Extension of B1 Usability Package has been correctly configured.
Follow this guide to configure the Perfion Add-in and the Release2ERP modules Release2ERP for SAP Business One.

It is also recommended that you first setup a query that fetches all the products that you need to synchronize. This will ensure that the product you reference in your bill of materials have been created first. Otherwise the synchronization will fail as SAP can not add products to a bill of material, if the product does not exist

Downloadable example

The below file can be downloaded and imported into SAP B1 by navigating to Administration > Add-Ons > B1 Usability Package > Module configuration > Perfion Extension > Import Setups, then clicking “Import” and selecting the directory in which you saved the file.

How to Setup

First navigate to Administration > Add-Ons > B1 Usability Package > Module configuration > Perfion Extension > Import Setups

Query

There are several ways of querying a swapped relation table from Perfion. You can select directly from the feature (BillOfMaterials in our example) or you can do it directly from the Product feature using the type='Relation' option. For Release2ERP for SAB B1 it is recommended to do it from the Product. This will ensure:

  1. You have the metadata you need for the BillOfMaterial

  2. You only get the bill of materials for products that you have approved for SAP B1

In this example, I have also created a remote feature in Perfion (HasBOM) that ensures that the query will only find products that actually have a bill of material.

In the example result below we can see that each item in the bill of material, we can BillOfMaterials element that contains the BillOfMaterialsProduct which is the child item of the bill and the BillOfMaterialsQTY which is the quantity of that child item in the bill.

You can test the query by click “Test query” and then inspect the result.

image-20250212-132712.png
Using the type='Relation' option will ensure that the swapped relation feature BillOfMaterials will be expanded in the result
<Query> <Select languages='EN' view='Normal'> <Feature id='BillOfMaterials' view='Item' type='Relation' /> </Select> <From id='Product' /> <Where> <Clause id='ApprovedSAP' operator='HAS' /> </Where> <Having> <Clause id='HasBOM' operator='HAS'/> </Having> </Query>
image-20250212-132949.png
Example result

Mappings

Now we need to map the data from the Perfion Query to the fields and tables in SAP. https://biuan.com is a useful ressource for information about the tables and objects in SAP B1.

First, we must specify the Record root node, where we can find the product data in the result. Looking at the example result above, we can find the data at //Data/Product

To map to a bill of material in SAP we at least two mappings

  1. TreeCode of the ObjectType oProductTrees by the IProductTrrees interface - This is the parent product

  2. ItemCode of the ObjectType oProductTrres bu the IProductTrrees_Lines interface - This is the child product

In this example, we also map the quantity of child items on the bill of materials. As the result as seen above contains multuple items, we need to use the [%enumerator] attribute to ensure we get each of the BillOfMaterials elements.

Remember to the “Enabled” for all of the mappings, you to have enabled.

Importing & Scheduling

To start the import, go to Administration > Add-Ons > B1 Usability Package > Module configuration > Perfion Extension > Manual Import, select the import from the list and click Import

See Release2ERP for SAP Business One for how to the Schedule the Import

Related content

Example: Import Products
Example: Import Products
More like this
Release2ERP for SAP Business One
Release2ERP for SAP Business One
More like this
ERP Add-in for SAP Business One
ERP Add-in for SAP Business One
More like this
ERP Add-in for SAP ECC / S4Hana
ERP Add-in for SAP ECC / S4Hana
More like this
Feature Data Import Examples
Feature Data Import Examples
More like this
Remotes for SAP
Remotes for SAP
More like this