Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Exit SAP Application

Hai To All,

While starting my addon iam checking some condition if it returns false i need to terminate the SAP application.

How to do that????

Regards,

Anitha

replied

ok, I tried it and functional solution for you is:

1. Add reference to your project for System.Diagnostics (Project - Properties - References and check System.Diagnostic)

2. Use this code for closing SAP

Dim Proc() As Process = Process.GetProcesses()

For Each p As Process In Proc

If InStr(p.ProcessName, "SAP Business One") Then

p.CloseMainWindow()

End If

This works, I tested it now. Hope it helps.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question