When it comes to OS issues SAP Basis people usually tend to access directly OS level of SAP server in order to investigate it. This is done by different telnet like tools which provide console to the OS access. However it may be the case that OS level access is not an option because it is not provided by various reasons.
1. report RSBDCOS0
Therefore there has to be other way how to basically reach out to OS just from SAP system. There is a report available for that. It is RSBDCOS0 and it basically provides terminal windows to the OS. Multiple OS commands can be entered into the report in similar way is ti would be done in real OS terminal. See on picture below how I run OS command: dir c:
All commands ran from the report are logged into files on OS level by C command: C_WRITE_SYSLOG_ENTRY.
If you want to run some OS commands on automated basis then there is an option to create custom ABAP report. Such a report will run these OS commands via FM SXPG_COMMAND_EXECUTE.
In case you have an issue to run OS commands in the RSBDCOS0. E.g. the report returns nothing just error code = 1. As very basic check is it is advisable to look whether an environment variable "ComSpec" is set. In case of WIN OS it should be set to value: ComSpec=C:\WINDOWS\system32\cmd.exe
As a last not on this report I say that the report is very powerful. Therefore it is not something to play with. Every user who uses it must be very well aware of what it actually doing! There is one SAP Note which witnesses about the power of the report. It is the Note: 117657 - Reports RSBDCOS0, RSNNUXCD are deleted or changed where it says:
As a result of multiple requests, report RSBDCOS0 was activated again.
This means SAP already tried to remove the report from standard SAP installations. However as per heavy pressure (as I can imagine it!) of customers they decided to give it back for usage. Better secure an access to this report!
2. tcode SM69
Other option to run OS command from SAP environment is to use tcode SM69. This tcode consists of commands which were setup up and can be even OS specific. It is possible to add new command as well; add additional parameters to existing commands, run commands etc.