Ok then, bmw has a bulletin issued for 5 series models likes yours, but it only applies to the 545 v-8 models. This tyoe of software update could only be done at the dealer, since it requires special programming equipment, and an activation code provided by bmw engineering. I have provided a copy of the bulletin.
If you do not have the v8 model, there is no software fix currently for this issue.
I would first check to see if the transmission is leaking at all. Take a look underneath and see if there is any oil on the plastic tray under the transmission.
If its leaking, then the fluid is likely low, and can cause poor shifting.
Most common leaks are from the electrical connector sleeve, and the plastic trans pan itself. Replace as needed, and top up the fluid.
Then reseting the transmission computers adaptations will often result in better shifting quality. This would require a bmw specific scan tool, to reset the adaptations.