SAP Jobsuche bei DV-Treff


Suchen
cleemen
  • cleemen
  • SAP Forum - Neuling Thema Starter
vor 11 Jahre
Servus allerseits,

ziehe Daten für Bericht (auch Dank dieses Forums) in Excel (Keine Standard SAP Transaktion - Eigenentwicklung des Dienstleisters)

Logon und Transaktionsaufruf über vbs

set ws = wscript.createobject("wscript.shell")

ws.Run chr(34) & "C:\Programme\SAP\SapSetup\setup\SAL\SapLogon.s8l" & chr(34)

On error resume next

Do

err.number = 0

wscript.sleep 100

Set SapGuiAuto = GetObject("SAPGUI")

If err.number = 0 then

Exit Do

End if

Loop

on error goto 0

If Not IsObject(application) Then

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

Set connection = application.OpenConnection("xxx (Test)") 'Verbindung

End If

If Not IsObject(session) Then

Set session = connection.Children(0)

End If

'MsgBox("will session erzeugen!")

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject application, "on"

End If

session.findById("wnd[0]/usr/txtRSYST-MANDT").text = "zzz"

session.findById("wnd[0]/usr/txtRSYST-BNAME").text = "yyyy" 'Benutzer

session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = "xxxx" 'Passwort

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

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

session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").expandNode "0000000046"

session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").topNode = "Favo"

session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").selectedNode = "0000000118"

session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode "0000000118"

session.findById("wnd[0]/usr/ctxtP_PERIOB").text = inputbox("Bis zu welcher Periode?")

session.findById("wnd[0]/usr/ctxtP_VERSN").text = "BFR"

session.findById("wnd[0]/usr/ctxtP_RPC").text = "orga"

session.findById("wnd[0]/usr/ctxtP_ALVVAR").text = "/LEI/FA_ALL"

session.findById("wnd[0]/usr/ctxtP_ALVVAR").setFocus

session.findById("wnd[0]/usr/ctxtP_ALVVAR").caretPosition = 11

session.findById("wnd[0]/tbar[1]/btn[8]").press

die aus Modul des Berichts aufgerufen wird

Sub Test()

Shell "wscript \\.....\Downloads\SAP_Daten.vbs"

End Sub

Funzt soweit alles prima. Daten werden über entsprechendes Layout (excelinplace) korrekt angezeigt.

Wird zweites Modul für die Übergabe an meinen Excelbericht manuell angeworfen, klappt auch die Datenübergabe problemlos.

Versuche ich die Datenübergabe per Call auf Modul in den code einzubinden bekomme ich bereits beim Datenabzug einen empty screen

Gleiches Ergebnis bekam ich auch beim Versuch Inhalt vbs in vba Modul zu integrieren.

Kann mir jemand sagen was ich falsch mache?

PS: Bin SAP und vb Neuling

ScriptMan
vor 11 Jahre
Hallo cleemen,

dein Problem erinnert mich an diese Geschichte:

http://scn.sap.com/thread/2017133 

Vielleicht hilft dir es weiter.

Freundliche Grüße

ScriptMan

cleemen
  • cleemen
  • SAP Forum - Neuling Thema Starter
vor 11 Jahre
Hallo Scriptman,

hört sich gut an. Komme aber erst Montag zum Testen, da ich aktuell ohne vpn o.ä. unterwegs bin.

Vielen Dank für die fixe Antwort.

Grüße cleemen