Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8989

What do you need (to activate in SAP) in order to execute scripts from VBA?

$
0
0

Hello helpers,

I'm having trouble with the code I've developed on VBA pasting code from SAP script recorder. I launch it on my computer and it works fine, for example enter a transaction -> do something -> save changes, but when I share it other users they receive VBA errors messages.

 

Here's the code with problem:

 

 

Private Sub TheScript()

 

'setting the connection with sap:

Dim App, Connection, session As Object

Set SapGuiAuto = GetObject("SAPGUI")

Set App = SapGuiAuto.GetScriptingEngine

Set Connection = App.Children(0)

Set session = Connection.Children(0)

 

'Data to use from the worksheet

fechaDoc = Range("b1").Value

fechaContab = Range("b2").Value

periodo = Range("b3").Value

claseDoc = Range("b4").Value

textoReferencia = Range("b5").Value

textoCabecera = Range("b6").Value

posiciones = Range("j1").Value

 

 

'Enter FB01 trx

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

session.findById("wnd[0]/tbar[0]/okcd").Text = "/nfb01"

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

 

 

'Enter date value

session.findById("wnd[0]/usr/ctxtBKPF-BLDAT").Text = fechaDoc

session.findById("wnd[0]/usr/ctxtBKPF-BUDAT").Text = fechaContab

session.findById("wnd[0]/usr/txtBKPF-MONAT").Text = periodo

 

 

Here's the problem, the code doesn't find those elements. I've used the script recorder on this mate's computer and found that it recorded this fields with diferent names.

 

 

Thanks in advance,

Richard


Viewing all articles
Browse latest Browse all 8989

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>