Doorlocks are controlled by the GM general module.
It goes via the RM relay module.
In case one of the mircroswitches in the doorlock system is not working, there is no feedback to the GM that ALL dors are locked.
As a safety measure it will open all dors again to show you that something is wrong.
So remove the door panel on that door
check the microswitches
check for broken door brackets
check for broken wire looms
Example from the E32
http://bmwe32.masscom.net/johan/door...k_bracket.html
http://bmwe32.masscom.net/johan/door...croswitch.html