Currently running into an error problem: when migrating orders in SAP GUI through VBA, it might be that an order needs reconfirmation. However, this is not always the case.
I've already build in an error loop in the beginning of the code, so I don't get the object errors anymore. However, I'd like the VBA to CHOOSE between 2 outcomes.
I have built this code (which will cause to go to the next order, if there is an error):
'Press "full delivery (build a if function that if field delivery exists and is >1, press f6)
If Session.findById("wnd[0]/usr/tbl/SAPAPO/SAPLATP4CTR_FINAL/txt/SAPAPO/ATP4CSD-BMNGL[6,0]").Text <> "" Then
Session.findById("wnd[0]/tbar[1]/btn[6]").press
End If
Then, if it is not in that screen, it should just check whether it still is in the original screen:
If Session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV45A:4400/subSUBSCREEN_TC:SAPMV45A:4900/tblSAPMV45ATCTRL_U_ERF_AUFTRAG/ctxtVBAP-WERKS[11,0]").Text <>"" then
'Save order
Session.findById("wnd[0]/tbar[0]/btn[11]").press
End if
Unfortunately, this causes an error if it does not go to the Delivery screen (it just stays in the regular order screen). The thing I want it to do then, is to go through with the code.
Is there some way where I can determine in which screen I'm currently, so that VBA takes an action on that?