LOADING of ASSORTMENTS using BAPI from BODS
20 October 2020

1. Introduction
An assortment is an object to which articles are allocated for a clearly defined time frame that is an assortment decides if a store, a distribution centre or a customer can receive certain articles at a certain period of time.
An Assortment
- Determines the articles that may be sold in a store at POS.
- Adding these articles to the article assortment that is assigned to this store’s distribution centre.
- Determines the distribution centres via which articles are distributed when stores are to be supplied from the warehouse.
- Determines the stores in which articles are to be sold at the point of sale.
- Determines the articles which are to be included in the customer‘s assortments.
2. Type of Assortments
Articles are assigned to assortment module either automatically or manually depending on type of assortment module used. There are two types of assortments: Local and General.
- Local Assortments: Local assortment can be type A and type B. Type A is for stores and type B is for distribution centres. When user creates a site the system automatically creates a local assortment and then assigns it to the site. This local assortment is site-specific and cannot be assigned to another site. Each site has one local assortment created directly and can only be maintained in limited way in Assortment Processing transaction.
- General Assortments: General assortments are type C assortments. They can be assigned to any number of Customers, and every Customer can be assigned several general assortments. If multiple assignments parameter has been set in Customizing, user can also use assortments of this type to assign stores and distribution centres.
3.Creation of General Assortments
Assortment for general purpose that is of type C needs to be created manually with transaction WSOA1.
Fig 1 Create assortment
Let us see how to create an assortment (ASS001) using WSOA1 transaction code.
There are 4 tabs which can be used to define an assortment. They are Basic data, Languages, Material group and Assortment users and correspondingly 4 tables in SAP WRS1, WRST, WRS6 and WRSZ.
Fig 2 basic data in assortment
For general assortment we need to provide Sales Organization, Distribution channel and selection of listing procedure is important .The table associated with creation of assortment in Sap is WRS1.
Fig 3 wrs1 table in sap
Language tab is used to maintain the description of the assortment and the language used.
fig 4 languages
This will get updated in WRST table in SAP.
fig 5 wrst table in sap
In Mat. Groups tab, material groups which can be assigned to a particular assortment can be added. Any number of material groups can be included here.
fig 6 mat. groups
WRS6 table in SAP gets updated when each material group are added here.
fig 7 wrs6 table in sap
Assortment users determine the site or the store that belongs to a particular assortment.
Fig 8 Assortment Users
WRSZ is the table associated with assortment users.
Finaly by listing articles to assortments, you determine which assortments and, therefore, which articles a store can buy and sell which means a site cannot buy or sell articles that are not included in any of its Assortments.
4. Loading of general Assortment using BODS
The function module BAPI_ASSORTMENT_MAINTAINDATA can be used to load data from BODS. This function module can be used create new assortment and change or delete existing material master data In order to delete e a data record 003 needs to be provided in the function field in the relevant structure.
fig 9 bapi_assortment_maintaindata from se37
Job in BODS for creating Assortments as shown in figure below.
fig 10 job for assortment from bods
Jobs are designed as like RDS jobs.
The first 4 conditional blocks are for loading the corresponding data into 4 staging tables from source files.
Each conditional flow is designed in such a way that it consists of 3 Data Flows for Mapping from source file, Validation and final one for Enrichment.
fig 11 data flow
fig 12 mapping from source file
fig 13 validation
fig 13 enrichment
The data from 4 staging tables are mapped to BAPI_ASSORTMENT_MAINTAINDATA using the flow as shown below.
fig 14 mapping to bapi
fig 14. a . query combine
fig 14 . b . query_generatebapi
After the execution of job Assortment are created and WRS1, WRS6, WRST and WRSZ are the tables which are getting updated.
fig 15 wrs1 table in sap
fig 16 wrs6 table in sap
fig 17 wrst table in sap
fig 18 wrsz table in sap
Pre load and Post load jobs can also be created from BODS for further validation.
- Preload Reports: Here the source file is compared with the final data in the staging table after enrichment. For each table in Sap which is getting updated there are 2 Data flows.
fig 19 preload reports flow
In the first Data flow is mapping the source file to staging table.
fig 20 mapping of source file
Second data flow is comparing the enriched data from the main job with the source file using join condition to generate preload reports
fig 21 generation of preload reports
fig 22 preload report for loading into wrs1
fig 23 preload report for loading into wrs6
fig 24 preload report for loading into wrst
fig 25 preload report for loading into wrsz
- Post Load Reports: Here the data which is loaded into SAP tables are compared with data used for loading.
fig 26 post load report flow
First we need to extract corresponding data from WRS1 .WRS6.WRST AND WRSZ .
Fig 27 Extraction data from SAP tables
Next we need to compare these tables with data loaded using IDOCs.
fig 28 generation of post load reports
fig 29 post load report for wrs1
fig 30 post load report for wrs6
fig 31 post load report for wrst
fig 32 post load report for wrsz