Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as text by Napster ( 17 years ago )
Steps
To simplify the task, here is a vbs script which illustrates how to automate a transaction. All you need to do is to record the user actions for maintaining a transaction manually. The resulting script gets saved on your PC. Cut and paste the vbscript code into the section of the template below, edit the fixed values to use Excel cell data, and you are set to go.

Examples

'SAPGUI Macro for updating SAP from Excel data
'Prerequisites:
'1.	Script Recording and Playback from the SAPGui must be enabled by admin
'2.	The Excel list must be set up from top left corner of a worksheet
'3.	The worksheet with data must be the active sheet
'4.	There is no error handling.  Build it yourself!
'5.	The script will update the active (current) SAP transaction

'Instructions for use
'Record a macro of your update actions.
'Paste the session.findById stuff between the <== and ==> markers
'Edit the literal values and replace with Trim(CStr(objSheet.Cells(x, y).Value))
'where x and y are the row and column counters
'Open up your Excel sheet with data (row 1 is ignored here)
'Fire the macro!
 '===========BEGIN BOILERPLATE===================
REM Set up connection to the SAP screen:
If Not IsObject(application) Then
   Set SapGuiAuto  = GetObject("SAPGUI")
   Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
   Set connection = application.Children(0)
End If
If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If

REM Set up connection to the Excel data to be keyed into SAP:

Dim objExcel
Dim objSheet, intRow, i

Set objExcel = GetObject(,"Excel.Application") 
Set objSheet = objExcel.ActiveWorkbook.ActiveSheet 


session.findById("wnd[0]").maximize

 

Revise this Paste

Your Name: Code Language: