If you are referring to the security code for the stock radio once it has been removed and reinstalled, or if you have had the battery/alternator replaced, you can obtain the code by contacting your local BMW dealership. Their service bay will have the ability to connect the car to a computer that verifies your car stereo was indeed matched with the engine block/VIN for the vehicle. After the Harmon Kardon Radio Controls in our 2012 Mercedes E350 AMG failed and were replaced under warranty, the dealer simply contacted Mercedes who sent a signal to the car to reset the codes. I know that won't work for a 97 Beamer, but asked the service tech how it worked if for some reason down the line I replaced the factory sound system with a different factory sound system. He said just bring it by after installation and they would service the codes free of charge (as they should, we spent close to $70k on the E350). I hope that this helps!
Search BMW 3 Series Questions
BMW 3 Series Experts