on 06-17-2019 2:29 PM
I'm making a vba code to import my data from SAP GUI I was wondering, how to do a loop that "clicks OK" when SAP tells us it "has not cut any data", this means that for this year for example no data has been entered in sap for a given transaction.
PublicSub RunGUIScript()
Dim W_Ret AsBoolean
Sheets("Extraction").Select
Connect to SAP
W_Ret = Attach_Session
IfNot W_Ret ThenExitSubEndIfOnErrorGoTo myerr
[script SAP]ExitSub
myerr:
MsgBox "Error occured while retrieving data", vbCritical + vbOKOnly
EndSub
When there is this error message I want SAP to "click OK" and delete what is in its memory (I paste data from a "temp" sheet to my table)
I know that clicking on Ok is this command " session.findById("wnd[1]/tbar[0]/btn[0]").press"
If Not session.findById("wnd[1]/tbar[0]/btn[0]", False) Is Nothing Then
session.findById("wnd[1]/tbar[0]/btn[0]").press
End If
test for the condition, then press the button.
above is a crude test for existence, then press if exists.
The question isnt really clear from my perspective, but maybe this gets you 2 steps forwards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.