I had the same problem a few weeks ago. Had the transmission rebuilt by a former BMW tech that put up his own shop. After the rebuild it was still doing the trans program. To make the story short, he replaced the throttle position sensor, the coolant temp sensor and the crankshaft position sensor. Now the car is running like new, very imperceptible shifts and very smooth idle.......steady at 900 RPM. If I were you I will replace the throttle position sensor first and then go from there.
If you have been driving the car in limp mode for a long while you may have already burned up the clutch packs. If not I will flush out the trans fluid, replace the filter and put fresh fluids.
'74 Corvette, '90 Supra Turbo, '90 EAT'd 535i, '94 740iL