Example: Insert and replace ATP inventory

We can insert and replace your ATP inventory using the Data Load utility. This example uses a CSV file to demonstrate how to insert and replace your ATP inventory information.

This example uses a CSV file to demonstrate how to insert, replace, or delete your data. We can also create and use an XML formatted file to insert, replace, or delete your data. If you choose to create and use an XML formatted file, ensure that your XML elements use the same names as are used for CSV column names.

Use the Data Load utility to load ATP inventory configuration data into the database. The data can be inserted or replaced in BASEITEM, BASEITMDSC, STOREITEM, DISTARRANG, ITEMVERSN, ITEMSPC, VERSIONSPC table.

The ATP inventory configuration data are typically loaded together with catalog entry data in a single CSV file for initial loading, because each ATP inventory configuration data is related to a catalog entry record in the database. In this case, CatalogEntryMediator is used to load data.

In another case, catalog entry data are initially loaded by CatalogEntryMediator without ATP inventory configuration data, so default ATP inventory configuration data are loaded in to database. If user wants to modify the ATP inventory configuration data after that, FulfillmentPropertyMediator can be used to load only ATP inventory configuration data without impact to existing catalog entry data.


Prerequisites

Before you run this example, ensure that the inventory system is ATP. For example, check STORE table to make sure INVENTORYSYSTEM=-1

CSV file with sample ATP inventory configuration data

In this example, the data source is a CSV file named ATPconfig.csv. The file contains sample ATP inventory configuration data. Each column is delimited by a comma.

CSV file with sample data

PartNumber ParentPartNumber Type INVQuantityMeasure INVQuantityMultiple TrackingInventory BackOrderable ReleaseSeparately Creditable ForceBackorder ReturnNotDesired MinQTYForSplit PickingMethod Discontinued CatEntryStoreIdentifier
Example-PN-10001 Product C62 2 N N Y N Y Y 10 L Y 10701
Example-PN-10002 Example-PN-10001 Item C62 2 N N Y N Y Y 10 L Y

Note: If the catalog entry data is not loaded to the database, the ATP inventory configuration data must be loaded together with catalog entry data in a single source CSV file, in such case, this table is part of the CSV file for the catalog entry data load. If the catalog entry data existed in database, ATP inventory configuration data in above table can be loaded separately.


CSV column and XML element definitions

Other optional fields not included in the example:


Business context data

The following code snippet from the wc-dataload-env.xml configuration file provides the business context data necessary for loading the data:


Mapping data

The following snippet from the sample configuration file demonstrates how to map each column of data in the source CSV file to a value. If the ATP inventory configuration data is loaded together with catalog entry data in a single source CSV file, the following mapping must be incorporated into the configuration file. If only ATP inventory configuration data is loaded, the following mapping information must be defined in an individual configuration file.

The following snippet from the sample configuration file demonstrates how to map each column of the data in the CSV file to a business object logical schema path. The attribute 'value' represents the name of a column of the CSV file, which is defined in the configuration snippet. Each column in the CSV file must have a mapping to the logical schema path.


Business object mediator

If the ATP inventory configuration data in this sample are loaded together with catalog entry data, the mediator class name is com.ibm.commerce.catalog.dataload.mediator.CatalogEntryMediator. If the ATP inventory configuration data are loaded separately, the mediator class name is com.ibm.commerce.catalog.dataload.mediator.FulfillmentPropertyMediator. The corresponding logical schema is CatalogEntry.xsd.

Note: When we use a mediator that is provided with WebSphere Commerce with the Data Load utility, the utility assumes that we are loading data for all columns for a business object. To update the data in only specific columns, configure a column exclusion list for the load process. A column exclusion list causes the Data Load utility to ignore specific columns during the load operation. If you do not use a column exclusion list, the utility updates all columns in the row of a database table row when the utility updates the row. If no value is set in the input file, the utility can replace the existing column value with a default value or set the value to be null. See Configure a column exclusion list.