Let's discus following scenarios with MM standard transactions:
When you open one of the MM t-codes like ME22N, ME51N or MIGO you see that always you got on the screen one of the latest open document there. Sometimes not last but one of the lasts and you want to make it always last.
You create MM documents using BAPI and you want that next time you open MM t-code which is used to display/edit this document then your document appears on the screen (of course if in the meantime user haven't created anything new)
You have created your own transaction to handle standard process, like creation of purchase orders or purchase requisitions. This transaction is used only in some special occasion like only in case of account assignment category is equal to 'A'. In such case for all documents which are created by your Z-transaction you've set up in user-exit that when standard transaction is called, then you leave it to your Z-transaction. In this case often MM transactions remembers last opened document, which was created by Z-transaction and at each run it will leave to it, so you want to clear the info about last called document from standard t-code.
You want to clear some default settings for the user (or set them) for standard t-code. This could be default value for some fields or toggle status of the section (for example header always expanded, items always collapsed.
- ESRUO (MM: Recently Used Objects)
- ESDUS (MM: Dynamic User Settings)
- ES_READ_USER_OBJECTS
- ES_APPEND_USER_OBJECTS
- ES_DELETE_USER_OBJECTS
- ES_SAVE_USER_OBJECTS
- ES_READ_USER_SETTINGS
- ES_APPEND_USER_SETTINGS
- ES_SAVE_USER_SETTINGS
- ES_DELETE_USER_SETTINGS
Firstly I will focus on ESROU table and OBJECTS FM as this one is easier to understand. So ESROU table contains last used MM objects used by each user. Objects are stored by it's BUS object name, so for example last used purchase orders are kept with key USERNAME BUS2012. So if you have a need then you can easily check and use last used objects for each user.
Let's go more in details for the OBJECTS FM. First one ES_READ_USER_OBJECTS will return you a table with a list of last used object for given user or if parameter IUNAME is not passed then for current user. Two additional parameters MAXANZ and MAXSTORE are responsible for clearing ESRUO table, if number of entries in ESRUO for given object will be GE than MAXANZ then clearing process will be run. In such case timestamp from line at MAXSTORE position will be used to delete older entries.
call function 'ES_READ_USER_OBJECTS'
exporting
iobject_typ = iobject_typ
* MAXANZ = 30
* MAXSTORE = 100
* IUNAME = IUNAME
tables
iesruo = iesruo
.
call function 'ES_APPEND_USER_OBJECTS'
exporting
iobject_typ = iobject_typ
iobject_id = iobject_id
* IUNAME = IUNAME
* ISAVE = ISAVE
* I_NO_REFRESH = I_NO_REFRESH
.
call function 'ES_DELETE_USER_OBJECTS'
exporting
iobject_typ = iobject_typ
iobject_id = iobject_id
* IUNAME = IUNAME
.
call function 'ES_SAVE_USER_OBJECTS'
* EXPORTING
* I_NO_REFRESH = I_NO_REFRESH
.