Have found this info in the manual:
"If the battery has been disconnected, the one touch
and anti-trap function will become inoperative. These
functions can be reset by fully opening and closing,
then fully tilting and closing the sunroof panel in one
continuous operation. An audible warning will sound
and SUNROOF NOT SET will be displayed on the
message centre in the instrument pack when the
sunroof is being operated.
When the above procedure has been successfully
completed, an audible warning will sound and
SUNROOF SET will be displayed on the message
centre."
You can try to see if that gets it working correctly.