SAP Jobsuche bei DV-Treff


Suchen
Armado
  • Armado
  • SAP Forum - User Thema Starter
vor 7 Jahre
Hallo,

habe via Script Recording im SAP einiges aufgezeichnet. Bei den letzten Schritten geht es darum, dass ich ein PDF anhänge allerdings wird hier nicht der Dateiname und Pfad angezeigt sondern nur etwas Kryptisches. Kann mir hier jemand helfen wie man das entweder manuell macht oder ähnliches?

Dieses Phänomen ist mir bereits öfters aufgefallen. Gibt es da eine grundsätzliche Idee bzw. Hilfe?

Danke!

Hier mal der Code:

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

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

session.findById("wnd[0]/tbar[0]/okcd").text = "ftr_edit"

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

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-BUKRS").text = "1050"

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").text = "6105000000000"

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").setFocus

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").caretPosition = 13

session.findById("wnd[0]/usr/btnDISPLAY").press

session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"

session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_ARL_LINK"

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").hierarchyHeaderWidth = 286

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").selectItem "0000000003","HITLIST"

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").ensureVisibleHorizontalItem "0000000003","HITLIST"

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").doubleClickItem "0000000003","HITLIST"

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

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[1]/shell").setSelectionIndexes 39,65

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

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

Förderer

Saptimierer
vor 7 Jahre
https://www.dv-treff-community.de/sap-hilfe/SAP-Script-Aufzeichnung-keine-Dateipfad-und-Datei-HILFE-t17875 

Allerdings ist deine Frage nicht wirklich eindeutig. Wie soll man denn das verstehen "nur etwas Kryptisches"? Was genau ist dir zu kryptisch?

Armado
  • Armado
  • SAP Forum - User Thema Starter
vor 7 Jahre
Vielen Dank ich werde das mal testen und berichten. Mit dem kryptischen meinte ich eher, dass ich nicht erkennen kann wie er das speichert. Das müssten die letzten paar Einträge im Skript sein, aber vielleicht geht das ja so wie in dem anderen Post, bei dem Du geantwortet hast mittels Alt+F12 unter Optionen das einzustellen. Bin gespannt! Danke!
Armado
  • Armado
  • SAP Forum - User Thema Starter
vor 7 Jahre
Hi Saptimierer,

war nicht angehakt und auch mit Haken und ohne geht es nicht 😞.

Noch eine Idee?

Danke!

Saptimierer
vor 7 Jahre
Wenn ich dein Skript richtig interpretiere, versuchst du in den "Diensten zum Objekt"

session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"[/code] einen Link auf eine Url anzulegen 
[code=vb]session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_ARL_LINK"[/code] 

Du schreibst aber, dass du ein pdf-Dokument anhängen möchtest. Dies machst du über den Menüpunkt "Anlegen... - Anlage anlegen"
[code=vb]session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_PCATTA_CREA"
Dann öffnet sich bei laufender Aufzeichnung ein Popup, in dem du Pfad und Dateinamen angeben kannst. Und das wird dann auch genau so aufgezeichnet.

session.findById("wnd[1]/usr/ctxtDY_PATH").text = "D:\Documents\SAPDEMO"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "xx.pdf"
Armado
  • Armado
  • SAP Forum - User Thema Starter
vor 7 Jahre
Hi Saptimierer,

ich habe deine Hinweise bzgl. Pfad und Datei versucht zu verwenden (siehe Code). Leider ohne Erfolg. Des weiteren habe ich mal Screenshots step by step was ich ausführe bei der Aufzeichnung und in Screen5 kommt dann das Popup für den Pfad und Dateiname.

Vielen Dank für deine Mühe!

Code:

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

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

session.findById("wnd[0]/tbar[0]/okcd").text = "ftr_edit"

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

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-BUKRS").text = "1050"

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").text = "6105000000000"

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").setFocus

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").caretPosition = 13

