cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect Production server(Group/Server)?

Former Member
0 Kudos

Hi all,      

                I am having trouble  in a automation process that am doing. Since this was the first time in SAP scripting i was testing a automation in a test region Local configuration in SAP and the login script worked fine.But when i tried the same with the Production server(Messaging server) i am having trouble in login in. The code is as below


sap = CreateObject("SAPGUI.Scriptingctrl.1")

sapCon = sap.OpenConnectionByConnectionString(sapServer, False)

With sapSession

            .FindById("wnd[0]/usr/txtRSYST-BNAME").Text = sapID

            .FindById("wnd[0]/usr/pwdRSYST-BCODE").Text = sapPassword

            .FindById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"

            '.FindById("wnd[0]").SendVKey(0)

            '.FindById("wnd[0]/tbar[0]/okcd").text = "SE16"

            '.FindById("wnd[0]").sendVKey(0)

        End With

sapserver="xxxxx.xxxxx.xxx".

When i used it with the Prodution server i got the below error message Connection is refused

This was the first issue when i changed the the server in this format

sapserver="/M/xxxx.xxxxx.xxx/S//G/PG1"

i got this error msg

Logon Balancing parser error.

Can you guys please help me with this issue.Please i really need your help. I would really appreciate it if you guys could help me as soon as possible.

Accepted Solutions (0)

Answers (1)

Answers (1)

stefan_schnell
Active Contributor
0 Kudos

Hello bhagavath,

welcome in the Scripting Language forum.

The same problem is described here. The solution was in this case to add an entry in the hosts file, in the directory windows/system32/drivers/etc. Please check it and let us know your result.

Also interesting is to know if it is possible for you to ping the target system successfully.

Cheers

Stefan

Former Member
0 Kudos

Hi Stefan,      

       I tried it but not working. Thanks for your time.      

          1)  Is there any other way we can do this?     

          2)   is it possible to call with the username and password. I mean     

link sap.OpenConnectionByConnectionString(sapServer, username,password)?

     or any other possibilites?

stefan_schnell
Active Contributor
0 Kudos

Hello bhagavath,

for a basically check, if it is possible to connect the system, you could use the following VBS program:

'-Begin-----------------------------------------------------------

  '-Sub Main------------------------------------------------------

    Sub Main()

      Set FunctionCtrl = CreateObject("SAP.Functions.Unicode")

      Set SAPConn = FunctionCtrl.Connection

      If Not SAPConn.Logon(0, False) Then

        MsgBox "Logon failed"

      Else

        MsgBox "Logon successful"

        SAPConn.LogOff

      End If

    End Sub

  '-Main-----------------------------------------------------------

    Main()

'-End--------------------------------------------------------------

If you work with a 64-bit environment, call it from a x86 console. In a normal case this program opens a tiny logon dialog and you can choose your system.

The connection string looks in my case like this:

Set Con = App.OpenConnectionByConnectionString( _

      "/H/10.100.100.100/S/3200", True, False)

/H/IP-Address/S/32 + Systemnumber, to get the system number call FM GET_SYSTEM_NUMBER

In my case this works:

'-Begin------------------------------------------------------------

  '-Sub Main-------------------------------------------------------

    Sub Main()

      sapServer = "/H/10.100.200.300/S/3263"

      Set sap = CreateObject("Sapgui.ScriptingCtrl.1") 

      Set sapCon = _

        sap.OpenConnectionByConnectionString(sapServer, True)

      If IsObject(sapCon) Then

        MsgBox "Connection successful"

      Else

        MsgBox "Connection failed"

      End If

      sapCon.Close

    End Sub

  '-Main-----------------------------------------------------------

    Main()

'-End--------------------------------------------------------------

Hint: Don't forget to set the command Set in front of your lines 1 and 2. Also it is necessary to set the variable sapSession.

Let us know your result.

Cheers

Stefan