Example: Import Products
This example shows how to import items from Perfion to SAP B1.
Prerequisites
This examples requires 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
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
Perfion Query
You first need to specify a Perfion Query to fetch products from Perfion. Using the API Query tool in the Perfion Windows client is the easiest way of building the correct query.
In order to keep performance good, it is recommended to only fetch the features that you actually need to synchronize to SAP B1. That means that you should be careful using the **- or *-mappings in your Select part of the query.
Next, you to identify which products from Perfion you need to synchronize. Often, you do not want Virtual products, which in the query below is filtered out using the “Brand = Normal” clause. This ensures that only Normal (not Virtual) product are fetched.
Depending on how your workflow in Perfion is setup, you might also have various status features that needs to be checked or have certain values before a product is ready to be synchronized to SAP. In the example below, we have a Boolean feature in Perfion “ApprovedSAP” that need be checked before a product can be synchronized to SAP.
Finally, to save performance, we only find product that has modified date later than the last time the import ran. We can specify this with the speciel attribute [%LastImport] which contains the date and time of the last time the synchronization successfully ran.
You can test the query by click “Test query” and then inspect the result
<Query>
<Select languages='EN'>
<Feature id='ItemName' />
<Feature id='lookupERPCategory' />
<Feature id='SupplierRRP' />
<Feature id='Barcode' />
</Select>
<From id='100' />
<Where>
<Clause id='ApprovedSAP' operator='HAS' />
<Clause id='Brand' operator='=' value='Normal' />
<Clause id='modifiedDate' operator='>' value='[%LastImport] ' />
</Where>
</Query>
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 import products to the Items table in SAP B1, we need to map to the oItems ObjectType by the IItems interface.
The most important Field on this table is the ItemCode which is the Primary of the Items tabes and needs to be marked as “Is Primary Key”. Looking at the screen shot of the example result above, we can see that the ItemCode would match the Value field from Perfion (the value of the base feature Product). Therefore we map the ItemCode to Value in the XPath field.
Then we map the ItemName to the english ItemName from the result, hardcode the ItemGroupCode to 107 and map the BarCode field in SAP to the Barcode field in the result.
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