there is no existing coding option for this type of functionality. the only available option is for folding in via key fob.
to enable anything else like what you want or fold in when engine is off, there needs to be additional wiring with relays tapped to the correct points within the car as well as to the mirrors to cause them to fold/unfold.
here's how it had been done on a 5 series
http://forum.bmw5.co.uk/topic/59398-...-as-requested/