Problem solved!
It was the cps=crankshaft position/speed sensor.The heat coming from the sump caused the sensor to fail.It was ok when driving because the wind cooled it down.But when stopped and parked the heat made it fail=no spark.Actually it was quite easy to check.I just let the car idle so that it cut out.Then cooled the cps with compressed air and after that it started properly.I did the test couple of times just to make sure it was not just coincidence.
PS.try to help Yrkesman,he has a really weird thing going on on his cossie...