I have two APC Back-UPS RS500 units which failed at charging the battery. It was a capacitor which failed on both of them and I have also found out that this failure is rather common for this UPS. Here is my description on how to repair them. If you have a similar problem that the UPS seems to work OK with a new and charged battery connected, but fails after a short time (days) with the 'replace battery' light on, then this could help you.
Stig Vidar Hovland