Skip to Content
0
Jun 09 at 08:00 PM

SAP AAO - How to handle the logon prompt window with VBA Code when there is a login failure?

120 Views

lResult = Application.Run("SAPLogon", "DS_1", "010", "USER", "PASSWORD", "EN")

Using the above VBA code, the login is not successful due to incorrect user and password. In this negative scenario, the below pop up screen appears and the VBA code is stuck. How to handle the SAP logon popup screen via VBA and pass the control back to the VBA code? Any thoughts?

Here is the VBA Code used to refresh the SAP BW Query:

Dim lResult As Long
---> lResult = Application.Run("SAPLogon", "DS_1", "010", "USER", "PASSWORD", "EN") <-----

---> The code is stuck here.. not able to move further <---
lResult = Application.Run("SAPExecuteCommand", "Refresh", "DS_1")
End Sub

Trying to handle the SAP BW refresh with a VBA Code. This is a negative use case, when the password is incorrect would like to close the workbook and report the user, SAP logon credentials are incorrect. No Human Intervention to close the popup.

Attachments

8vuzn.jpeg (14.4 kB)