The good news is that you don't have to remove the slide end cap.
The rear sight base is held in position by the rear sight plunger (on the right side of the base). The plunger has a machined slot on the top in which the edge of the windage screw slips. (This is done by depressing the plunger and installing the sight base from the left until the plunger can be released so the slot catches the bottom edge of the windage screw.) The plunger holding the edge of the windage screw is what holds the sight base in the dovetail.
The plunger is the 'weak link' in this sight design. An impact can cause one or the other of the edges of the slot on top of the plunger head to break off. This can result in the windage screw not being held in position.
The rear sight base is removed by using the flat tip of a small regular screwdriver to depress the plunger (outer lip of slot, or the broken edge of same if the right side broke off) so the sear sight base can be pushed to the left and out of the dovetail. Carefully release the plunger and remove it and its spring from the plunger hole in the slide. (Safety glasses can be handy if the plunger unexpectedly slips free.)
If the sight base has shifted to the right, over the top of the plunger, then you can't get at the plunger to depress it. If that happens the windage screw must be removed (Note the left hand thread). This will lose the sight adjustment because the windage screw must now be reinstalled and then the sight re-zeroed when the new plunger and spring are installed and the sight base is reinstalled in the slide.
In the armorer classes I've attended for the SW99/P99 series, I think someone has mistakenly tried to either remove the rear sight to the right, or install it from the right, in each class. This caused the sight to slide completely over the top of the rear sight plunger and completely' capture' the plunger ... requiring the removal of the windage screw in order to be able to remove the rear sight base and free the plunger.
I've had to replace a couple of rear sight plungers because of damage when the guns were dropped by our folks. I've also heard that aggressively buckling a seat belt can break the plunger slot if the buckle is hit against the rear sight base of a holstered gun.
After the first time one of our folks dropped his gun down some concrete stairs and damaged the plastic rear sight, as well as breaking the top of the rear sight plunger, I decided to keep a few extra bases, plungers & springs on hand.