Yearly Archive 2 October 2025

ByMandeep Gupta

BIP – List of departments associated with a specific business unit

In Oracle Fusion HCM, a business unit can be linked to either a common reference data set or a specific one. When associated with a specific reference data set, the business unit gains access to departments defined within that set, as well as those available in the common reference data set. The SQL query provided in this article retrieves all departments accessible to the selected business unit, based on its reference data set associations.

WITH set_details
AS
(
  SELECT fabuv.bu_name 				business_unit_name
        ,fabuv.bu_id				business_unit_id
        ,fss.set_id
        ,fss.set_code
        ,fss.set_name
    FROM FND_SETID_SETS 		fss
        ,FND_SETID_ASSIGNMENTS 	        fsa
  	,FUN_ALL_BUSINESS_UNITS_V       fabuv
   WHERE fabuv.bu_name = 'Enterprise'
     AND fsa.determinant_type = 'BU'
     AND fsa.determinant_value = fabuv.bu_id
     AND fsa.reference_group_name = 'PER_DEPARTMENTS'
     AND fsa.set_id = fss.set_id
     AND fss.set_id <> 0
     AND fss.language = 'US'
     AND TRUNC(SYSDATE) BETWEEN fabuv.date_from AND fabuv.date_to
  UNION
  SELECT fabuv.bu_name 				                business_unit_name
        ,fabuv.bu_id					        business_unit_id
        ,0							set_id
        ,'COMMON'						set_code
        ,'Common'						set_name
    FROM FUN_ALL_BUSINESS_UNITS_V fabuv
   WHERE fabuv.bu_name = 'Discrete Automation'
     AND TRUNC(SYSDATE) BETWEEN fabuv.date_from AND fabuv.date_to   
)
SELECT pd.name					        department
      ,pd.organization_id 				department_id
      ,DECODE(pd.status,'A','Active','Inactive') 	department_status 
      ,set_details.business_unit_name
      ,set_details.set_name
  FROM per_departments 	pd
      ,set_details	set_details
 WHERE pd.set_id = set_details.set_id 	 
   AND TRUNC(SYSDATE) BETWEEN pd.effective_start_date AND pd.effective_end_date
ORDER BY 1 
ByMandeep Gupta

BIP – Extract Grade Ladder, Grade and Step details

Below query can be used to extract grade ladder, grades in ladder and step details of a grade.

SELECT pglftl.name  		grade_ladder_name
     , pglf.grade_type		grade_type
     , pglf.active_status	active_status
     , pgftl.name		grade_name
     , pgilf.sequence		grade_seq_in_ladder
     , pgsf.sequence		grade_step_seq 
     , pgsftl.name		grade_step_name
  FROM PER_GRADE_LADDERS_F pglf
     , PER_GRADE_LADDERS_F_TL pglftl
     , PER_GRADES_IN_LADDERS_F pgilf  
     , PER_GRADES_F_TL pgftl 
     , PER_GRADE_STEPS_F pgsf	 
     , PER_GRADE_STEPS_F_TL pgsftl
WHERE pglf.grade_ladder_id = pglftl.grade_ladder_id
  AND TRUNC(SYSDATE) BETWEEN TRUNC(pglf.effective_start_date) AND TRUNC(pglf.effective_end_date)
  AND pglftl.language='US'
  AND TRUNC(SYSDATE) BETWEEN TRUNC(pglftl.effective_start_date) AND TRUNC(pglftl.effective_end_date)
  AND pgilf.grade_ladder_id = pglftl.grade_ladder_id
  AND TRUNC(SYSDATE) BETWEEN TRUNC(pgilf.effective_start_date) AND TRUNC(pgilf.effective_end_date) 
  AND pgftl.language='US'  
  AND TRUNC(SYSDATE) BETWEEN TRUNC(pgftl.effective_start_date) AND TRUNC(pgftl.effective_end_date)
  AND pgilf.grade_id = pgftl.grade_id
  AND pgsf.grade_id = pgftl.grade_id
  AND TRUNC(SYSDATE) BETWEEN TRUNC(pgsf.effective_start_date) AND TRUNC(pgsf.effective_end_date)
  AND pgsftl.grade_step_id = pgsf.grade_step_id
  AND pgsftl.language='US' 
  AND trunc(sysdate) between trunc(pgsftl.effective_start_date) and trunc(pgsftl.effective_end_date)

