User Exit for Shop Floor Info System
In the statistics update from the production orders, only data from the 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 '001'.
- Defining the new data as fields in the ABAP/4 Data Dictionary.
The fields have to be included in the user structures provided. They are as follows: MCAFKOUSR (order header data), MCAFPOUSR (order item),
MCAFVGUSR (order operation), MCCOMPUSR (material components) and/or MCKALKUSR (cost itemization) You can use append structures to do this.
- Determining the new fields in the user exits
Data from the production orders is made available to determine the field contents:
- XMCAFKO, structure MCAFKOB (order header data)
- XMCAFPO, structure MCAFPOB (order item)
- XMCAFVG, structure MCAFVGB (order operation)
- XMCCOMP, structure MCCOMPB (material components)
- XMCKALK, structure MCKALKB (cost itemization)
- X_STAT, structure MCFSTATUS (individual status for each object, sorted)
- CONTROL, structure MCCONTROL (control parameter, for example to check whether normal updating or the setup of statistical data is required)
In addition the point in time (PA up to PF) at which you just called up
the Shop Floor Information System 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 user 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, and 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 use 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. If SUPKZ = '1', this means that the old document data is now being processed. If SUPKZ = '2', this means that the new document status is available.
LOOP AT xmcafko.
CALL FUNCTION xy ...
xmcafko-... = ...
LOOP AT xmcafvg.
* Pr・en, ob Vorgang den Status FREI hat
READ TABLE x_stat WITH KEY
supkz = xmcafvg-supkz
objnr = xmcafvg-objnr
stat = 'I0002' " Status FREI, siehe Tabelle TJ02
inact = space
IF sy-subrc EQ 0. " Status ist FREI
- EXIT_SAPLMCF2_001: User Exit for Shop Floor Info System