I am getting error at following line
List<Group> groupMembers = [SELECT Id, RelatedId, Type FROM Group WHERE RelatedId IN: sRoleIds AND Type =: 'Role'];
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
There are only two (out of 100) SQOL queries in your code, so we can exclude a governor limits problem with it.
Most simple solution would be to look at the relative debug log (if your code runs only with partner users you can set up one of them to generate a debug log for you in setup > debug logs). Look at the end of the log and you should see a list of all governor limits, along with your usage. You should be able to notice that the 100 limit on SOQL queries has been reached.
Look in the log file to spot which other Apex classes/methods are running besides the one you posted, either one of them has a SOQL query in a loop (most likely) or you are recursively calling this - or another SOQL containing - class.
In both cases you have to refactor the offending class/method, there's no avoidance of a Too many SOQL error just by editing shareEndCustomersWithPartnerCommunity.