User Exits: Materials Mgmt. (Purchasing)
For updating in the Purchasing Information System, only data from the purchasing documents themselves is used as a rule.
If you wish to make use of additional data for the statistics update that is not contained in the documents, then you can determine this data via the user exit EXIT_SAPLEINS_001.
- Using append structures to define the new data as fields in the ABAP Data Dictionary.
The fields have to be included in the user structures provided. They are as follows: MCEKKOUSR (data for the purchasing document header),
MCEKPOUSR (purchasing document item), MCEKETUSR (purchasing document schedule lines), MCEKPVUSR (shipping data).
- Determining the new fields in the user exits
Data from the purchasing documents is made available to determine the field contents:
- XMCEKET structure MCEKETB (schedule line data)
- XMCEKKO structure MCEKKOB (header data)
- XMCEKPO structure MCEKPOB (item data)
- T_EKKN structure EKKN (if you have included account assignment
data in the user structures you can use the
data from T_EKKN toupdate the data)
- XMCEKPA structure MCEKAB (partner information)
- XMCEKPV structure MCEKPVB (shipping data)
- XMCEKKN structure MCEKKNB (account assignment data)
- XMCESLL structure MCESLLB (serice data)
In addition, the business event (MA, MB ...) which caused the Purchasing Information System to be called up is also transferred.
- Field catalogs
You need to include the new fields in field catalogs so that they can be used in the definition of info structures.
You need to consider the following problems when using this function exit:
Updating changed documents
When document changes take place, the application always provides two types of data:
- The document data corresponding to the document status before the change
- The document data from after the change
In the case of the data from before the document change, the statistics update takes back the statistical data that was originally updated (a negative posting). The system then uses the data from after the document change to carry out the normal statistics update.
If you now employ a function exit to determine additional data, then you have to ensure that this data has not been changed since the last change due to document changes, or you need to ensure that you can also determine the old statuses of the data. You can recognize whether the
old statuses have been processed by looking at the field SUPKZ in the structures provided.
SUPKZ can have the following values:
- SUPKZ = '1'. This means that the old document data is now being processed.
- SUPKZ = '2'. This means that the new document status is available.
- EXIT_SAPLEINS_001: User Exit to Populate Communication Structure, Purchasing Info. System