If you have KEYCODE LOCKOUT on the dash, and don't have the EKA code then you pretty much need to pull the BECM out and send it off to someone like myself who can hook the logic board up directly to diagnostic and bypass the security lockouts and reset them... that's worst case scenario.
If you have the EKA, then it's worth checking the microswitches in the door latch to make sure you can input the EKA. Though if the EKA has previously been turned OFF and you have KEYCODE LOCKOUT on the dash, then you're pretty much stuffed and have to send the BECM away. KEYCODE LOCKOUT means the BECM will want the EKA code before it will do ANYTHING else. If the EKA is turned off, then you have no way of entering it, and in an impossible situation.
If the EKA option is turned on, you have the EKA code, and the door latch switches are all OK - then you have to wait 30 mins with the battery connected for the KEYCODE LOCKOUT message to clear from the dash. Once the dash is blank, the vehicle will then accept attempts to enter the EKA. If you have a BECM with a software version of V36 or greater, then with a Nanocom you should be able to go into BECM -> UTILITIES and enter the EKA in the white text box and then press DISARM and it should have the same effect as entering it via the door lock. Again to do this via diagnostics, you need to wait for KEYCODE LOCKOUT to have gone from the dash, and connect the BECM with the ignition OFF (DIAGNOSTICS MODE should come up on the dash).
As the vehicle is in lockout, then you won't just be able to go in via diagnostics and turn things like the EKA and Immobiliser off, as even though it might say it's sucessfully written the settings, it won't actually have changed anything whilst it's in lockout. The vehicle needs to be in a disarmed and unlocked state before it will allow writing of changes to security settings.
With regards to " could this happen after the BECM has been sent away for work".... yes, it can. If the battery voltage is low and the vehicle is locked and alarmed, then the BECM can scramble settings as it loses power, and if it's locked/alarmed when it loses power, then it will power up again in a locked/alarmed state and expect the code to be entered. As has already been mentioned, a great cause of battery drain and thus lockout issues is the RF receivers fitted to the earlier version of the P38 - there wasn't nearly as much RF flying about when they were first designed/produced, so it was never an issue. As time has gone on and other things are now on the 433mhz (or 315mhz in other parts of the world) like garage door openers, aftermarket security systems, wireless doorbells, weather stations... and they all transmit and wake the P38 up, it is now what causes the problems. As also mentioned, there are a couple of fixed out there for this, and generally with this issue solved, P38's sleep a lot better at night (and in the day!) and one of the major causes for headaches is actually fixed.
Hope this helps,
Marty