session.findById("wnd[0]/usr/btnDISPLAY").press

session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"

session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_PCATTA_CREA"

session.findById("wnd[1]/usr/ctxtDY_PATH").text = "C:\temp"

session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "SAP.pdf"

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

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

[img]C:[/img]

Hier mal der Link zu den Screenshots, da das mit dem Einfügen von Bildern hier nicht geklappt hatte:

http://www.share-online.biz/dl/MOMFG9LOWIE8 

http://www.share-online.biz/dl/LWMFG9LORNQE 

http://www.share-online.biz/dl/OHLFG9LOY60 

http://www.share-online.biz/dl/CJLFG9LOLGR 

Vielen lieben Dank!

Saptimierer
vor 7 Jahre
Mangels Flash kann ich deine Bilder leider nicht anzeigen.

Wenn du den Menüpunkt "Anlegen... - Anlage anlegen" aufrufst (und den Haken in den Skripting-Optionen entfernt hast) sollte sich ein Popup-Fenster bei dir öffnen mit zwei Eingabezeilen, in denen du a) den Pfad und b) den Dateinamen angeben kannst.

https://archive.sap.com/image/1019002 

Dies passiert allerdings nur, wenn eine Aufzeichnung läuft. Sonst kommt der normale Windows-Dateirequester.

https://archive.sap.com/discussions/thread/3937061 

Armado
  • Armado
  • SAP Forum - User Thema Starter
vor 7 Jahre
Hi Saptimierer,

leider kommt der gleiche Dialog und nicht der geänderte Dialog beim Aufzeichnen.

Des weiteren habe ich versucht die Lösung von ScriptMan bei mir einzubauen, wie folgt sieht es jetzt aus, allerdings funktioniert das trotzdem nicht. Ich denke das liegt aber eher daran, dass ich das nicht richtig umgesetzt habe mangels Erfahrung.

Kannst Du noch einmal helfen?

Danke!

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

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

session.findById("wnd[0]/tbar[0]/okcd").text = "/nftr_edit"

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

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-BUKRS").text = "1050"

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").text = "6105000000000"

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").setFocus

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").caretPosition = 13

session.findById("wnd[0]/usr/btnDISPLAY").press

session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"

session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_ARL_LINK"

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").hierarchyHeaderWidth = 286

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").selectItem "0000000003","HITLIST"

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").ensureVisibleHorizontalItem "0000000003","HITLIST"

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").doubleClickItem "0000000003","HITLIST"

'*******************************************************************************************************

Dim FileNam2

Set Wshell = CreateObject("WScript.Shell")

Do

bWindowFound = Wshell.AppActivate("Storing Files in Documents") 'Open

WScript.Sleep 1000

Loop Until bWindowFound

bWindowFound = Wshell.AppActivate("Storing Files in Documents") 'Open

if (bWindowFound) Then

Wshell.appActivate "Storing Files in Documents" 'Open

WScript.Sleep 100

Wshell.sendkeys "{TAB}"

Wshell.sendkeys "{TAB}"

Wshell.sendkeys "{TAB}"

Wshell.sendkeys "{TAB}"

WScript.Sleep 100

FileNam2 = WScript.Arguments.Item(0)

'Wshell.sendkeys "c:\temp\SAP.pdf"

Wshell.sendkeys FileNam2

WScript.Sleep 100

Wshell.sendkeys "{ENTER}"

WScript.Sleep 100

end if

'*******************************************************************************************************

'session.findById("wnd[2]/tbar[0]/btn[0]").press

'session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[1]/shell").setSelectionIndexes 39,65

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

'session.findById("wnd[0]/tbar[0]/btn[3]").press

Armado
  • Armado
  • SAP Forum - User Thema Starter
vor 7 Jahre
Noch eine Ergänzung habe das Ursprüngliche:

bWindowFound = Wshell.AppActivate("Open")

auf

bWindowFound = Wshell.AppActivate("Storing Files in Documents") 'Open

