cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to evaluate VBScript to SAP connection

Former Member
0 Kudos

Hello,

I'm in need of some help. I have no experience with SAP, I'm currently working with VBScript. The company I work for uses SAP and they deployed a module to track parts being received. Unfortunately, the module was designed to receive one part at a time. Some of the locations will be receiving dozens of parts. I have been tasked with finding a way to provide a web page (vbscript) where the user can receive the parts in a batch. In order to accomplish this I need to be able to get data from SAP and then write data back to SAP.

Is it possible to not only read, but to write data back to SAP using VBScript? I want to implement a good solution and I need to implement a solution that the SAP administrators will be ok with.

I really could use some help finding a good starting point to help me understand what I need. If I can't do what I need in VBScript then I need to find a third-party tool that will let me interface with SAP.

Thank you,

Brad

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Brad,

VBScript can read and write SAP data. Without knowing the details of exactly

what you are trying to do I'll post a little code that you may find useful:


Dim fc, sapConn, conn

Set fc = CreateObject("SAP.Functions") ' function control
Set sapConn = CreateObject("SAP.LogonControl.1") ' sap connection object
Set conn = sapConn.NewConnection() ' sap connection object
conn.System = "yoursystem" ' test, prod, development, whatever
conn.SystemNumber = "99" ' numeric
conn.ApplicationServer = "your.application.server" ' the machine name or ip
conn.MessageServer = "your.message.server" ' the machine name or ip
conn.client = 999 ' the client number
conn.user = "user_name" ' your rfc enabled user name
conn.Password = "password" ' the above named account password

Dim retcd
retcd = conn.Logon(0, True) ' establish the connection
If (retcd = False) Then
    WScript.Echo "SAP Logon Failed."
Else
    ' do something useful
end if

These guys have some pretty useful coding examples too:

<a href="http://sapass.metro.client.jp/Sap_Active_X/index.htm">Useful Examples for vbscript and sap activex</a>

Please note, most of the examples on the above web site use VBA and not

vbscript. So, leave out the As ... part of every Dim statement for pure vbscript.

Here is an SAP URL on the subject you may find useful:

<a href="http://help.sap.com/saphelp_46c/helpdata/en/39/7e11e0ac6011d189c60000e829fbbd/frameset.htm">SAP RFC BAPI Interfaces</a>

Good luck!

Ray

Former Member
0 Kudos

Wow! That was fast. Thank you for the reply. I need to read over the SAP RFC and BAPI interfaces, but this should do the trick for now.

Thank you,

Brad