SAP GUI Scripting does not save the report

szymon94

New Member
Joined
Nov 14, 2022
Messages
20
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hello I have a problem, Ihave recorded a script that I want to use in excel vba but somehow it does not recording saving. Is there any different way to write the code that would save me the reports ?

Sub WCARG60()
Dim SapGuiAuto, Application, Connection, Session
Dim path As String 'add a variable for the file path
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

Session.findById("wnd[0]").Maximize
Session.findById("wnd[0]/tbar[0]/okcd").Text = "Z_L_RU_OPS_TRN_MRX"
Session.findById("wnd[0]").sendVKey 0
Session.findById("wnd[0]/usr/radP_RB_A").Select
Session.findById("wnd[0]/usr/radP_RB_WRK").Select
Session.findById("wnd[0]/usr/txtS_FRGGR-LOW").Text = "60"
Session.findById("wnd[0]/usr/ctxtS_FRGCO-LOW").Text = "00"
Session.findById("wnd[0]/usr/ctxtS_FRGCO-HIGH").Text = "zz"
Session.findById("wnd[0]/usr/radP_RB_WRK").SetFocus
Session.findById("wnd[0]/tbar[1]/btn[8]").press
Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").setCurrentCell 7, "FRGCO"
Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectedRows = "7"
Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").contextMenu
Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectContextMenuItem "&XXL"
Session.findById("wnd[1]/tbar[0]/btn[0]").press

Aftet the Press dialog box saves as is open but it does not save

End Sub
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top