As Karl says, the cable is detached from the drive unit by two clips
(one in each end of the drive unit).
After putting it all together, the unit should be adjusted:
Inside the drive unit are two switches, which sense the position of the
roof (or rather the drive cable to the roof). There is a white knob on
the drive unit, which can be pulled out to "adjustment position", in
which it disengages from the drive cable. The drive unit gear can then
be turned by the knob
independently from the sunroof. Turn it several turns cw and ccw and
listen when the microswitches are actuated. With the sunroof closed,
the drive unit shall be aligned just in between the the two switches
actuating. Then push in the white knob and see if it the sunroof closes
correctly after having been opened or lifted. Readjust if necessary.