Monday, April 18, 2011

Using SAP MDM for number generation

Using SAP MDM for number generation

MDM Solution landscape-
MDM is integrated with ECC using XI in a CMDM scenario, Enterprise Portal is used as UI and we have an Approval workflow for new creations as well as edit requests. Requirement is to generate the numbering from SAP MDM for any newly created records. Users are not allowed to create any new record in ECC directly. MDM offers 2 standard ways(A & B) for generating numbers- 
A.    Define a calculated field based on Auto ID to match the number ranges defined in ECC
To illustrate in ECC for different material type we have a different number ranges assigned. This can be replicated in MDM by defining a calculated field Material number and the calculation expression will be (Auto ID+100000000-1). This will ensure that Materials created in MDM are matching the ECC number range. The above expression can be changed using conditions (If then else) IF (Mat Type='PROD', Auto ID+100000000-1, Auto ID+200000000-1).This can be further nested if we have more material types and they have different numbering ranges in ECC. 
Key challenges faced:
•1.    Losing the numbers on performing a match base search from Portal-
Since we are using EP as the user interface JAVA APIs are used for connecting to MDM repository. Requestor logs in portal, does a search for the record based on matching strategy defined in MDM. Duplicates can be found against both records that exist in repository as well records that do not exist in the repository (empty record).There are two API available for executing the matching strategy in MDM and for continuity of numbers driven by MDM we should use the 2nd API.
•a.     ExecuteMatchingStrategyCommand (for records that are present in the repository)-
This inserts a record in MDM with the calculated field on which the matching strategy is run. After getting the duplicate results the inserted record is deleted. In the process we lose a number in MDM.
•b.     ExecuteMatchingStrategyForNewRecordValuesCommand (for new Records that are not present in the repository)-
This API will not insert a record in MDM repository and hence the numbers will not be lost. Limitation for using this API- Will not work if we have any calculated field in the MDM data model which is also part of the Matching strategy

•2.    Initial data loads for already existing data present in ECC to MDM. 
Since the numbers have to be matched utmost care is required during data migration. Let me explain this with some examples-
  • a. ECC has materialsin range100000- 199999 and say there are some missing numbers in production. After 100007 we have next material as 100012 in ECC.
  • b. to replicate this in MDM we need to insert 5 dummy records in MDM from 100008 to 100011 so that nubers in MDM matches with ECC
B. Use of Key generation property for the ECC remote system. 
This means the numbers will be generated when the records are syndicated to ECC from MDM and it will also update the remote key mapping in data manager. See the following blog for more details.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/807ce1ba-94c0-2a10-a398-afdfd8135ebd?QuickLink=index&overridelayout=true
This has limitations since the number generated are not directly visible in record details but can be seen only via edit key mapping. 
Suggested Way: Instead we can define the Material Number field as Text and from EP we do a RFC lookup in ECC to get the number depending upon Material Type which can be assigned to the text field in MDM. This way we don't lose any numbers because of search (Matching based) conducted from Portal UI and synchronizing the numbers between ECC and MDM for initial data loads can be managed very easily.

No comments:

Post a Comment