geändert, da der Dialog die Überschrift: Storing Files in Documents

hat und nicht Open,

aber auch mit Open geht es nicht!

Danke!

Saptimierer
vor 7 Jahre
Lt. deinem Code selectContextMenuItem "%GOS_ARL_LINK" wählst du den Menüpunkt "Verknüpfungen". Warum? Versuch stattdessen mal den Menüpunkt "Anlegen... - Anlage anlegen".
Armado
  • Armado
  • SAP Forum - User Thema Starter
vor 7 Jahre
Hi Satiriker,

Leider ist das nur darüber möglich. Wie kann ich das von scriptman richtig in dem Zusammenhang verwenden ?

Saptimierer
vor 7 Jahre
Es tut mir leid, dieser Menüpunkt ist bei mir ausgegraut. Ich kann das nicht testen und dir damit leider auch nicht weiterhelfen. Frag doch einmal Scriptman direkt über das SAP-Forum.
Armado
  • Armado
  • SAP Forum - User Thema Starter
ScriptMan
vor 7 Jahre
Hallo Armado,

man könnte es wie folgt angehen:

1. Das von dir aufgezeichnete Skript muss an einer geeigneten Stelle um 3 Zeilen ergänzt werden:

z.B.

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

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

session.findById("wnd[0]/tbar[0]/okcd").text = "ftr_edit"

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

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-BUKRS").text = "1050"

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").text = "6105000000000"

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").setFocus

session.findById("wnd[0]/usr/ctxtFTR_ENTRY-RFHA").caretPosition = 13

session.findById("wnd[0]/usr/btnDISPLAY").press

session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"

session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_ARL_LINK"

FileName2 = "c:\temp\SAP.pdf"

set Wshell = CreateObject("WScript.Shell")

Wshell.run "c:\temp\open.vbs " & FileName2,1,false

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").hierarchyHeaderWidth = 286

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").selectItem "0000000003","HITLIST"

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").ensureVisibleHorizontalItem "0000000003","HITLIST"

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").doubleClickItem "0000000003","HITLIST"

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

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[1]/shell").setSelectionIndexes 39,65

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

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

2. Man speichert dann das nachfolgende Skript namens Open.vbs z.B. unter c:\temp ab:

Dim FileNam2

FileNam2 = WScript.Arguments.Item(0)

Set Wshell = CreateObject("WScript.Shell")

Do

bWindowFound = Wshell.AppActivate("Storing Files in Documents") 'Open

WScript.Sleep 1000

Loop Until bWindowFound

bWindowFound = Wshell.AppActivate("Storing Files in Documents") 'Open

if (bWindowFound) Then

Wshell.appActivate "Storing Files in Documents" 'Open

WScript.Sleep 100

Wshell.sendkeys "{TAB}"

Wshell.sendkeys "{TAB}"

Wshell.sendkeys "{TAB}"

Wshell.sendkeys "{TAB}"

WScript.Sleep 100

Wshell.sendkeys FileNam2

WScript.Sleep 100

Wshell.sendkeys "{ENTER}"

WScript.Sleep 100

end if

3. Bei den 4 TAB-Kommandos muss man testen, ob sie in der Anzahl überhaupt erforderlich sind. Das Ziel ist, dass der Cursor an der Stelle landet, wo der der Dateiname erwartet wird.

Wenn Hotkeys aktiv sein sollten, dann lässt man die TAB-Kommandos am besten komplett weg und verwendet stattdessen z.B. folgendes:

Wshell.sendkeys "%n"

Aber dazu müsste man das Fenster namens "Storing Files in Documents" zu sehen bekommen.

Grüße,

ScriptMan

Armado
  • Armado
  • SAP Forum - User Thema Starter
vor 7 Jahre
Hallo Scriptman,

vielen lieben Dank das hat jetzt funktioniert!

Du bist der ScriptGott ;)

VG

Armado