Hello Friends,
I fixed my own issue
If anyone facing similar issue in the future you can fix this by going to the page
Page - project/enroll/locallib.php
The query is split into two functions:
1. get_potential_users() - query is written - line 453 (approx)
// added LEFT JOIN to create link between registration number - 16.01.2019
LEFT JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
LEFT JOIN {user_info_data} uid ON (uid.userid = u.id)
WHERE $wherecondition AND ue.id IS NULL
";
2. get_basic_search_conditions - where search where condition is added more (in my case I have added also search by registration number)
// added the second where clause
$conditions[] = $DB->sql_fullname('u.firstname', 'u.lastname');
$conditions[] = 'uid.data'; // added for filtering by registration number - 16.01.2019
I have attached the locallib.php page as well for better understanding