VB Code to continue with SAVE AS dialog window in SAP

ALHK022

New Member
Joined
May 24, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
TO : ALL EXPERTS

I have the VBA problem and stuck over half year. Because my knowledge in VBA is almost nothing.
The question is
Running a recorded macro (VBA in SAP) for SAP, I found VBA stop in saving the export file as Excel file.
Problem : Recorder can't record any action in SaveAs dailog (even I unclick the "Show native Microsoft Windows dialogs" in SAP Option menu.)
After reading some Q&A in SAP web,
Same problem was found in SAP forums, VB Code to continue with SAVE AS dialog window | SAP Community
And also found similar case in this forums SAP - Deal with the "Save As" dialog box with VBA and/or VBS
But I still can't understand how to work. (My SAP is GUI 740 with Win 10.)
Any Expert can help me to write a simple VBA for me which continuous my job on below and auto-save the export file into "C:\temp\" or even just save in SAP GUI folder by clicking "Save" button in SaveAs dailog.

Mega thanks in advance.
sap-record-problem-saveas.jpg

Below is the recorded script in SAP and the final line ran, it will show a SaveAs dialog and stop everthing.


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]").resizeWorkingPane 79,19,false
session.findById("wnd[0]/tbar[0]/okcd").text = "FAGLL03"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/radX_AISEL").select
session.findById("wnd[0]/usr/ctxtSD_SAKNR-LOW").text = "6511042000"
session.findById("wnd[0]/usr/ctxtSD_SAKNR-HIGH").text = "6579042902"
session.findById("wnd[0]/usr/ctxtSD_BUKRS-LOW").text = "4200"
session.findById("wnd[0]/usr/ctxtSO_BUDAT-LOW").text = "20220501"
session.findById("wnd[0]/usr/ctxtSO_BUDAT-HIGH").text = "20220531"
session.findById("wnd[0]/usr/radX_AISEL").setFocus
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/mbar/menu[0]/menu[3]/menu[1]").select
session.findById("wnd[1]/usr/radRB_OTHERS").setFocus
session.findById("wnd[1]/usr/radRB_OTHERS").select
session.findById("wnd[1]/usr/cmbG_LISTBOX").key = "10"
session.findById("wnd[1]/tbar[0]/btn[0]").press
 

Attachments

  • SAP_Record_Problem_SaveAs.jpg
    SAP_Record_Problem_SaveAs.jpg
    149.3 KB · Views: 75

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,223,885
Messages
6,175,186
Members
452,615
Latest member
bogeys2birdies

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