cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issue printing documents from Power Automate Desktop (PAD) in SAP R3

rcardenasb1
Newcomer
0 Kudos
245

Hello everyone
I am using Power Automate Desktop (PAD) to create an RPA to access transaction FB03 and print some documents and I have a problem
I use a SAP script (VBA) to access the printing and the problem I have is that the script does not take control of the Windows printing to obtain the PDF and I have to do it with PAD and it usually fails from time to time. Is there any way for the SAP script to access the Windows print screen and print the document? Thanks for your help.

This is the script and the PAD code.

Script

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]/usr").horizontalScrollbar.position = 39
session.findById("wnd[0]/usr/lbl[154,13]").setFocus
session.findById("wnd[0]/usr/lbl[154,13]").caretPosition = 1
session.findById("wnd[0]").sendVKey 2
session.findById("wnd[0]/usr/txtBSEG-AUGBL").setFocus
session.findById("wnd[0]/usr/txtBSEG-AUGBL").caretPosition = 8
session.findById("wnd[0]").sendVKey 2
session.findById("wnd[0]/mbar/menu[0]/menu[5]").select
session.findById("wnd[0]/tbar[0]/btn[86]").press
session.findById("wnd[1]/tbar[0]/btn[13]").press

PAD screen

rcardenasb1_0-1737126098586.png

 

 

 

 

Accepted Solutions (0)

Answers (0)