NB: Error message "The Server threw an exception" is a general error message from the SAP SDK that can be thrown due to multiple reasons. This article only covers reasons during a DI-API Connection.
What is the reason for this error?
If you get this error message it is most likely that you have the wrong DI-API version installed (Example: You have SAP 9.3 PL04 DI-API installed but the system you are connecting to is running SAP 9.3 PL09).
How to fix it?
First, check if you have the correct DI-API version. You do this by going to folder "C:\Program Files (x86)\SAP\SAP Business One DI API\DI API 90" ("C:\Program Files\SAP\SAP Business One DI API\DI API 90" if you are running 64-bit).
In here right click on file "SAPbobsCOM90.dll" and choose Properties. Then under the details Tab see the Product Version
Now go to the SAP System and under Help > About SAP Business One and check the technical version.
If these two versions are not the same, you have an incorrect DI-API version. In such a case you should uninstall the DI-API version and install the right version that matches you SAP Business One version.