SAP can be launched with the two following utilities
provided by SAP
1.
SAPlog.exe - bring up sap launching
pad where user can select system to logon
2.
SAPShcut.ext - Login directly into SAP system
described in the command line (used by certify action 'Launch SAP')
Both of these utilities read system information from the
configuration file saplogon.ini that contains detail information about each SAP
system accessible for that client. There can be multiple configuration files
and SAP uses following search order in determining the file that need to be
used during logon process.
1.
Retrieve file name defined through the command
line parameter /INI_FILE during the logon press.
2.
Retrieve file name from environment variable
SAPLOGON_INI_FILE
3.
From the default path:
a. SAP
GUI 7.2: the default path is '/sap/common' directory under user
directory.
b. SAP
GUI 7.1 : The default path is SAP installation directory and as last resort in
the window directory.
For automated login purposes we can only use "SAPShcut.exe"
as it would allow user to login directly into SAP system without selecting SAP
system from the launching pad. But unfortunately, this utility does not support
command line option '/INI_FILE' and it just ignore any value provided for this
parameter and instead uses configuration file defined by the environment
variable 'SAPLOGON_INI_FILE' or uses configuration file from the default
file path. Interestingly, SAPLogon.exe ALWAYS honor the value of INI_FILE
parameter and uses that configuration file for system lookup so any
configuration file can be used during the launch of SAPLogon.exe but same is
not true with SAPShCut.exe.
Since command line parameter cannot be used with
SAPShcut.exe, therefore only choice we are left is to exploit environment
variable for different path of the saplogon.ini file. Through numerous implementations, Worksoft Profession Services are able to recommend following solutions:
1.
Manually create/change environment variable on
each machine to point to network drive for configuration file. This will ensure
that each SAP login are using the centralized configuration file. However, this
change requires manual setting of environment variable on each client machine.
The other drawback of this approach is that once an environment variable is set
then all user on that machine are forced to use contents form that
configuration file and would not be able to use contents from default
configuration files until environment is deleted manually.
2.
Create a temporary environment variable through
Certify. A Window environment variable can be created with the DOS command
"Set" but due to limitation of that DOS command the newly created environment
variable is only visible for the given DOS session and is invalid to the
following Certify steps that depends on the value of that environment variable.
This strategy would not yield us anything as we are unable to overwrite SAP
configuration file during the SAP launch.
3.
Create a persistent environment variable through
Certify. Since DOS native command does not support this option so we have to
use a Window add-on called 'SetX' to accomplish this task. This
utility need to installed on each client machine. In this case the only change
need in certify is to insert a step to create that environment variable before
login. Optionally this variable can be cleared out after the login process so
it does not have side effect as was the case in item 1 above. But this solution
would require installing and making sure "SetX" utility is installed on each
machine and if a given client does not have that utility installed then no
environment variable would be set and SAP would use the default configuration
file.
4.
Use a batch file that contains temporary
environment variable setting and sap login command. This batch file shall be
invoked from the certify and would contains following entries:
a. Set
environment variable. e.g., SET SAPLOGON_INI_FILE = \\srvgivemefilesold\OUllah\SAPLOGON.INI
b. Execute
SAPShcut.exe , e.g., sapshcut.exe /sysname=WS-IDES /client=800
/user=abc /pw=zzz
Worksoft professional services found that if there is any
SAPlogon.exe process is running while trying to set environment variable then
that that command would be rejected by SAP and it would not honor the value of
that variable. Thus we need to make sure that there is no 'saplogon' process is
running on that machine when trying to set SAP environment variable. The
environment variable setting are temporary and will be clear out at the end of
execution of the script.
Followings are the drawback of this
approach:
a. It
requires deployment of batch file on each client machine at the same path.
b. SAP
login credentials are hard coded in the batch file and cannot be changed
through the Certify.
c. There
is no easy way to retrieve result of the login process executed from the batch
file.
If you would like to discuss with our Profession Services team about their offering, please contact services@worksoft.com.