I'm using some tried and tested code that I've built up over the years to send an email using the CL_BCS class. In one particular program the method SET_SEND_IMMEDIATELY has been raising an exception and I don't know why. The really strange thing is that the exception is being raised depending on the logged on user and if debugging is active:
My user - the email is sent successfully
Two other users - the exception is raised
Same other users but debugging to see where the exception is raised - the email is sent successfully!
So this says to me it's some sort of timing issue. I can't see any difference between my userid and the ones that fail. I've copied one of these users and still have the same issue. All of this is occurring on my PC, so it's not a PC or SAPGUI problem.
As I can't reproduce the problem whilst debugging, all I can see is that the exception CX_OS_ERROR or CX_SYSTEM_ERROR is begin caught in method CL_SEND_REQUEST_BCS->SETU_ASYNCHRONOUS, and as it's not being caught into a reference variable I can't see any further detail. It's then propogated as CX_SEND_REQ_BCS with error type CX_BCS=>OS_EXCEPTION.
If I remove the call to method SET_SEND_IMMEDIATELY completely then the program short dumps with an uncaught exception CX_OS_OBJECT_NOT_FOUND during the SEND method - again this only happens for the two other test users and not my own.
Very strange. As I said earlier it's code that I've taken from my own library and have used it many times before with no problem.
Any suggestions on where to go from here?