Is there a standard way to get previous login date of SAP user?

1.9k views Asked by At

I've got a requirement to check whether some objects were modified since last logon of current user. There is a table USR02 that contains last logon date, but it is updated at moment of logon and here "last" means "current".

For example, I logged in 2014.11.21 and then 2014.11.26, so dates range I want to get is 21…26, but when I enter the system, date 2014.11.21 in USR02 will be overwritten with 2014.11.26.

Of course, I could follow Z-way and create my own table containing user name and previous login date, but maybe there is there a standard way to achieve this?

1

There are 1 answers

1
vwegert On BEST ANSWER

I noticed that you can see the current as well as the last logon date and time in the dialog you can open with System --> Status. I went through the code of the function pool SHSY that contains this dialog and found the following implementation:

  DATA: BEGIN OF last_logon,
          date LIKE sy-datum,
          time LIKE sy-uzeit,
          date_now LIKE sy-datum,
          time_now LIKE sy-uzeit,
        END OF last_logon.

* ...

* Datum und Zeit der aktuellen und letzten Anmeldung
  GET PARAMETER ID 'US2' FIELD last_logon.

Certainly not the standard API one would expect, but apparently it's all there is...