If you have several SAP application servers in a system, there may be a need to get a list of them. For example, you have a requirement to run an ABAP program on a particular server (sometimes it makes sense, like for server statistics). Following function will help:
TH_SERVER_LIST – returns a list in a table
TH_DISPLAY_SERVER_LIST – interactive display. You can use this one, if transactions like SM04/SM50/SM51 don’t work for you.