ByMandeep Gupta

BIP – Report to extract BIP scheduled jobs

I have designed below query to extract the schedule of a BIP submitted jobs which is not available directly. Replace the job name attribute with your job name or run it for all:

/*******************************************************************************************
Job Status	-	HRC_LOADER_ESS_STATE
		1	-	Wait
		2	-	Ready
		3	-	Running
		4	-	Completed
		5	-	Blocked
		6	-	Hold
		7	-	Canceling
		8	-	Expired
		9	-	Canceled
	       10	-	Error
	       11	-	Warning
	       12	-	Succeeded
	       13	-	Paused
	       14	-	Pending Validation
	       15	-	Validation Failed
	       16	-	Schedule Ended
	       18	-	Error Auto Retry
	       19	-	Error Manual recovery
*******************************************************************************************/

WITH schedule_history
AS
(
SELECT DISTINCT rh.username	        scheduled_user_name
	  ,rp.value        		submitted_job_name 
          ,rh.processstart		last_job_start_date
          ,rh.processend		last_job_end_date	  
     -- ,rh.elapsedtime		elapsedtime	  
	  ,flv.meaning 			last_job_status	  
          ,rh.requestedstart	        schedule_start_date
          ,rh.requestedend		schedule_end_date
	  ,rh.scheduled    		next_run_date
	  ,rh.parentrequestid
	  ,rh.requestid
      ,SUBSTR(SUBSTR(REPLACE(rh.adhocschedule,chr(0)
	                        ),3
					)
				   ,(INSTR(SUBSTR(REPLACE(rh.adhocschedule,chr(0)
				                         ),3
							      )
						   ,'FREQ=')+5
					)
				   ,(INSTR(SUBSTR(REPLACE(rh.adhocschedule,chr(0)
				                         ),3
								  )
						   ,';'
						   )
					 - INSTR(SUBSTR(REPLACE(rh.adhocschedule,chr(0)
					                       ),3
								   )
							,'FREQ=')-5
							) 
			 ) schedule_frequency
       ,SUBSTR(SUBSTR(REPLACE(rh.adhocschedule,chr(0)
	                         ),3
					  )
					  ,(INSTR(SUBSTR(REPLACE(rh.adhocschedule,chr(0)
					                        ),3
									),';'
							 )+1),(INSTR(SUBSTR(REPLACE(rh.adhocschedule,chr(0)
							                           ),3
											   ),';</ical-expression>'
										)-INSTR(SUBSTR(REPLACE(rh.adhocschedule,chr(0)
										                      ),3
													   ),';'
											   )-1
								  )
				) schedule_interval	  	  
	  ,(SELECT max(rh2.requestid) 
	      FROM fusion.ess_request_history rh2 
         WHERE rh2.parentrequestid = rh.parentrequestid
		   AND rh.username = rh2.username
		   AND rh2.state = 1) next_requestid
  FROM fusion.ess_request_property rp
      ,fusion.request_history rh
      ,fusion.ess_request_property rp_Param
      ,fusion.fnd_lookup_values flv
WHERE rp.value LIKE '%TEST%NAME%'
  AND rh.requestid = rp.requestid
  AND rh.processstart >= TRUNC(SYSDATE,'MONTH')
  AND rp_Param.requestid = rp.requestid
  AND rp.NAME = 'ujobname'
  AND flv.lookup_type = 'HRC_LOADER_ESS_STATE'
  AND flv.language = USERENV('LANG')
  AND flv.lookup_code = rh.state  
  AND rh.requestid = (select max(rh2.requestid) from fusion.ess_request_history rh2 
                       where rh2.parentrequestid = rh.parentrequestid
					     and rh.USERNAME = rh2.USERNAME
						 AND rh2.state <> 1) -- 1 is wait
)
SELECT schedule_history.scheduled_user_name
      ,MAX(DECODE (rp.name, 'report_url', value)) 		report_url
      ,MAX(DECODE (rp.name, 'layout_name', value)) 		layout_name
      ,schedule_history.submitted_job_name
      ,schedule_history.schedule_start_date
      ,schedule_history.schedule_end_date
      ,schedule_history.schedule_frequency
      ,schedule_history.schedule_interval
      ,rh.scheduled  							next_schedule_date	  
	  ,flv.meaning 										next_job_status
      ,MAX(DECODE (rp.name, 'CONTROL_XML', value)) 		output_details
      ,MAX(DECODE (rp.name, 'OUTPUT_FORMAT', value)) 		output_format
      ,MAX(DECODE (rp.name, 'save_data', value)) 			output_save_data
      ,MAX(DECODE (rp.name, 'email_notification', value)) email_notification
      ,MAX(DECODE (rp.name, 'is_bursting', value))    	bursting_used
      ,MAX(DECODE (rp.name, 'notify_email_when_failed', value)) 	notify_email_when_failed
      ,MAX(DECODE (rp.name, 'notify_email_when_skipped', value)) 	notify_email_when_skipped
      ,MAX(DECODE (rp.name, 'notify_email_when_success', value)) 	notify_email_when_success
      ,MAX(DECODE (rp.name, 'notify_email_when_warning', value)) 	notify_email_when_warning
      ,MAX(DECODE (rp.name, 'notify_to', value)) 					notify_to
      ,MAX(DECODE (rp.name, 'report_param_displays', value)) 		report_param_displays
      ,MAX(DECODE (rp.name, 'report_params', value)) 				report_params
	  ,schedule_history.last_job_start_date 		last_job_start_date
	  ,schedule_history.last_job_end_date 			last_job_end_date
	 -- ,schedule_history.elapsedtime 				last_job_elapsedtime
	  ,schedule_history.last_job_status 			last_job_status  
	  ,schedule_history.parentrequestid				parent_request_id
	  ,schedule_history.requestid					last_job_request_id
	  ,rh.requestid									scheduled_job_request_id
  FROM schedule_history schedule_history
      ,fusion.request_history rh
      ,fusion.ess_request_property rp	  
	  ,fusion.fnd_lookup_values flv
 WHERE schedule_history.parentrequestid = rh.parentrequestid
   AND schedule_history.next_requestid = rh.requestid
   AND flv.lookup_type = 'HRC_LOADER_ESS_STATE'
   AND flv.language = USERENV('LANG')
   AND flv.lookup_code = rh.state
   AND rp.requestid = rh.requestid   
 GROUP BY schedule_history.scheduled_user_name
         ,schedule_history.submitted_job_name
         ,schedule_history.schedule_start_date
         ,schedule_history.schedule_end_date
         ,schedule_history.schedule_frequency
         ,schedule_history.schedule_interval		 
	 ,rh.scheduled    
	 ,flv.meaning
	 ,schedule_history.last_job_start_date 
	 ,schedule_history.last_job_end_date 	
	 -- ,schedule_history.elapsedtime 			
	 ,schedule_history.last_job_status 		
	 ,schedule_history.parentrequestid	
	 ,schedule_history.requestid
	 ,rh.requestid	
