Capturing Changes in OM Infotypes
Changes to the OM infotypes can be retrieved using standard function module ‘RH_CDOC_READ’, but before using this function module, to ensure that the changes are logged in for OM infotypes, customization needs to be done using table through SM30.
Below is the step-by-step procedure on what needs to be done to retrieve OM infotype changes:
- For this enter table T77CDOC_CUST, and press maintain to create new entries for which the change s will be logged in the change tables.
2. Create the entries for the OM infotypes for which you need to capture change data in the change document tables as below:
- Object type need to be specified if you want to log data for specific object types, for eg. O (organization unit), S (position), C (job code), etc. To log entries of all object type save ‘*’.
- Infotype column specifies for which OM infotypes, log need to be maintained.
- Subtype refers to the subtype of the corresponding infotype.‘*’ takes all subtypes into consideration.
3. To cross check that our configuration has been successfully implemented, run the report RHCDOC_DISPLAY (Display Change Documents) through se38 as follows:
Executing will give you the changes in OM infotypes that occurred within specified date in the alv as below:
4. This output is generated from standard SAP program, however sometimes we need to develop a custom program which contains customer specific fields apart from the field in report output, or want a outbound file in some specific format (say .csv). In such cases we need to write a custom code for retrieving the changes.
We can use SAP standard function module ‘RH_CDOC_READ’ to get the change result into internal tables of type CDHDR and CDPOS, and then other derails can be fetched out looping across these internal tables:
Here, changes are logged into internal tables gt_cdhdr and gt_cdpos which are table type of CDHDR and CDPOS.
5. On testing the function module above for object type ‘S’ and some date range, the below output is received:
This function module is particularly important to get the changes from OM infotypes for a particular period and then getting other required details so as to get any required information.
I have attached the program with appropriate comments which uses the above function module to get the details in an alv format, however this can also be used to get the outbound file generated in the application server using ‘OPEN DATASET’ statement.
Selection screen and output screen shot of the program is below:
I have been searching for this content for quite sometime and finally my search is over with this document. 🙂
Very informative and elaborative.
Thanks a lot, Vineet !!! 🙂
Thanks Sapeksh for kind comments.
I am glad that my document helped you.. 🙂
Thank you Vineet.
We have been experiencing some problems with ALE and the triggers of change pointers and this article is quite helpfull in understanding and maybe creating a good workaround for our problems. Thanks Vineet.
Thanks a lot vineet.
Its very informative and easily explained.