It is not simple. You will need a library (or some steep reflection).
There are multiple steps involved:
1. Use Contacts Provider to get the contact_id of the Contact you want.
2. Use the Contacts Provider to fetch extra information about the contact especially Custom Ringtone field. This will return a URI of the custom ringtone.
3. Use Ringtone manager to pick a new ringtone, which will give you the URI.
4. Set the new ringtone back to the contact_id you found initially.
You can only do step 3 in B4A. You will need a library for step 1,2 and 4.
It is also possible to do with intents, but that requires a lot of experimentation IMO.