ByMandeep Gupta

BIP – Query to fetch assignment costing details

SELECT prgd.assignment_id
     , pprd.payroll_relationship_id
     , pprd.payroll_relationship_number
     , prt.legislation_code
     , prt.process_in_run
     , prt.base_rel_type_name
     , prtt.relationship_type_name
     , prtt.description
     , pcaf.effective_start_date
     , pcaf.effective_end_date
     , pcaa.segment1
     , pcaa.segment2
     , pcaa.segment3
     , pcaa.segment4
  FROM pay_rel_groups_dn prgd
     , pay_pay_relationships_dn pprd
     , pay_relationship_types prt
     , pay_relationship_types_tl prtt
     , pay_cost_allocations_f pcaf
     , pay_cost_alloc_accounts pcaa
 WHERE pcaf.source_type = 'ASG'
   AND pprd.payroll_relationship_id = pcaf.payroll_relationship_id
   AND pcaf.cost_allocation_record_id = pcaa.cost_allocation_record_id
   AND pprd.payroll_relationship_id = prgd.payroll_relationship_id
   AND prgd.relationship_group_id = pcaf.source_id
   AND trunc(sysdate) BETWEEN pcaf.effective_start_date AND pcaf.effective_end_date
   AND trunc(sysdate) BETWEEN pprd.start_date AND pprd.end_date
   AND pprd.relationship_type_id = prt.relationship_type_id
   AND prt.relationship_type_id = prtt.relationship_type_id
   AND prtt.language = 'US'
   AND pprd.person_id = (select distinct person_id from per_all_people_f where person_number = '212')