CL_CRM_SALES_CATEGORY_HIST - retreive the product's sales category history

Fill RESBD Structure from EBP Component Structure   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Functionality

This class is responsible to retreive all the products that had their sales category changed during a time period.

This API is working differently than the normal history retreival tools like "CRM_PRODUCT_HISTORY_GET"

Differences:

CRM_PRODUCT_HISTORY_GET Sales Category API
1) The considered validity period is the one from1)The validity period is the one on the sales category
the fragment and not the sales category 
2) The first assignment of a sales category to a2) The API consider all the values
product is not considered
3) The API does not give the possibility to filter3) The API have a parameter to filter based on
on sales organisation.sales organisation and distribution channel
4) The API needs a product guid to operate4) The product guid is determined out of the query

Relationships

This API class is taking consideration that the Sales Category is not assigned directly to a product, but rather to a "Fragment".

the relevants tables are:

comm_product - table of products

comm_category - table of the categories.

comm_pr_frg_rod - the list of fragments of a product, only the type " Sales Grouping" is needed.

comm_pr_frg_rodh - the equivalent history table for the fragments

crmm_pr_salesg: Sales Categories assigned to the fragments

crmm_pr_salesgh: history table for the sales categories assignments

Mechanisms

The following steps are executed in order, and represent the mechanism of the tables.

1) Product gets created --> No entries in comm_pr_frg_rod, nor crmm_pr_salesg

2)Product get a sales & distribution channel assigned, but no sales category

a. The table comm_pr_frg_rod is filled (withouth frament type "sales Grouping" assigned).

b. Table crmm_pr_salesg have no relevant entries

3) Assignment of a Sales Category to the product.

a. A new line is inserted in the table comm_pr_frg_rod, with fragment type "Sales Grouping"

b.a new line is inserted in the table crmm_pr_salesg, with the sales category. (Valid from now, to end of times)

4) Assignment of a different sales category to the product, with the same distribution channel.

a. the previous line in crmm_pr_salesg is removed, and moved to the table crmm_pr_salesgh (The Valid from is the current time)

b. a new line is added in crmm_pr_salesg (valid from now, to end of times).

5) The value of the sales category is cleared.

a. the previous line in crmm_pr_salesg is removed, and moved to the table crmm_pr_salesgh (The Valid from is the current time)

b. a new line is added in crmm_pr_salesg with an INITIAL guid (valid from now, to end of times).

6) Assignment of a sales category to the product

a. the previous line in crmm_pr_salesg is removed, and moved to the table crmm_pr_salesgh (The Valid from is the current time)

b. a new line is added in crmm_pr_salesg (valid from now, to end of times).

Example

Example A:

-,,Salescategory is maintained at 1. Jan. 09 to CatA

-,,Salescategory is removed at 10.Jan.09

-,,Salescategory is maintained again at the 20. Jan to Cat B

The system should output 2 entries.

- Sales Cat valid from jan 1st 2009 to 10th of jan 2009

- Sales cat valid from january 20th to end of times

Notes

Some more rules:

1) It is forbidden to delete the assignment of a sales & distribution entry once the product is saved.

2) All the sales categories maintained are belonging to the same hierarchy, which is customized as "Sales Hierarchy"

3) It is forbidden to delete a product category (from comm_hierarchy) if there is a product is assigned to it via its normal category, or sales category.

4) A product can have multiple Sales Distribution, and each can have one single Sales Category. Therefore, the relation between product and sales category is one to multiple.

5) The initial guids of the history tables are ignored as we can extract the values using the validity period.

Further information



CL_GUI_FRONTEND_SERVICES - Frontend Services   General Material Data  
This documentation is copyright by SAP AG.


Length: 5037 Date: 20120526 Time: 132307     triton ( 135 ms )