Dears
I am training to automate sap process to attach documents via transaction code FB03 add attachment . but when recording the steps with SAP with the VBS and taking the script in (Run VBScript) in power automate it gives me syntax error
the below is the script recorded from SAP
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 = "fb03"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/txtRF05L-BELNR").text = "1726000004"
session.findById("wnd[0]/usr/ctxtRF05L-BUKRS").text = "1000"
session.findById("wnd[0]/usr/ctxtRF05L-BUKRS").setFocus
session.findById("wnd[0]/usr/ctxtRF05L-BUKRS").caretPosition = 4
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"
the main issue is in the last sentence
session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"
i can not find why it is not accepting it
Perfect!
Try using %% instead of a single %:
I hope this helps 🙂
@Mona_Sultan This is due to the limitation of PAD, % is reserved to be only used to call variables within PAD. Unfortunately, I am also stuck at this stage. Sending Keys and UI elements within PAD haven't been very robust replacements to SAP Scripts.
use sendkeys. It should work
Dear Ankesh
i already tried to automate the process with ui element but the button to press and attach the document does not make the action that is why i am trying to use vbs
In VB script, use this wscript.sleep 6000
The script will wait 60 seconds an then continue the code.
My recommendation would to use Power automate desktop to automate, rather than generating a vbs from SAP GUI recording and then running it form PAD. For reference: https://learn.microsoft.com/en-us/power-automate/guidance/rpa-sap-playbook/creating-sap-desktop-flow-action-based-gui
Thanks
Ankesh
Dear Mr Ankesh
can you tell me how to use delay
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional