Sunday, 13 March 2016

Access to SAP ERP via TeamViewer VPN

Accessing a SAP ERP system using TeamViewer VPN, for establishing a virtual private network (VPN) between a local computer and a remote server (partner), is a relatively simple and cheap method. The major prerequisite for the use ofTeamViewer VPN is that TeamViewer is installed on both sides with the option “Use TeamViewer VPN“.

It has to be noted at this point that TeamViewer VPN assigns its own IPs for both the local and the remote computer, in the form of 7.x.x.x, and that communication is only possible between these 2 IPs. Thus, you cannot pingthe IPof another remote computer, either if this is in the form of 7.x.x.x (assigned byTeamViewer) or in the usual form (i.e. 10.40.248.21).
The parameters for using TeamViewer VPN from command line are:
TeamViewer.exe -i <ID> --Password <Password> -m vpn, i.e.
TeamViewer.exe -i 12345678 --Password welcome -m vpn
Password is an optional parameter. However, if it is not entered, you will be asked upon each connection.
The parameters for opening SAP GUI from command line, so as to create a directTCP connection, are:
sapgui /H/<Server IP>/S/<Port No.>, i.e.
sapgui /H/11.222.33.44/S/3201
<Server IP> refers to the 7.x.x.x IP assigned by TeamViewer on the remote computer, which remains the same as long as TeamViewer ID doesn’t change, and <Port No.> refers to the SAP ERP system’s port number (i.e. 32xx, 33xx).
In my case, I had to simplify access because of more than 10 SAP ERPsystems under the same project. As a result, I wrote a script file using VBScriptthat usesTeamViewer VPN to establish the required connection and open SAP GUI for connecting to the respective SAP ERP system. This step is fairly easy, so I suggest using it in similar scenarios, since you do not need to always look for the connection parameters.
The only object that needs to be used is WshShell, so as to make use of theRunmethod to run each application in a new Windows process. The 3 basic steps for writing the script are:
  1. Declare and instantiate the WshShell object:
    Dim objShell
    Set objShell = WScript.CreateObject("WScript.Shell")
  2. Run the TeamViewer application (using the Run method) to establishVPNconnection:
    objShell.Run """C:\Program Files\TeamViewer\Version6\TeamViewer.exe"" -i " & strTeamId & " --Password " & strTeamPass & " -m vpn", , True
    strTeamId” is the TeamViewer ID and “strTeamPass” is theTeamViewerpassword
  3. Run the SAP GUI application (using the Run method):
    objShell.Run "sapgui /H/" & strSysTvIP & "/S/" & strPortNo, , True
    strSysTvIP” is the remote computer’s IP (7.x.x.x) and “strPortNo” is the system’s port number
Due to corporate licensing, in order to establish the necessary VPN connection I used v6.0, instead of the latest v7.0 of TeamViewer. However, there is not any key difference in the procedure described apart from the installation directory, which needs to me modified accordingly. For further information regarding TeamViewerVPN, you can refer to the manual of either v6.0 or v7.0.

No comments:

Post a Comment