You can get the logged users list various ways on SAP system but if you want to get online users TERMINALID information easily , then you can do this with just one FUNCTION…
SE37 –> TH_DISPLAY_USER_LIST
F8 – EXECUTE
Leave it empty and F8 – EXECUTE
Then you will get the online user list with TERMINALID information.
Thats it…