I'm using a SAP GUI Script to make an extraction of a SAP transaction, but the scripts stops because of the save form
I have to write the filename and saving path manually, How can i do to let SAP do this automatically?
Code:
Public Sub RunGUIScript_PROJ_WP_INFO_INV()
Dim W_Ret As Boolean
Dim answer As Integer
' Connect to SAP
W_Ret = Attach_Session
If Not W_Ret Then
Exit Sub
End If
On Error GoTo myerr
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/txtGD-MAX_LINES").SetFocus
session.findById("wnd[0]/usr/txtGD-MAX_LINES").caretPosition = 7
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/btnPUSH[4,1]").SetFocus
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/btnPUSH[4,1]").press
session.findById("wnd[1]/tbar[0]/btn[24]").press
session.findById("wnd[1]/tbar[0]/btn[8]").press
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").pressToolbarContextButton "&MB_EXPORT"
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").selectContextMenuItem "&XXL"
WaitingForm.Show
MsgBox "Extracción Exitosa", vbInformation, "SAP"
Exit Sub
myerr:
MsgBox "Error while retrieving data", vbOKOnly + vbCritical
End Sub