/*Query to get the Prepayment Account details of the Employee Suppliers */
SELECT
*
FROM
(
SELECT DISTINCT
pbg.name business_group_name,
papf.employee_number,
papf.full_name employee_name,
gcck.concatenated_segments prepayment_account_site_level,
hou.name opperating_unit_name,
apssa.vendor_site_code,
fu.user_name last_updated_user
FROM
apps.per_all_people_f papf,
apps.per_business_groups pbg,
apps.gl_code_combinations_kfv gcck,
apps.ap_suppliers aps,
apps.ap_supplier_sites_all apssa,
apps.fnd_user fu,
apps.hr_operating_units hou
WHERE
1 = 1
AND papf.current_employee_flag = ‘Y’
AND sysdate BETWEEN papf.effective_start_date AND papf.effective_end_date
AND papf.business_group_id = pbg.business_group_id
AND pbg.name IN ( ‘Test_BG’, ‘Test_SERVICES_BG’ )
AND vendor_type_lookup_code (+) = ‘EMPLOYEE’
AND papf.person_id = aps.employee_id (+)
AND aps.vendor_id = apssa.vendor_id (+)
AND apssa.prepay_code_combination_id = gcck.code_combination_id (+)
AND apssa.last_updated_by = fu.user_id (+)
AND apssa.org_id = hou.organization_id (+)
— AND papf.employee_number = ‘230092’
)