Suggest to repair at workshop. The usual keypoints and procedure of repair are:
1. Basice check the battery voltage, sunroof motor if it is at the origin position. Adjust if necessary.
2. Press and hold the sunroof open button for 5 seconds, and repeat the open and close operation to activate the sunroof auto returning function.
3. Check the wiring harness and socket, motor, fuse, and relay. Replace the wiring harness, motor assembly, switch and fuse if necessary.
4. Test the sunroof to ensure problem is resolved after repairing done.