trans fail safe program on 1998 BMW 740i

My car first started a rough downshift in the lower gears than later would run fine for about a mile before the gears just shut down. As if in a higher gear and just moved an inch at a time. Then the trans fail safe program message appeared. Any ideas what it might be ?

Asked by for the 1998 BMW 740i