Hi,
I would suggest to start looking at identity management solution (e.g. SAP IdM). You can build automatic PID determination in IdM. I assume that you don't have CUA at this moment. CUA would help you to speed up user maintenance so it could be a good temporary solution. If you want to have something fully automatic then you could build a custom report that determines and assigns PIDs to a user. SAP has standard BAPIs that can be used for this. Every solution has benefits and cost associated with it. IdM being the most expensive but providing future proof solution.
Cheers