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.
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
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.
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