intermittent problems with gear shift on semi automatic car?

I have a semi automatic A class Mercedes 170, 15 y.o.
2 days ago in the mornin I couldn´t get in to gears from parking with engine working. With engine off gears were shifting well . I was trying for one hour on and off with no result. After few howrs I checked the car again and it was working normally . I even could drive that day without any problems with soft shifting. Yesterday it happened again in the morning, no shifting possible. But after few howrs it was working again. The same is today. The letter "F" is displayed when shifting is not available.
Please, advice. How is possible to avoid big spendings and can I drive this car without danger to be stuck on the road with no shifting suddemly happened . Or it doesn´t happen when car is on drive already?
Valery, April 2016


link Click here to see other fixes for Mercedes.