You now have the tools and knowledge to overcome future challenges through scripting. There is so much more you can do by simply reaching into the SAP database. I hope you feel this was a good practical lesson and that my explanations were clear.
Q: What would be your response if I asked you to modify the script in challenge #1 to output to a single file called "saplogons.txt"?
Notice that most of the time we run queries within the application. In fact, that is the recommended way to work with SAP. However, there are situations like the ones I described in this article where it is more effective and efficient to submit queries at the database or operating system level.
I strongly recommend that you work with the database very carefully. The database is the heart of SAP.
Last but not least, let me tell you about my "Effortless administration" formula:
Knowledge + Scripts
-------------------------- = Effortless administration
Experience
More resources

Overcoming Basis challenges by reaching inside the database

Home: Introduction
Basis challenge #1: Reporting logon information
Basis challenge #2: Gathering SQL Server information
Basis challenge #3: Getting system profile parameters
Troubleshooting
Review: Conclusion and more resources