cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting SAP with Excel (Beginner)

Former Member
0 Kudos

Hello!

I'm new to the SAP scripting. On my company we use lots and lots of Excel spreadsheet lists with sales orders and projects, which is why i need to learn to connect those lists with SAP.

I have a list of sales orders in Excel starting downwards from cell A2 and I want to get the exchange rate on each of the orders from the header of VA03, so that the script copies the currency rate of each sales order next to the order number in the spreadsheet.

How do i do this? :s

Thanks, Mattias

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

Thanks, thats sounds like a good solution but thats not what I'm looking for... I want to know how to script the connection between SAP and Excel manually.

Thanks, Mattias

thomas_brutigam2
Active Participant
0 Kudos

Hi Mattias,

if you have allready worked with Scripting (Recording) you allready have the way to connect excel with SAP

To Connect an existing Instance of SAP with Excel you will need this code:


Public sapsession
Public Sub Connect_SAP()
If Not IsObject(SAPguiApp) Then
Set SAPguiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(sapsession) Then
Set sapsession = sapConnection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject sapsession, "on"
WScript.ConnectObject sapApplication, "on"
End If
End Sub

at end of all action you have to destroy all objects


Public Sub Destory_SAP()
set sapsession = nothing
set sapapplication = Nothing
set sapGuiapp = Nothing
End Sub

PS Look for Threads that have the same Title as yours -

There are many in this forum ...

Greetings

Thomas B