DBA Data[Home] [Help]

APPS.PSB_POSITION_CONTROL_PVT SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 25

       delete_flag           BOOLEAN);
Line: 37

       delete_flag               BOOLEAN);
Line: 50

       delete_flag               BOOLEAN);
Line: 145

  SELECT ppf.attribute_Value
  FROM   psb_position_assignments ppf
  WHERE  ppf.data_extract_id = c_data_extract_id
  AND    ppf.position_id = c_position_id
  AND    nvl(worksheet_id, -1)  = nvl(c_worksheet_id, -1)
  AND    ppf.attribute_id = c_attribute_Id
  AND    c_budget_year_end_date BETWEEN effective_start_date AND
                                nvl(effective_end_date, c_budget_year_end_date);
Line: 295

    select PSB_ATTRIBUTE_VALUES_S.NEXTVAL seq
      from dual;
Line: 299

    select *
      from PSB_ATTRIBUTE_VALUES a
     where data_extract_id = p_source_data_extract_id
       and exists
	  (select 1 from PSB_ATTRIBUTES_VL b
	    where b.attribute_id = a.attribute_id
	      and b.business_group_id = p_source_business_group_id)
       and attribute_value is not null;
Line: 309

    select attribute_value_id
      from PSB_ATTRIBUTE_VALUES
     where attribute_value = attrval
       and attribute_id = attrid
       and data_extract_id = p_target_data_extract_id;
Line: 337

      PSB_ATTRIBUTE_VALUES_PVT.Insert_Row
	 (p_api_version => 1.0,
	  p_return_status => l_return_status,
	  p_msg_count => l_msg_count,
	  p_msg_data => l_msg_data,
	  p_rowid => l_rowid,
	  p_attribute_value_id => l_attribute_value_id,
	  p_attribute_id => c_attrval_rec.attribute_id,
	  p_attribute_value => c_attrval_rec.attribute_value,
	  p_description => c_attrval_rec.description,
	  p_hr_value_id => c_attrval_rec.hr_value_id,
	  p_data_extract_id => p_target_data_extract_id,
	  p_attribute1 => c_attrval_rec.attribute1,
	  p_attribute2 => c_attrval_rec.attribute2,
	  p_attribute3 => c_attrval_rec.attribute3,
	  p_attribute4 => c_attrval_rec.attribute4,
	  p_attribute5 => c_attrval_rec.attribute5,
	  p_attribute6 => c_attrval_rec.attribute6,
	  p_attribute7 => c_attrval_rec.attribute7,
	  p_attribute8 => c_attrval_rec.attribute8,
	  p_attribute9 => c_attrval_rec.attribute9,
	  p_attribute10 => c_attrval_rec.attribute10,
	  p_attribute11 => c_attrval_rec.attribute11,
	  p_attribute12 => c_attrval_rec.attribute12,
	  p_attribute13 => c_attrval_rec.attribute13,
	  p_attribute14 => c_attrval_rec.attribute14,
	  p_attribute15 => c_attrval_rec.attribute15,
	  p_attribute16 => c_attrval_rec.attribute16,
	  p_attribute17 => c_attrval_rec.attribute17,
	  p_attribute18 => c_attrval_rec.attribute18,
	  p_attribute19 => c_attrval_rec.attribute19,
	  p_attribute20 => c_attrval_rec.attribute20,
	  p_attribute21 => c_attrval_rec.attribute21,
	  p_attribute22 => c_attrval_rec.attribute22,
	  p_attribute23 => c_attrval_rec.attribute23,
	  p_attribute24 => c_attrval_rec.attribute24,
	  p_attribute25 => c_attrval_rec.attribute25,
	  p_attribute26 => c_attrval_rec.attribute26,
	  p_attribute27 => c_attrval_rec.attribute27,
	  p_attribute28 => c_attrval_rec.attribute28,
	  p_attribute29 => c_attrval_rec.attribute29,
	  p_attribute30 => c_attrval_rec.attribute30,
	  p_context => c_attrval_rec.context,
	  p_last_update_date => sysdate,
	  p_last_updated_by => FND_GLOBAL.USER_ID,
	  p_last_update_login => FND_GLOBAL.LOGIN_ID,
	  p_created_by => FND_GLOBAL.USER_ID,
	  p_creation_date => sysdate);
Line: 393

	 then update the with the current value. Changes done by Siva */
    begin
      PSB_ATTRIBUTE_VALUES_PVT.Update_Row
	 (p_api_version => 1.0,
	  p_init_msg_list => null,
	  p_commit => null,
	  p_validation_level => null,
	  p_return_status => l_return_status,
	  p_msg_count => l_msg_count,
	  p_msg_data => l_msg_data,
	  p_attribute_value_id => l_attribute_value_id,
	  p_attribute_id => c_attrval_rec.attribute_id,
	  p_attribute_value => c_attrval_rec.attribute_value,
	  p_description => c_attrval_rec.description,
	  p_hr_value_id => c_attrval_rec.hr_value_id,
	  p_data_extract_id => p_target_data_extract_id,
	  p_attribute1 => c_attrval_rec.attribute1,
	  p_attribute2 => c_attrval_rec.attribute2,
	  p_attribute3 => c_attrval_rec.attribute3,
	  p_attribute4 => c_attrval_rec.attribute4,
	  p_attribute5 => c_attrval_rec.attribute5,
	  p_attribute6 => c_attrval_rec.attribute6,
	  p_attribute7 => c_attrval_rec.attribute7,
	  p_attribute8 => c_attrval_rec.attribute8,
	  p_attribute9 => c_attrval_rec.attribute9,
	  p_attribute10 => c_attrval_rec.attribute10,
	  p_attribute11 => c_attrval_rec.attribute11,
	  p_attribute12 => c_attrval_rec.attribute12,
	  p_attribute13 => c_attrval_rec.attribute13,
	  p_attribute14 => c_attrval_rec.attribute14,
	  p_attribute15 => c_attrval_rec.attribute15,
	  p_attribute16 => c_attrval_rec.attribute16,
	  p_attribute17 => c_attrval_rec.attribute17,
	  p_attribute18 => c_attrval_rec.attribute18,
	  p_attribute19 => c_attrval_rec.attribute19,
	  p_attribute20 => c_attrval_rec.attribute20,
	  p_attribute21 => c_attrval_rec.attribute21,
	  p_attribute22 => c_attrval_rec.attribute22,
	  p_attribute23 => c_attrval_rec.attribute23,
	  p_attribute24 => c_attrval_rec.attribute24,
	  p_attribute25 => c_attrval_rec.attribute25,
	  p_attribute26 => c_attrval_rec.attribute26,
	  p_attribute27 => c_attrval_rec.attribute27,
	  p_attribute28 => c_attrval_rec.attribute28,
	  p_attribute29 => c_attrval_rec.attribute29,
	  p_attribute30 => c_attrval_rec.attribute30,
	  p_context => c_attrval_rec.context,
	  p_last_update_date => sysdate,
	  p_last_updated_by => FND_GLOBAL.USER_ID,
	  p_last_update_login => FND_GLOBAL.LOGIN_ID);
Line: 511

    select business_group_id
      from PSB_DATA_EXTRACTS
     where data_extract_id = p_source_data_extract_id;
Line: 517

    select *
      from PSB_PAY_ELEMENTS
     where pay_element_id = p_pay_element_id;
Line: 522

    select pay_element_id, rowid
      from PSB_PAY_ELEMENTS
     where name = elemname
       and data_extract_id = p_target_data_extract_id;
Line: 528

    select *
      from PSB_PAY_ELEMENT_OPTIONS
     where pay_element_id = elemid;
Line: 533

    select pay_element_option_id
      from PSB_PAY_ELEMENT_OPTIONS
     where name = optname
       and pay_element_id = elemid;
Line: 539

    select *
      from PSB_PAY_ELEMENT_RATES
     where worksheet_id is null
       and pay_element_option_id = elemoptionid
       and pay_element_id = elemid;
Line: 546

    select *
      from PSB_PAY_ELEMENT_RATES
     where worksheet_id is null
       and pay_element_id = elemid;
Line: 552

    select *
      from PSB_ELEMENT_POS_SET_GROUPS
     where pay_element_id = elemid;
Line: 557

    select *
      from PSB_SET_RELATIONS
     where position_set_group_id = possetgrpid;
Line: 562

    select *
      from PSB_ACCOUNT_POSITION_SETS
     where account_position_set_id = possetid;
Line: 567

    select *
      from PSB_ACCOUNT_POSITION_SET_LINES
     where account_position_set_id = possetid;
Line: 572

    select *
      from PSB_POSITION_SET_LINE_VALUES
     where line_sequence_id = lineseqid;
Line: 577

    select account_position_set_id, rowid
      from PSB_ACCOUNT_POSITION_SETS
     where data_extract_id = p_target_data_extract_id
       and account_or_position_type = 'P'
       and name = possetname;
Line: 584

    select value_sequence_id
      from PSB_POSITION_SET_LINE_VALUES
     where attribute_value = attrval
       and line_sequence_id = lineseqid;
Line: 590

    select a.attribute_value_id
      from PSB_ATTRIBUTE_VALUES a,
	   PSB_ATTRIBUTE_VALUES b
     where a.data_extract_id = p_target_data_extract_id
       and a.attribute_value = b.attribute_value
       and a.attribute_id    = b.attribute_id -- added for Bug#4262388
       and b.attribute_value_id = attrvalid;
Line: 599

    select line_sequence_id
      from PSB_ACCOUNT_POSITION_SET_LINES
     where attribute_id = attrid
       and account_position_set_id = possetid;
Line: 605

    select *
      from PSB_PAY_ELEMENT_DISTRIBUTIONS
     where position_set_group_id = possetgrpid;
Line: 610

    select psb_pay_elements_s.nextval seq
      from dual;
Line: 614

    select psb_pay_element_options_s.nextval seq
      from dual;
Line: 618

    select PSB_ACCOUNT_POSITION_SETS_S.NEXTVAL seq
      from dual;
Line: 622

    select PSB_ACCT_POSITION_SET_LINES_S.NEXTVAL seq
      from dual;
Line: 626

    select PSB_POSITION_SET_LINE_VALUES_S.NEXTVAL seq
      from dual;
Line: 630

    select PSB_SET_RELATIONS_S.NEXTVAL seq
      from dual;
Line: 634

    select PSB_ELEMENT_POS_SET_GROUPS_S.NEXTVAL seq
      from dual;
Line: 638

    select PSB_PAY_ELEMENT_DISTRIBUTION_S.NEXTVAL seq
      from dual;
Line: 679

      PSB_PAY_ELEMENTS_PVT.INSERT_ROW
	 (p_api_version => 1.0,
	  p_return_status => l_return_status,
	  p_msg_count => l_msg_count,
	  p_msg_data => l_msg_data,
	  p_row_id => l_rowid,
	  p_pay_element_id => l_pay_element_id,
	  p_budget_set_id => c_elem_rec.budget_set_id,
	  p_business_group_id => c_elem_rec.business_group_id,
	  p_data_extract_id => p_target_data_extract_id,
	  p_name => c_elem_rec.name,
	  p_description => c_elem_rec.description,
	  p_element_value_type => c_elem_rec.element_value_type,
	  p_formula_id => c_elem_rec.formula_id,
	  p_overwrite_flag => c_elem_rec.overwrite_flag,
	  p_required_flag => c_elem_rec.required_flag,
	  p_follow_salary => c_elem_rec.follow_salary,
	  p_pay_basis => c_elem_rec.pay_basis,
	  p_start_date => c_elem_rec.start_date,
	  p_end_date => c_elem_rec.end_date,
	  p_processing_type => c_elem_rec.processing_type,
	  p_period_type => c_elem_rec.period_type,
	  p_process_period_type => c_elem_rec.process_period_type,
	  p_max_element_value_type => c_elem_rec.max_element_value_type,
	  p_max_element_value => c_elem_rec.max_element_value,
	  p_salary_flag => c_elem_rec.salary_flag,
	  p_salary_type => c_elem_rec.salary_type,
	  p_option_flag => c_elem_rec.option_flag,
	  p_hr_element_type_id => c_elem_rec.hr_element_type_id,
	  p_attribute_category => c_elem_rec.attribute_category,
	  p_attribute1 => c_elem_rec.attribute1,
	  p_attribute2 => c_elem_rec.attribute2,
	  p_attribute3 => c_elem_rec.attribute3,
	  p_attribute4 => c_elem_rec.attribute4,
	  p_attribute5 => c_elem_rec.attribute5,
	  p_attribute6 => c_elem_rec.attribute6,
	  p_attribute7 => c_elem_rec.attribute7,
	  p_attribute8 => c_elem_rec.attribute8,
	  p_attribute9 => c_elem_rec.attribute9,
	  p_attribute10 => c_elem_rec.attribute10,
	  p_last_update_date => sysdate,
	  p_last_updated_by => FND_GLOBAL.USER_ID,
	  p_last_update_login => FND_GLOBAL.LOGIN_ID,
	  p_created_by => FND_GLOBAL.USER_ID,
	  p_creation_date => sysdate);
Line: 738

	  PSB_PAY_ELEMENT_OPTIONS_PVT.INSERT_ROW
	     (p_api_version => 1.0,
	      p_return_status => l_return_status,
	      p_msg_count => l_msg_count,
	      p_msg_data => l_msg_data,
	      p_pay_element_option_id => l_pay_element_option_id,
	      p_pay_element_id => l_pay_element_id,
	      p_name => c_elemoptions_rec.name,
	      p_grade_step => c_elemoptions_rec.grade_step,
	      p_sequence_number => c_elemoptions_rec.sequence_number,
	      p_last_update_date => sysdate,
	      p_last_updated_by => FND_GLOBAL.USER_ID,
	      p_last_update_login => FND_GLOBAL.LOGIN_ID,
	      p_created_by => FND_GLOBAL.USER_ID,
	      p_creation_date => sysdate);
Line: 828

	PSB_ELEMENT_POS_SET_GROUPS_PVT.Insert_Row
	   (p_api_version => 1.0,
	    p_return_status => l_return_status,
	    p_msg_count => l_msg_count,
	    p_msg_data => l_msg_data,
	    p_position_set_group_id => l_position_set_group_id,
	    p_pay_element_id => l_pay_element_id,
	    p_name => c_possetgrp_rec.name,
	    p_last_update_date => sysdate,
	    p_last_updated_by => FND_GLOBAL.USER_ID,
	    p_last_update_login => FND_GLOBAL.LOGIN_ID,
	    p_created_by => FND_GLOBAL.USER_ID,
	    p_creation_date => sysdate);
Line: 869

	      PSB_ACCOUNT_POSITION_SET_PVT.Insert_Row
		 (p_api_version => 1.0,
		  p_return_status => l_return_status,
		  p_msg_count => l_msg_count,
		  p_msg_data => l_msg_data,
		  p_row_id => l_rowid,
		  p_account_position_set_id => l_position_set_id,
		  p_name => c_posset_rec.name,
		  p_set_of_books_id => c_posset_rec.set_of_books_id,
		  p_use_in_budget_group_flag => c_posset_rec.use_in_budget_group_flag,
		  p_data_extract_id => p_target_data_extract_id,
		  p_global_or_local_type => c_posset_rec.global_or_local_type,
		  p_account_or_position_type =>c_posset_rec.account_or_position_type,
		  p_attribute_selection_type => c_posset_rec.attribute_selection_type,
		  p_business_group_id => c_posset_rec.business_group_id,
		  p_last_update_date => sysdate,
		  p_last_updated_by => FND_GLOBAL.USER_ID,
		  p_last_update_login => FND_GLOBAL.LOGIN_ID,
		  p_created_by => FND_GLOBAL.USER_ID,
		  p_creation_date => sysdate);
Line: 900

		PSB_ACCT_POSITION_SET_LINE_PVT.Insert_Row
		   (p_api_version => 1.0,
		    p_return_status => l_return_status,
		    p_msg_count => l_msg_count,
		    p_msg_data => l_msg_data,
		    p_row_id => l_rowid,
		    p_line_sequence_id => l_line_sequence_id,
		    p_account_position_set_id => l_position_set_id,
		    p_description => c_possetline_rec.description,
		    p_business_group_id => c_possetline_rec.business_group_id,
		    p_attribute_id => c_possetline_rec.attribute_id,
		    p_include_or_exclude_type => c_possetline_rec.include_or_exclude_type,
		    p_segment1_low => c_possetline_rec.segment1_low,
		    p_segment2_low => c_possetline_rec.segment2_low,
		    p_segment3_low => c_possetline_rec.segment3_low,
		    p_segment4_low => c_possetline_rec.segment4_low,
		    p_segment5_low => c_possetline_rec.segment5_low,
		    p_segment6_low => c_possetline_rec.segment6_low,
		    p_segment7_low => c_possetline_rec.segment7_low,
		    p_segment8_low => c_possetline_rec.segment8_low,
		    p_segment9_low => c_possetline_rec.segment9_low,
		    p_segment10_low => c_possetline_rec.segment10_low,
		    p_segment11_low => c_possetline_rec.segment11_low,
		    p_segment12_low => c_possetline_rec.segment12_low,
		    p_segment13_low => c_possetline_rec.segment13_low,
		    p_segment14_low => c_possetline_rec.segment14_low,
		    p_segment15_low => c_possetline_rec.segment15_low,
		    p_segment16_low => c_possetline_rec.segment16_low,
		    p_segment17_low => c_possetline_rec.segment17_low,
		    p_segment18_low => c_possetline_rec.segment18_low,
		    p_segment19_low => c_possetline_rec.segment19_low,
		    p_segment20_low => c_possetline_rec.segment20_low,
		    p_segment21_low => c_possetline_rec.segment21_low,
		    p_segment22_low => c_possetline_rec.segment22_low,
		    p_segment23_low => c_possetline_rec.segment23_low,
		    p_segment24_low => c_possetline_rec.segment24_low,
		    p_segment25_low => c_possetline_rec.segment25_low,
		    p_segment26_low => c_possetline_rec.segment26_low,
		    p_segment27_low => c_possetline_rec.segment27_low,
		    p_segment28_low => c_possetline_rec.segment28_low,
		    p_segment29_low => c_possetline_rec.segment29_low,
		    p_segment30_low => c_possetline_rec.segment30_low,
		    p_segment1_high => c_possetline_rec.segment1_high,
		    p_segment2_high => c_possetline_rec.segment2_high,
		    p_segment3_high => c_possetline_rec.segment3_high,
		    p_segment4_high => c_possetline_rec.segment4_high,
		    p_segment5_high => c_possetline_rec.segment5_high,
		    p_segment6_high => c_possetline_rec.segment6_high,
		    p_segment7_high => c_possetline_rec.segment7_high,
		    p_segment8_high => c_possetline_rec.segment8_high,
		    p_segment9_high => c_possetline_rec.segment9_high,
		    p_segment10_high => c_possetline_rec.segment10_high,
		    p_segment11_high => c_possetline_rec.segment11_high,
		    p_segment12_high => c_possetline_rec.segment12_high,
		    p_segment13_high => c_possetline_rec.segment13_high,
		    p_segment14_high => c_possetline_rec.segment14_high,
		    p_segment15_high => c_possetline_rec.segment15_high,
		    p_segment16_high => c_possetline_rec.segment16_high,
		    p_segment17_high => c_possetline_rec.segment17_high,
		    p_segment18_high => c_possetline_rec.segment18_high,
		    p_segment19_high => c_possetline_rec.segment19_high,
		    p_segment20_high => c_possetline_rec.segment20_high,
		    p_segment21_high => c_possetline_rec.segment21_high,
		    p_segment22_high => c_possetline_rec.segment22_high,
		    p_segment23_high => c_possetline_rec.segment23_high,
		    p_segment24_high => c_possetline_rec.segment24_high,
		    p_segment25_high => c_possetline_rec.segment25_high,
		    p_segment26_high => c_possetline_rec.segment26_high,
		    p_segment27_high => c_possetline_rec.segment27_high,
		    p_segment28_high => c_possetline_rec.segment28_high,
		    p_segment29_high => c_possetline_rec.segment29_high,
		    p_segment30_high => c_possetline_rec.segment30_high,
		    p_context => c_possetline_rec.context,
		    p_attribute1 => c_possetline_rec.attribute1,
		    p_attribute2 => c_possetline_rec.attribute2,
		    p_attribute3 => c_possetline_rec.attribute3,
		    p_attribute4 => c_possetline_rec.attribute4,
		    p_attribute5 => c_possetline_rec.attribute5,
		    p_attribute6 => c_possetline_rec.attribute6,
		    p_attribute7 => c_possetline_rec.attribute7,
		    p_attribute8 => c_possetline_rec.attribute8,
		    p_attribute9 => c_possetline_rec.attribute9,
		    p_attribute10 => c_possetline_rec.attribute10,
		    p_last_update_date => sysdate,
		    p_last_updated_by => FND_GLOBAL.USER_ID,
		    p_last_update_login => FND_GLOBAL.LOGIN_ID,
		    p_created_by => FND_GLOBAL.USER_ID,
		    p_creation_date => sysdate);
Line: 1003

		  PSB_POS_SET_LINE_VALUES_PVT.Insert_Row
		     (p_api_version => 1.0,
		      p_return_status => l_return_status,
		      p_msg_count => l_msg_count,
		      p_msg_data => l_msg_data,
		      p_row_id => l_rowid,
		      p_value_sequence_id => l_value_sequence_id,
		      p_line_sequence_id => l_line_sequence_id,
		      p_attribute_value_id => l_attribute_value_id,
		      p_attribute_value => c_possetlineval_rec.attribute_value,
		      p_last_update_date => sysdate,
		      p_last_updated_by => FND_GLOBAL.USER_ID,
		      p_last_update_login => FND_GLOBAL.LOGIN_ID,
		      p_created_by => FND_GLOBAL.USER_ID,
		      p_creation_date => sysdate);
Line: 1047

		  PSB_ACCT_POSITION_SET_LINE_PVT.Insert_Row
		     (p_api_version => 1.0,
		      p_return_status => l_return_status,
		      p_msg_count => l_msg_count,
		      p_msg_data => l_msg_data,
		      p_row_id => l_rowid,
		      p_line_sequence_id => l_line_sequence_id,
		      p_account_position_set_id => l_position_set_id,
		      p_description => c_possetline_rec.description,
		      p_business_group_id => c_possetline_rec.business_group_id,
		      p_attribute_id => c_possetline_rec.attribute_id,
		      p_include_or_exclude_type => c_possetline_rec.include_or_exclude_type,
		      p_segment1_low => c_possetline_rec.segment1_low,
		      p_segment2_low => c_possetline_rec.segment2_low,
		      p_segment3_low => c_possetline_rec.segment3_low,
		      p_segment4_low => c_possetline_rec.segment4_low,
		      p_segment5_low => c_possetline_rec.segment5_low,
		      p_segment6_low => c_possetline_rec.segment6_low,
		      p_segment7_low => c_possetline_rec.segment7_low,
		      p_segment8_low => c_possetline_rec.segment8_low,
		      p_segment9_low => c_possetline_rec.segment9_low,
		      p_segment10_low => c_possetline_rec.segment10_low,
		      p_segment11_low => c_possetline_rec.segment11_low,
		      p_segment12_low => c_possetline_rec.segment12_low,
		      p_segment13_low => c_possetline_rec.segment13_low,
		      p_segment14_low => c_possetline_rec.segment14_low,
		      p_segment15_low => c_possetline_rec.segment15_low,
		      p_segment16_low => c_possetline_rec.segment16_low,
		      p_segment17_low => c_possetline_rec.segment17_low,
		      p_segment18_low => c_possetline_rec.segment18_low,
		      p_segment19_low => c_possetline_rec.segment19_low,
		      p_segment20_low => c_possetline_rec.segment20_low,
		      p_segment21_low => c_possetline_rec.segment21_low,
		      p_segment22_low => c_possetline_rec.segment22_low,
		      p_segment23_low => c_possetline_rec.segment23_low,
		      p_segment24_low => c_possetline_rec.segment24_low,
		      p_segment25_low => c_possetline_rec.segment25_low,
		      p_segment26_low => c_possetline_rec.segment26_low,
		      p_segment27_low => c_possetline_rec.segment27_low,
		      p_segment28_low => c_possetline_rec.segment28_low,
		      p_segment29_low => c_possetline_rec.segment29_low,
		      p_segment30_low => c_possetline_rec.segment30_low,
		      p_segment1_high => c_possetline_rec.segment1_high,
		      p_segment2_high => c_possetline_rec.segment2_high,
		      p_segment3_high => c_possetline_rec.segment3_high,
		      p_segment4_high => c_possetline_rec.segment4_high,
		      p_segment5_high => c_possetline_rec.segment5_high,
		      p_segment6_high => c_possetline_rec.segment6_high,
		      p_segment7_high => c_possetline_rec.segment7_high,
		      p_segment8_high => c_possetline_rec.segment8_high,
		      p_segment9_high => c_possetline_rec.segment9_high,
		      p_segment10_high => c_possetline_rec.segment10_high,
		      p_segment11_high => c_possetline_rec.segment11_high,
		      p_segment12_high => c_possetline_rec.segment12_high,
		      p_segment13_high => c_possetline_rec.segment13_high,
		      p_segment14_high => c_possetline_rec.segment14_high,
		      p_segment15_high => c_possetline_rec.segment15_high,
		      p_segment16_high => c_possetline_rec.segment16_high,
		      p_segment17_high => c_possetline_rec.segment17_high,
		      p_segment18_high => c_possetline_rec.segment18_high,
		      p_segment19_high => c_possetline_rec.segment19_high,
		      p_segment20_high => c_possetline_rec.segment20_high,
		      p_segment21_high => c_possetline_rec.segment21_high,
		      p_segment22_high => c_possetline_rec.segment22_high,
		      p_segment23_high => c_possetline_rec.segment23_high,
		      p_segment24_high => c_possetline_rec.segment24_high,
		      p_segment25_high => c_possetline_rec.segment25_high,
		      p_segment26_high => c_possetline_rec.segment26_high,
		      p_segment27_high => c_possetline_rec.segment27_high,
		      p_segment28_high => c_possetline_rec.segment28_high,
		      p_segment29_high => c_possetline_rec.segment29_high,
		      p_segment30_high => c_possetline_rec.segment30_high,
		      p_context => c_possetline_rec.context,
		      p_attribute1 => c_possetline_rec.attribute1,
		      p_attribute2 => c_possetline_rec.attribute2,
		      p_attribute3 => c_possetline_rec.attribute3,
		      p_attribute4 => c_possetline_rec.attribute4,
		      p_attribute5 => c_possetline_rec.attribute5,
		      p_attribute6 => c_possetline_rec.attribute6,
		      p_attribute7 => c_possetline_rec.attribute7,
		      p_attribute8 => c_possetline_rec.attribute8,
		      p_attribute9 => c_possetline_rec.attribute9,
		      p_attribute10 => c_possetline_rec.attribute10,
		      p_last_update_date => sysdate,
		      p_last_updated_by => FND_GLOBAL.USER_ID,
		      p_last_update_login => FND_GLOBAL.LOGIN_ID,
		      p_created_by => FND_GLOBAL.USER_ID,
		      p_creation_date => sysdate);
Line: 1150

		    PSB_POS_SET_LINE_VALUES_PVT.Insert_Row
		       (p_api_version => 1.0,
			p_return_status => l_return_status,
			p_msg_count => l_msg_count,
			p_msg_data => l_msg_data,
			p_row_id => l_rowid,
			p_value_sequence_id => l_value_sequence_id,
			p_line_sequence_id => l_line_sequence_id,
			p_attribute_value_id => l_attribute_value_id,
			p_attribute_value => c_possetlineval_rec.attribute_value,
			p_last_update_date => sysdate,
			p_last_updated_by => FND_GLOBAL.USER_ID,
			p_last_update_login => FND_GLOBAL.LOGIN_ID,
			p_created_by => FND_GLOBAL.USER_ID,
			p_creation_date => sysdate);
Line: 1194

		      PSB_POS_SET_LINE_VALUES_PVT.Insert_Row
			 (p_api_version => 1.0,
			  p_return_status => l_return_status,
			  p_msg_count => l_msg_count,
			  p_msg_data => l_msg_data,
			  p_row_id => l_rowid,
			  p_value_sequence_id => l_value_sequence_id,
			  p_line_sequence_id => l_line_sequence_id,
			  p_attribute_value_id => l_attribute_value_id,
			  p_attribute_value => c_possetlineval_rec.attribute_value,
			  p_last_update_date => sysdate,
			  p_last_updated_by => FND_GLOBAL.USER_ID,
			  p_last_update_login => FND_GLOBAL.LOGIN_ID,
			  p_created_by => FND_GLOBAL.USER_ID,
			  p_creation_date => sysdate);
Line: 1222

	--This has been commented because of the attribute selection type
	--should be same as the old Position Set.
	--This has been taken care during the build for Bug No : 1822364
	/*
		-- Since we're adding attribute values set the attribute selection type to 'O'

		if c_posset_rec.attribute_selection_type <> 'O' then
		begin

		  PSB_ACCOUNT_POSITION_SET_PVT.Update_Row
		     (p_api_version => 1.0,
		      p_return_status => l_return_status,
		      p_msg_count => l_msg_count,
		      p_msg_data => l_msg_data,
		      p_row_id => lp_rowid,
		      p_account_position_set_id => l_position_set_id,
		      p_name => c_posset_rec.name,
		      p_set_of_books_id => c_posset_rec.set_of_books_id,
		      p_data_extract_id => p_target_data_extract_id,
		      p_global_or_local_type => c_posset_rec.global_or_local_type,
		      p_account_or_position_type => c_posset_rec.account_or_position_type,
		      p_attribute_selection_type => 'O',
		      p_business_group_id => c_posset_rec.business_group_id,
		      p_last_update_date => sysdate,
		      p_last_updated_by => FND_GLOBAL.USER_ID,
		      p_last_update_login => FND_GLOBAL.LOGIN_ID);
Line: 1269

	    PSB_SET_RELATION_PVT.Insert_Row
	       (p_api_version => 1.0,
		p_return_status => l_return_status,
		p_msg_count => l_msg_count,
		p_msg_data => l_msg_data,
		p_row_id => l_rowid,
		p_set_relation_id => l_set_relation_id,
		p_account_position_set_id => l_position_set_id,
		p_allocation_rule_id => null,
		p_budget_group_id => null,
		p_budget_workflow_rule_id => null,
		p_constraint_id => null,
		p_default_rule_id => null,
		p_parameter_id => null,
		p_position_set_group_id => l_position_set_group_id,
/* Budget Revision Rules Enhancement Start */
		p_rule_id => null,
		p_apply_balance_flag => null,
/* Budget Revision Rules Enhancement End */
		p_effective_start_date => null,
		p_effective_end_date => null,
		p_last_update_date => sysdate,
		p_last_updated_by => FND_GLOBAL.USER_ID,
		p_last_update_login => FND_GLOBAL.LOGIN_ID,
		p_created_by => FND_GLOBAL.USER_ID,
		p_creation_date => sysdate);
Line: 1310

	  PSB_ELEMENT_DISTRIBUTIONS_PVT.Insert_Row
	     (p_api_version => 1.0,
	      p_return_status => l_return_status,
	      p_msg_count => l_msg_count,
	      p_msg_data => l_msg_data,
	      p_distribution_id => l_distribution_id,
	      p_position_set_group_id => l_position_set_group_id,
	      p_chart_of_accounts_id => c_elemdist_rec.chart_of_accounts_id,
	      p_effective_start_date => c_elemdist_rec.effective_start_date,
	      p_effective_end_date => c_elemdist_rec.effective_end_date,
	      p_distribution_percent => c_elemdist_rec.distribution_percent,
	      p_concatenated_segments => c_elemdist_rec.concatenated_segments,
	      p_code_combination_id => c_elemdist_rec.code_combination_id,
	      p_distribution_set_id => c_elemdist_rec.distribution_set_id,
	      p_segment1 => c_elemdist_rec.segment1,
	      p_segment2 => c_elemdist_rec.segment2,
	      p_segment3 => c_elemdist_rec.segment3,
	      p_segment4 => c_elemdist_rec.segment4,
	      p_segment5 => c_elemdist_rec.segment5,
	      p_segment6 => c_elemdist_rec.segment6,
	      p_segment7 => c_elemdist_rec.segment7,
	      p_segment8 => c_elemdist_rec.segment8,
	      p_segment9 => c_elemdist_rec.segment9,
	      p_segment10 => c_elemdist_rec.segment10,
	      p_segment11 => c_elemdist_rec.segment11,
	      p_segment12 => c_elemdist_rec.segment12,
	      p_segment13 => c_elemdist_rec.segment13,
	      p_segment14 => c_elemdist_rec.segment14,
	      p_segment15 => c_elemdist_rec.segment15,
	      p_segment16 => c_elemdist_rec.segment16,
	      p_segment17 => c_elemdist_rec.segment17,
	      p_segment18 => c_elemdist_rec.segment18,
	      p_segment19 => c_elemdist_rec.segment19,
	      p_segment20 => c_elemdist_rec.segment20,
	      p_segment21 => c_elemdist_rec.segment21,
	      p_segment22 => c_elemdist_rec.segment22,
	      p_segment23 => c_elemdist_rec.segment23,
	      p_segment24 => c_elemdist_rec.segment24,
	      p_segment25 => c_elemdist_rec.segment25,
	      p_segment26 => c_elemdist_rec.segment26,
	      p_segment27 => c_elemdist_rec.segment27,
	      p_segment28 => c_elemdist_rec.segment28,
	      p_segment29 => c_elemdist_rec.segment29,
	      p_segment30 => c_elemdist_rec.segment30,
	      p_last_update_date => sysdate,
	      p_last_updated_by => FND_GLOBAL.USER_ID,
	      p_last_update_login => FND_GLOBAL.LOGIN_ID,
	      p_created_by => FND_GLOBAL.USER_ID,
	      p_creation_date => sysdate);
Line: 1374

      PSB_PAY_ELEMENTS_PVT.UPDATE_ROW
	(p_api_version => 1.0,
	 p_return_status => l_return_status,
	 p_msg_count => l_msg_count,
	 p_msg_data => l_msg_data,
	 P_ROW_ID => l_rowid,
	 P_PAY_ELEMENT_ID => l_pay_element_id,
	 P_BUSINESS_GROUP_ID => c_elem_rec.business_group_id,
	 P_DATA_EXTRACT_ID => p_target_data_extract_id,
	 P_BUDGET_SET_ID => c_elem_rec.budget_set_id,
	 P_NAME => c_elem_rec.name,
	 P_DESCRIPTION => c_elem_rec.description,
	 P_ELEMENT_VALUE_TYPE => c_elem_rec.element_value_type,
	 P_FORMULA_ID => c_elem_rec.formula_id,
	 P_OVERWRITE_FLAG => c_elem_rec.overwrite_flag,
	 P_REQUIRED_FLAG => c_elem_rec.required_flag,
	 P_FOLLOW_SALARY => c_elem_rec.follow_salary,
	 P_PAY_BASIS => c_elem_rec.pay_basis,
	 P_START_DATE => c_elem_rec.start_date,
	 P_END_DATE => c_elem_rec.end_date,
	 P_PROCESSING_TYPE => c_elem_rec.processing_type,
	 P_PERIOD_TYPE => c_elem_rec.period_type,
	 P_PROCESS_PERIOD_TYPE => c_elem_rec.process_period_type,
	 P_MAX_ELEMENT_VALUE_TYPE => c_elem_rec.max_element_value_type,
	 P_MAX_ELEMENT_VALUE => c_elem_rec.max_element_value,
	 P_SALARY_FLAG => c_elem_rec.salary_flag,
	 P_SALARY_TYPE => c_elem_rec.salary_type,
	 P_OPTION_FLAG => c_elem_rec.option_flag,
	 P_HR_ELEMENT_TYPE_ID => c_elem_rec.hr_element_type_id,
	 P_ATTRIBUTE_CATEGORY => c_elem_rec.attribute_category,
	 P_ATTRIBUTE1 => c_elem_rec.attribute1,
	 P_ATTRIBUTE2 => c_elem_rec.attribute2,
	 P_ATTRIBUTE3 => c_elem_rec.attribute3,
	 P_ATTRIBUTE4 => c_elem_rec.attribute4,
	 P_ATTRIBUTE5 => c_elem_rec.attribute5,
	 P_ATTRIBUTE6 => c_elem_rec.attribute6,
	 P_ATTRIBUTE7 => c_elem_rec.attribute7,
	 P_ATTRIBUTE8 => c_elem_rec.attribute8,
	 P_ATTRIBUTE9 => c_elem_rec.attribute9,
	 P_ATTRIBUTE10 => c_elem_rec.attribute10,
	 P_LAST_UPDATE_DATE => sysdate,
	 P_LAST_UPDATED_BY => FND_GLOBAL.USER_ID,
	 P_LAST_UPDATE_LOGIN => FND_GLOBAL.LOGIN_ID);
Line: 1445

	    PSB_PAY_ELEMENT_OPTIONS_PVT.INSERT_ROW
	       (p_api_version => 1.0,
		p_return_status => l_return_status,
		p_msg_count => l_msg_count,
		p_msg_data => l_msg_data,
		p_pay_element_option_id => l_pay_element_option_id,
		p_pay_element_id => l_pay_element_id,
		p_name => c_elemoptions_rec.name,
		p_grade_step => c_elemoptions_rec.grade_step,
		p_sequence_number => c_elemoptions_rec.sequence_number,
		p_last_update_date => sysdate,
		p_last_updated_by => FND_GLOBAL.USER_ID,
		p_last_update_login => FND_GLOBAL.LOGIN_ID,
		p_created_by => FND_GLOBAL.USER_ID,
		p_creation_date => sysdate);
Line: 1575

    select *
      from PSB_PAY_ELEMENTS
     where data_extract_id = p_source_data_extract_id;
Line: 1580

    select pay_element_id, rowid
      from PSB_PAY_ELEMENTS
     where name = elemname
       and data_extract_id = p_target_data_extract_id;
Line: 1586

    select *
      from PSB_PAY_ELEMENT_OPTIONS
     where pay_element_id = elemid;
Line: 1591

    select pay_element_option_id
      from PSB_PAY_ELEMENT_OPTIONS
     where name = optname
       and pay_element_id = elemid;
Line: 1597

    select *
      from PSB_PAY_ELEMENT_RATES a
     where a.pay_element_id = elemid
       and a.pay_element_option_id = elemoptionid
       and ((a.worksheet_id = p_worksheet_id)
	 or (a.worksheet_id is null
       and not exists
	  (select 1 from PSB_PAY_ELEMENT_RATES b
	    where b.pay_element_id = a.pay_element_id
	      and b.pay_element_option_id = a.pay_element_option_id
	      and b.worksheet_id = p_worksheet_id)));
Line: 1610

    select *
      from PSB_PAY_ELEMENT_RATES a
     where a.pay_element_id = elemid
       and ((a.worksheet_id = p_worksheet_id)
	 or (a.worksheet_id is null
       and not exists
	  (select 1 from PSB_PAY_ELEMENT_RATES b
	    where b.pay_element_id = a.pay_element_id
	      and b.worksheet_id = p_worksheet_id)));
Line: 1621

    select psb_pay_elements_s.nextval seq
      from dual;
Line: 1625

    select psb_pay_element_options_s.nextval seq
      from dual;
Line: 1650

      PSB_PAY_ELEMENTS_PVT.INSERT_ROW
	 (p_api_version => 1.0,
	  p_return_status => l_return_status,
	  p_msg_count => l_msg_count,
	  p_msg_data => l_msg_data,
	  p_row_id => l_rowid,
	  p_pay_element_id => l_pay_element_id,
	  p_budget_set_id => c_elem_rec.budget_set_id,
	  p_business_group_id => c_elem_rec.business_group_id,
	  p_data_extract_id => p_target_data_extract_id,
	  p_name => c_elem_rec.name,
	  p_description => c_elem_rec.description,
	  p_element_value_type => c_elem_rec.element_value_type,
	  p_formula_id => c_elem_rec.formula_id,
	  p_overwrite_flag => c_elem_rec.overwrite_flag,
	  p_required_flag => c_elem_rec.required_flag,
	  p_follow_salary => c_elem_rec.follow_salary,
	  p_pay_basis => c_elem_rec.pay_basis,
	  p_start_date => c_elem_rec.start_date,
	  p_end_date => c_elem_rec.end_date,
	  p_processing_type => c_elem_rec.processing_type,
	  p_period_type => c_elem_rec.period_type,
	  p_process_period_type => c_elem_rec.process_period_type,
	  p_max_element_value_type => c_elem_rec.max_element_value_type,
	  p_max_element_value => c_elem_rec.max_element_value,
	  p_salary_flag => c_elem_rec.salary_flag,
	  p_salary_type => c_elem_rec.salary_type,
	  p_option_flag => c_elem_rec.option_flag,
	  p_hr_element_type_id => c_elem_rec.hr_element_type_id,
	  p_attribute_category => c_elem_rec.attribute_category,
	  p_attribute1 => c_elem_rec.attribute1,
	  p_attribute2 => c_elem_rec.attribute2,
	  p_attribute3 => c_elem_rec.attribute3,
	  p_attribute4 => c_elem_rec.attribute4,
	  p_attribute5 => c_elem_rec.attribute5,
	  p_attribute6 => c_elem_rec.attribute6,
	  p_attribute7 => c_elem_rec.attribute7,
	  p_attribute8 => c_elem_rec.attribute8,
	  p_attribute9 => c_elem_rec.attribute9,
	  p_attribute10 => c_elem_rec.attribute10,
	  p_last_update_date => sysdate,
	  p_last_updated_by => FND_GLOBAL.USER_ID,
	  p_last_update_login => FND_GLOBAL.LOGIN_ID,
	  p_created_by => FND_GLOBAL.USER_ID,
	  p_creation_date => sysdate);
Line: 1709

	  PSB_PAY_ELEMENT_OPTIONS_PVT.INSERT_ROW
	     (p_api_version => 1.0,
	      p_return_status => l_return_status,
	      p_msg_count => l_msg_count,
	      p_msg_data => l_msg_data,
	      p_pay_element_option_id => l_pay_element_option_id,
	      p_pay_element_id => l_pay_element_id,
	      p_name => c_elemoptions_rec.name,
	      p_grade_step => c_elemoptions_rec.grade_step,
	      p_sequence_number => c_elemoptions_rec.sequence_number,
	      p_last_update_date => sysdate,
	      p_last_updated_by => FND_GLOBAL.USER_ID,
	      p_last_update_login => FND_GLOBAL.LOGIN_ID,
	      p_created_by => FND_GLOBAL.USER_ID,
	      p_creation_date => sysdate);
Line: 1801

      PSB_PAY_ELEMENTS_PVT.UPDATE_ROW
	(p_api_version => 1.0,
	 p_return_status => l_return_status,
	 p_msg_count => l_msg_count,
	 p_msg_data => l_msg_data,
	 P_ROW_ID => l_rowid,
	 P_PAY_ELEMENT_ID => l_pay_element_id,
	 P_BUSINESS_GROUP_ID => c_elem_rec.business_group_id,
	 P_DATA_EXTRACT_ID => p_target_data_extract_id,
	 P_BUDGET_SET_ID => c_elem_rec.budget_set_id,
	 P_NAME => c_elem_rec.name,
	 P_DESCRIPTION => c_elem_rec.description,
	 P_ELEMENT_VALUE_TYPE => c_elem_rec.element_value_type,
	 P_FORMULA_ID => c_elem_rec.formula_id,
	 P_OVERWRITE_FLAG => c_elem_rec.overwrite_flag,
	 P_REQUIRED_FLAG => c_elem_rec.required_flag,
	 P_FOLLOW_SALARY => c_elem_rec.follow_salary,
	 P_PAY_BASIS => c_elem_rec.pay_basis,
	 P_START_DATE => c_elem_rec.start_date,
	 P_END_DATE => c_elem_rec.end_date,
	 P_PROCESSING_TYPE => c_elem_rec.processing_type,
	 P_PERIOD_TYPE => c_elem_rec.period_type,
	 P_PROCESS_PERIOD_TYPE => c_elem_rec.process_period_type,
	 P_MAX_ELEMENT_VALUE_TYPE => c_elem_rec.max_element_value_type,
	 P_MAX_ELEMENT_VALUE => c_elem_rec.max_element_value,
	 P_SALARY_FLAG => c_elem_rec.salary_flag,
	 P_SALARY_TYPE => c_elem_rec.salary_type,
	 P_OPTION_FLAG => c_elem_rec.option_flag,
	 P_HR_ELEMENT_TYPE_ID => c_elem_rec.hr_element_type_id,
	 P_ATTRIBUTE_CATEGORY => c_elem_rec.attribute_category,
	 P_ATTRIBUTE1 => c_elem_rec.attribute1,
	 P_ATTRIBUTE2 => c_elem_rec.attribute2,
	 P_ATTRIBUTE3 => c_elem_rec.attribute3,
	 P_ATTRIBUTE4 => c_elem_rec.attribute4,
	 P_ATTRIBUTE5 => c_elem_rec.attribute5,
	 P_ATTRIBUTE6 => c_elem_rec.attribute6,
	 P_ATTRIBUTE7 => c_elem_rec.attribute7,
	 P_ATTRIBUTE8 => c_elem_rec.attribute8,
	 P_ATTRIBUTE9 => c_elem_rec.attribute9,
	 P_ATTRIBUTE10 => c_elem_rec.attribute10,
	 P_LAST_UPDATE_DATE => sysdate,
	 P_LAST_UPDATED_BY => FND_GLOBAL.USER_ID,
	 P_LAST_UPDATE_LOGIN => FND_GLOBAL.LOGIN_ID);
Line: 1872

	    PSB_PAY_ELEMENT_OPTIONS_PVT.INSERT_ROW
	       (p_api_version => 1.0,
		p_return_status => l_return_status,
		p_msg_count => l_msg_count,
		p_msg_data => l_msg_data,
		p_pay_element_option_id => l_pay_element_option_id,
		p_pay_element_id => l_pay_element_id,
		p_name => c_elemoptions_rec.name,
		p_grade_step => c_elemoptions_rec.grade_step,
		p_sequence_number => c_elemoptions_rec.sequence_number,
		p_last_update_date => sysdate,
		p_last_updated_by => FND_GLOBAL.USER_ID,
		p_last_update_login => FND_GLOBAL.LOGIN_ID,
		p_created_by => FND_GLOBAL.USER_ID,
		p_creation_date => sysdate);
Line: 2055

  SELECT EMPLOYEE_NUMBER        ,
	 HR_EMPLOYEE_ID         ,
	 FIRST_NAME             ,
	 FULL_NAME              ,
	 KNOWN_AS               ,
	 LAST_NAME              ,
	 MIDDLE_NAMES           ,
	 TITLE
    FROM PSB_EMPLOYEES emp
   WHERE emp.data_extract_id = p_source_data_extract_id
     AND emp.business_group_id = p_source_business_group_id
     AND NOT EXISTS (
	 SELECT 1
	   FROM PSB_EMPLOYEES
	  WHERE hr_employee_id = emp.hr_employee_id
	    AND data_extract_id = p_target_data_extract_id
	);
Line: 2084

      insert into PSB_EMPLOYEES
	    (employee_id,
	     data_extract_id,
	     business_group_id,
	     employee_number,
	     hr_employee_id,
	     first_name,
	     full_name,
	     known_as,
	     last_name,
	     middle_names,
	     title,
	     creation_date,
	     created_by,
	     last_update_date,
	     last_updated_by,
	     last_update_login)
      values (PSB_EMPLOYEES_S.NEXTVAL,
	     p_target_data_extract_id,
	     p_source_business_group_id,
	     l_emp_num(i),
	     l_hremp_id(i),
	     l_first_name(i),
	     l_full_name(i),
	     l_known_as(i),
	     l_last_name(i),
	     l_middle_names(i),
	     l_title(i),
	     sysdate,
	     FND_GLOBAL.USER_ID,
	     sysdate,
	     FND_GLOBAL.USER_ID,
	     FND_GLOBAL.LOGIN_ID);
Line: 2316

  SELECT distribution_id, position_id, data_extract_id,
         worksheet_id, effective_start_date, effective_end_date,
         chart_of_accounts_id, code_combination_id, distribution_percent,
         global_default_flag, distribution_default_rule_id, project_id,
         task_id, award_id, expenditure_type, expenditure_organization_id,
         cost_allocation_key_flex_id, description
  FROM psb_position_pay_distributions b
  WHERE (((l_year_end_date IS NOT NULL)
           AND (((b.effective_start_date <= l_year_end_date)
           AND (b.effective_end_date IS NULL))
           OR ((b.effective_start_date
                  BETWEEN l_year_start_date AND l_year_end_date)
           OR (b.effective_end_date
                  BETWEEN l_year_start_date AND l_year_end_date)
           OR ((b.effective_start_date < l_year_start_date)
           AND (b.effective_end_date   > l_year_end_date)))))
           OR ((l_year_end_date IS NULL)
           AND (nvl(b.effective_end_date, l_year_start_date)
                      >= l_year_start_date)))
  AND position_id     = p_position_id
  AND worksheet_id IS NULL
  AND data_extract_id = p_target_data_extract_id;
Line: 2344

  SELECT DISTINCT
    pos_distr.distribution_id,     pos_distr.effective_start_date,
    pos_distr.effective_end_date,  pos_distr.chart_of_accounts_id,
    pos_distr.code_combination_id, pos_distr.distribution_percent
  FROM
    PSB_POSITION_PAY_DISTRIBUTIONS pos_distr
  WHERE EXISTS
    (
     SELECT 1
     FROM psb_ws_account_lines ws_lines
     WHERE pos_distr.code_combination_id = ws_lines.code_combination_id
     AND   ws_lines.salary_account_line  = 'Y'
     AND   ws_lines.ytd_amount           <> 0
     AND   ws_lines.budget_year_id BETWEEN p_from_budget_year_id
           AND p_to_budget_year_id
     AND ws_lines.position_line_id       = pos_line_id
    )
  AND pos_distr.position_id     = pos_id
  AND (
       (pos_distr.worksheet_id  = p_worksheet_id)
        OR (pos_distr.worksheet_id IS NULL
        AND NOT EXISTS
	    (SELECT 1
         FROM PSB_POSITION_PAY_DISTRIBUTIONS pay_distr
	     WHERE pay_distr.position_id = pos_distr.position_id
	     AND pay_distr.worksheet_id  = p_worksheet_id
        )
       )
      )
--  AND b.chart_of_accounts_id = p_gl_flex_code
  AND pos_distr.code_combination_id IS NOT NULL
  AND (((end_date IS NOT NULL)
  AND (((pos_distr.effective_start_date <= end_date)
  AND (pos_distr.effective_end_date IS NULL))
  OR ((pos_distr.effective_start_date BETWEEN start_date and end_date)
  OR (pos_distr.effective_end_date BETWEEN start_date and end_date)
  OR ((pos_distr.effective_start_date < start_date)
  AND (pos_distr.effective_end_date > end_date)))))
  OR ((end_date is null)
  AND (nvl(pos_distr.effective_end_date, start_date) >= start_date)))
  ORDER BY pos_distr.effective_start_date;
Line: 2452

          SELECT PSB_POSITION_PAY_DISTR_S.NEXTVAL
          INTO l_distribution_id
          FROM dual;
Line: 2484

        /*SELECT PSB_POSITION_PAY_DISTR_S.NEXTVAL
        INTO l_distribution_id
        FROM dual;
Line: 2519

          SELECT PSB_POSITION_PAY_DISTR_S.NEXTVAL
          INTO l_distribution_id
          FROM dual;
Line: 2552

            SELECT PSB_POSITION_PAY_DISTR_S.NEXTVAL
            INTO l_distribution_id
            FROM dual;
Line: 2590

            SELECT PSB_POSITION_PAY_DISTR_S.NEXTVAL
            INTO l_distribution_id
            FROM dual;
Line: 2633

      DELETE FROM psb_position_pay_distributions
        WHERE distribution_id = rec_distribution_id(i);
Line: 2641

      INSERT INTO psb_position_pay_distributions(
        distribution_id, position_id, data_extract_id,
        worksheet_id, effective_start_date, effective_end_date,
        chart_of_accounts_id, code_combination_id, distribution_percent,
        global_default_flag, distribution_default_rule_id, project_id,
        task_id, award_id, expenditure_type, expenditure_organization_id,
        cost_allocation_key_flex_id, description, last_update_date,
        last_updated_by, last_update_login, created_by, creation_date)
     VALUES(
        ins_distribution_id(i), ins_position_id(i), ins_data_extract_id(i),
        ins_worksheet_id(i), ins_start_date(i), ins_end_date(i),
        ins_chart_of_accounts_id(i), ins_code_combination_id(i),
        ins_distribution_percent(i), ins_global_default_flag(i),
        ins_dist_default_rule_id(i), ins_project_id(i), ins_task_id(i),
        ins_award_id(i), ins_exp_type(i), ins_exp_org_id(i),
        ins_cost_alloc_key_flex_id(i), ins_description(i),
        SYSDATE, FND_GLOBAL.USER_ID, FND_GLOBAL.LOGIN_ID,
        FND_GLOBAL.USER_ID, SYSDATE
        );
Line: 2661

    l_debug_info := ' Bulk Insertion of the manipulated disr completed.';
Line: 2674

  rec_distribution_id.DELETE;
Line: 2675

  rec_position_id.DELETE;
Line: 2676

  rec_data_extract_id.DELETE;
Line: 2677

  rec_worksheet_id.DELETE;
Line: 2678

  rec_start_date.DELETE;
Line: 2679

  rec_end_date.DELETE;
Line: 2680

  rec_chart_of_accounts_id.DELETE;
Line: 2681

  rec_code_combination_id.DELETE;
Line: 2682

  rec_distribution_percent.DELETE;
Line: 2683

  rec_global_default_flag.DELETE;
Line: 2684

  rec_dist_default_rule_id.DELETE;
Line: 2685

  rec_project_id.DELETE;
Line: 2686

  rec_task_id.DELETE;
Line: 2687

  rec_award_id.DELETE;
Line: 2688

  rec_exp_type.DELETE;
Line: 2689

  rec_exp_org_id.DELETE;
Line: 2690

  rec_cost_alloc_key_flex_id.DELETE;
Line: 2691

  rec_description.DELETE;
Line: 2693

  ins_distribution_id.DELETE;
Line: 2694

  ins_position_id.DELETE;
Line: 2695

  ins_data_extract_id.DELETE;
Line: 2696

  ins_worksheet_id.DELETE;
Line: 2697

  ins_start_date.DELETE;
Line: 2698

  ins_end_date.DELETE;
Line: 2699

  ins_chart_of_accounts_id.DELETE;
Line: 2700

  ins_code_combination_id.DELETE;
Line: 2701

  ins_distribution_percent.DELETE;
Line: 2702

  ins_global_default_flag.DELETE;
Line: 2703

  ins_dist_default_rule_id.DELETE;
Line: 2704

  ins_project_id.DELETE;
Line: 2705

  ins_task_id.DELETE;
Line: 2706

  ins_award_id.DELETE;
Line: 2707

  ins_exp_type.DELETE;
Line: 2708

  ins_exp_org_id.DELETE;
Line: 2709

  ins_cost_alloc_key_flex_id.DELETE;
Line: 2710

  ins_description.DELETE;
Line: 2716

  SELECT effective_start_date INTO l_pos_start_date
  FROM  psb_positions psb_pos
  WHERE psb_pos.position_id = p_source_DE_position_id;
Line: 2732

  SELECT psb_pos_lines.position_line_id INTO l_pos_line_id
  FROM psb_ws_position_lines psb_pos_lines,
       psb_ws_lines_positions psb_lines_pos
  WHERE psb_pos_lines.position_line_id   = psb_lines_pos.position_line_id
  AND   psb_pos_lines.position_id        = p_source_DE_position_id
  AND   psb_lines_pos.worksheet_id       = p_worksheet_id;
Line: 2768

          SELECT PSB_POSITION_PAY_DISTR_S.NEXTVAL
          INTO l_distribution_id
          FROM dual;
Line: 2839

              SELECT PSB_POSITION_PAY_DISTR_S.NEXTVAL
              INTO l_distribution_id
              FROM dual;
Line: 2857

              SELECT PSB_POSITION_PAY_DISTR_S.NEXTVAL
              INTO l_distribution_id
              FROM dual;
Line: 2917

            SELECT PSB_POSITION_PAY_DISTR_S.NEXTVAL
            INTO l_distribution_id
            FROM dual;
Line: 2937

          SELECT PSB_POSITION_PAY_DISTR_S.NEXTVAL
          INTO l_distribution_id
          FROM dual;
Line: 3078

    select pos.position_id, pos.position_definition_id, pos.hr_position_id, pos.hr_employee_id,pos.organization_id,
	   pos.business_group_id, pos.effective_start_date, pos.effective_end_date,
	   pos.set_of_books_id, pos.vacant_position_flag, pos.availability_status,
	   pos.transaction_id, pos.transaction_status, pos.new_position_flag,
	   pos.attribute1, pos.attribute2, pos.attribute3, pos.attribute4, pos.attribute5,
	   pos.attribute6, pos.attribute7, pos.attribute8, pos.attribute9, pos.attribute10,
	   pos.attribute11, pos.attribute12, pos.attribute13, pos.attribute14, pos.attribute15,
	   pos.attribute16, pos.attribute17, pos.attribute18, pos.attribute19, pos.attribute20,
	   pos.attribute_category, pos.name, wpl.budget_group_id
      from PSB_POSITIONS pos,
	   PSB_WS_POSITION_LINES wpl,
	   PSB_WS_LINES_POSITIONS wlp
     where data_extract_id = p_source_data_extract_id
       and wpl.position_id = pos.position_id
       and wlp.worksheet_id = p_worksheet_id
       and wlp.position_line_id = wpl.position_line_id;
Line: 3096

    select position_id
      from PSB_POSITIONS
     where name = posname
       and data_extract_id = p_target_data_extract_id
       and hr_position_id = hrposid
       -- For Bug number 2931727
       -- and (hrempid is null or hr_employee_id = hrempid);
Line: 3106

             (select 1 from psb_positions
               where hr_position_id = hrposid
                 and hr_employee_id = hrempid
                 and data_extract_id = p_target_data_extract_id))))
            or ((hrempid is null) and (hr_employee_id is null)));
Line: 3113

    select pas.attribute_id,
	   pas.attribute_value_id,
	   decode(pas.attribute_value_id,null,pas.attribute_value,patv.attribute_value) attribute_value,
	   pas.effective_start_date,
	   pas.effective_end_date
      from PSB_POSITION_ASSIGNMENTS pas,
	   PSB_ATTRIBUTES pat,
	   PSB_ATTRIBUTE_VALUES patv
     where pas.position_id = positionid
       and pas.assignment_type = 'ATTRIBUTE'
       and ((pas.worksheet_id = p_worksheet_id)
	 or (worksheet_id is null
	  and not exists
	  (select 1 from psb_position_assignments c
	    where c.position_id = positionid
	      and c.attribute_id = pas.attribute_id
	      and c.worksheet_id = p_worksheet_id)))
       and pas.attribute_id = pat.attribute_id
       and pas.attribute_value_id = patv.attribute_value_id(+);
Line: 3134

    select a.attribute_value_id
      from PSB_ATTRIBUTE_VALUES a,
	   PSB_ATTRIBUTE_VALUES b
     where a.data_extract_id = p_target_data_extract_id
       and a.attribute_value = b.attribute_value
       and a.attribute_id    = b.attribute_id -- added for Bug#4262388
       and b.attribute_value_id = attrvalid;
Line: 3143

    select pas.pay_element_id,
	   pas.pay_element_option_id,
	   pas.pay_element_rate_id,
	   pas.effective_start_date,
	   pas.effective_end_date,
	   pas.element_value,
	   pas.element_value_type,
	   pas.currency_code,
	   pas.pay_basis
      from PSB_POSITION_ASSIGNMENTS pas,
	   PSB_PAY_ELEMENTS pe
     where pas.position_id = positionid
       and pas.assignment_type = 'ELEMENT'
       and ((pas.worksheet_id = p_worksheet_id)
	 or (worksheet_id is null
	  and not exists
	     (select 1 from PSB_POSITION_ASSIGNMENTS c
	       where c.position_id = positionid
		 and c.pay_element_id = pas.pay_element_id
		 and c.worksheet_id = p_worksheet_id)))
       and pas.pay_element_id = pe.pay_element_id;
Line: 3166

    select a.pay_element_id
      from PSB_PAY_ELEMENTS a,
	   PSB_PAY_ELEMENTS b
     where a.name = b.name
       and a.data_extract_id = p_target_data_extract_id
       and b.pay_element_id = elemid;
Line: 3174

    select a.pay_element_option_id
      from PSB_PAY_ELEMENT_OPTIONS a,
	   PSB_PAY_ELEMENT_OPTIONS b
     where a.name = b.name
       and a.pay_element_id = elemid
       and b.pay_element_option_id = elemoptid
       and nvl(a.sequence_number, -1) = nvl(b.sequence_number, -1);
Line: 3183

    select *
      from PSB_POSITION_ASSIGNMENTS pas
     where pas.position_id = positionid
       and pas.assignment_type = 'EMPLOYEE'
       and ((pas.worksheet_id = p_worksheet_id)
	 or (pas.worksheet_id is null
       and not exists
	  (select 1 from PSB_POSITION_ASSIGNMENTS c
	    where c.position_id = positionid
	      and c.primary_employee_flag = 'Y'
	      and c.worksheet_id = p_worksheet_id)));
Line: 3196

    select a.employee_id
      from PSB_EMPLOYEES a,
	   PSB_EMPLOYEES b
     /*For Bug No : 2434152 Start*/
     --where a.employee_number = b.employee_number
     where a.hr_employee_id = b.hr_employee_id
     /*For Bug No : 2434152 End*/
       and a.data_extract_id = p_target_data_extract_id
       and b.employee_id = empid;
Line: 3207

    select *
      from PSB_POSITION_PAY_DISTRIBUTIONS a
     where a.position_id = positionid
       and ((a.worksheet_id = p_worksheet_id)
	 or (a.worksheet_id is null
       and not exists
	  (select 1 from PSB_POSITION_PAY_DISTRIBUTIONS c
	    where c.position_id = positionid
	      and c.worksheet_id = p_worksheet_id)));
Line: 3218

    select PSB_POSITIONS_S.NEXTVAL seq
      from dual;
Line: 3222

    select PSB_POSITION_ASSIGNMENTS_S.NEXTVAL seq
      from dual;
Line: 3226

    select PSB_POSITION_PAY_DISTR_S.NEXTVAL seq
      from dual;
Line: 3261

      PSB_POSITIONS_PVT.Insert_Row
	 (p_api_version => 1.0,
	  p_return_status => l_return_status,
	  p_msg_count => l_msg_count,
	  p_msg_data => l_msg_data,
	  p_rowid => l_rowid,
	  p_position_id => l_position_id,
	  p_budget_group_id => c_positions_rec.budget_group_id,
	  p_data_extract_id => p_target_data_extract_id,
	  p_position_definition_id => c_positions_rec.position_definition_id,
	  p_hr_position_id => c_positions_rec.hr_position_id,
	  p_hr_employee_id => c_positions_rec.hr_employee_id,
	  p_business_group_id => c_positions_rec.business_group_id,
	  -- de by org
	  p_organization_id => c_positions_rec.organization_id,
	  p_effective_start_date => c_positions_rec.effective_start_date,
	  p_effective_end_date => c_positions_rec.effective_end_date,
	  p_set_of_books_id => c_positions_rec.set_of_books_id,
	  p_vacant_position_flag => c_positions_rec.vacant_position_flag,
	  p_availability_status => c_positions_rec.availability_status,
	  p_transaction_id => c_positions_rec.transaction_id,
	  p_transaction_status => c_positions_rec.transaction_status,
	  p_attribute1 => c_positions_rec.attribute1,
	  p_attribute2 => c_positions_rec.attribute2,
	  p_attribute3 => c_positions_rec.attribute3,
	  p_attribute4 => c_positions_rec.attribute4,
	  p_attribute5 => c_positions_rec.attribute5,
	  p_attribute6 => c_positions_rec.attribute6,
	  p_attribute7 => c_positions_rec.attribute7,
	  p_attribute8 => c_positions_rec.attribute8,
	  p_attribute9 => c_positions_rec.attribute9,
	  p_attribute10 => c_positions_rec.attribute10,
	  p_attribute11 => c_positions_rec.attribute11,
	  p_attribute12 => c_positions_rec.attribute12,
	  p_attribute13 => c_positions_rec.attribute13,
	  p_attribute14 => c_positions_rec.attribute14,
	  p_attribute15 => c_positions_rec.attribute15,
	  p_attribute16 => c_positions_rec.attribute16,
	  p_attribute17 => c_positions_rec.attribute17,
	  p_attribute18 => c_positions_rec.attribute18,
	  p_attribute19 => c_positions_rec.attribute19,
	  p_attribute20 => c_positions_rec.attribute20,
	  p_attribute_category => c_positions_rec.attribute_category,
	  p_name => c_positions_rec.name);
Line: 3335

	  PSB_POSITION_ASSIGNMENTS_PVT.Insert_Row
	   (p_api_version => 1.0,
	    p_return_status => l_return_status,
	    p_msg_count => l_msg_count,
	    p_msg_data => l_msg_data,
	    p_rowid => l_rowid,
	    p_position_assignment_id => l_position_assignment_id,
	    p_data_extract_id => p_target_data_extract_id,
	    p_worksheet_id => null,
	    p_position_id => l_position_id,
	    p_assignment_type => 'ATTRIBUTE',
	    p_attribute_id => l_attr_val.attribute_id(l_attr_index),
	    p_attribute_value_id => l_attribute_value_id,
	    p_attribute_value => l_attr_val.attribute_value(l_attr_index),
	    p_pay_element_id => null,
	    p_pay_element_option_id => null,
	    p_effective_start_date => l_attr_val.effective_start_date(l_attr_index),
	    p_effective_end_date => l_attr_val.effective_end_date(l_attr_index),
	    p_element_value_type => null,
	    p_element_value => null,
	    p_currency_code => null,
	    p_pay_basis => null,
	    p_employee_id => null,
	    p_primary_employee_flag => null,
	    p_global_default_flag => null,
	    p_assignment_default_rule_id => null,
	    p_modify_flag => null);
Line: 3397

	PSB_POSITION_ASSIGNMENTS_PVT.Insert_Row
	   (p_api_version => 1.0,
	    p_return_status => l_return_status,
	    p_msg_count => l_msg_count,
	    p_msg_data => l_msg_data,
	    p_rowid => l_rowid,
	    p_position_assignment_id => l_position_assignment_id,
	    p_data_extract_id => p_target_data_extract_id,
	    p_worksheet_id => null,
	    p_position_id => l_position_id,
	    p_assignment_type => 'ELEMENT',
	    p_attribute_id => null,
	    p_attribute_value_id => null,
	    p_attribute_value => null,
	    p_pay_element_id => l_pay_element_id,
	    p_pay_element_option_id => l_pay_element_option_id,
	    p_effective_start_date => c_posassign_elem_rec.effective_start_date,
	    p_effective_end_date => c_posassign_elem_rec.effective_end_date,
	    p_element_value_type => c_posassign_elem_rec.element_value_type,
	    p_element_value => c_posassign_elem_rec.element_value,
	    p_currency_code => c_posassign_elem_rec.currency_code,
	    p_pay_basis => c_posassign_elem_rec.pay_basis,
	    p_employee_id => null,
	    p_primary_employee_flag => null,
	    p_global_default_flag => null,
	    p_assignment_default_rule_id => null,
	    p_modify_flag => null);
Line: 3443

	PSB_POSITION_ASSIGNMENTS_PVT.Insert_Row
	   (p_api_version => 1.0,
	    p_return_status => l_return_status,
	    p_msg_count => l_msg_count,
	    p_msg_data => l_msg_data,
	    p_rowid => l_rowid,
	    p_position_assignment_id => l_position_assignment_id,
	    p_data_extract_id => p_target_data_extract_id,
	    p_worksheet_id => null,
	    p_position_id => l_position_id,
	    p_assignment_type => 'EMPLOYEE',
	    p_attribute_id => null,
	    p_attribute_value_id => null,
	    p_attribute_value => null,
	    p_pay_element_id => null,
	    p_pay_element_option_id => null,
	    p_effective_start_date => c_posassign_emp_rec.effective_start_date,
	    p_effective_end_date => c_posassign_emp_rec.effective_end_date,
	    p_element_value_type => null,
	    p_element_value => null,
	    p_currency_code => null,
	    p_pay_basis => null,
	    p_employee_id => l_employee_id,
	    p_primary_employee_flag => c_posassign_emp_rec.primary_employee_flag,
	    p_global_default_flag => null,
	    p_assignment_default_rule_id => null,
	    p_modify_flag => null);
Line: 3521

		PSB_POSITION_PAY_DISTR_PVT.Insert_Row
		   (p_api_version => 1.0,
		    p_return_status => l_return_status,
		    p_msg_count => l_msg_count,
		    p_msg_data => l_msg_data,
		    p_rowid => l_rowid,
		    p_distribution_id => l_distribution_id,
		    p_position_id => l_position_id,
		    p_data_extract_id => p_target_data_extract_id,
		    p_worksheet_id => null,
		    p_effective_start_date => l_year_start_date,
		    p_effective_end_date => l_year_end_date,
		    p_chart_of_accounts_id => c_position_distr_rec.chart_of_accounts_id,
		    p_code_combination_id => l_mapped_ccid,
		    p_distribution_percent => c_position_distr_rec.distribution_percent,
		    p_global_default_flag => null,
		    p_distribution_default_rule_id => null,
		    p_project_id => null,
		    p_task_id => null,
		    p_award_id => null,
		    p_expenditure_type => null,
		    p_expenditure_organization_id => null,
		    p_description => null);
Line: 3591

	  PSB_POSITION_PAY_DISTR_PVT.Insert_Row
	     (p_api_version => 1.0,
	      p_return_status => l_return_status,
	      p_msg_count => l_msg_count,
	      p_msg_data => l_msg_data,
	      p_rowid => l_rowid,
	      p_distribution_id => l_distribution_id,
	      p_position_id => l_position_id,
	      p_data_extract_id => p_target_data_extract_id,
	      p_worksheet_id => null,
	      p_effective_start_date => c_position_distr_rec.effective_start_date,
	      p_effective_end_date => c_position_distr_rec.effective_end_date,
	      p_chart_of_accounts_id => c_position_distr_rec.chart_of_accounts_id,
	      p_code_combination_id => c_position_distr_rec.code_combination_id,
	      p_distribution_percent => c_position_distr_rec.distribution_percent,
	      p_global_default_flag => null,
	      p_distribution_default_rule_id => null,
	      p_project_id => null,
	      p_task_id => null,
	      p_award_id => null,
	      p_expenditure_type => null,
	      p_expenditure_organization_id => null,
	      p_description => null);
Line: 3631

         PSB_POSITIONS_PVT.UPDATE_ROW
         (
	  p_api_version            => 1.0,
	  p_init_msg_lISt          => FND_API.G_FALSE,
	  p_commit                 => FND_API.G_FALSE,
	  p_validation_level       => FND_API.G_VALID_LEVEL_FULL,
	  p_return_status          => l_return_status,
	  p_msg_count              => l_msg_count,
	  p_msg_data               => l_msg_data,
	  p_position_id            => l_position_id,
	  p_data_extract_id        => p_target_data_extract_id,
	  p_budget_group_id        => c_positions_rec.budget_group_id,
	  p_position_definition_id => c_positions_rec.position_definition_id,
	  p_hr_position_id         => c_positions_rec.hr_position_id,
	  p_hr_employee_id         => c_positions_rec.hr_employee_id,
	  p_business_group_id      => c_positions_rec.business_group_id,
	  p_effective_start_date   => c_positions_rec.effective_start_date,
	  p_effective_end_date     => c_positions_rec.effective_end_date,
	  p_set_of_books_id        => c_positions_rec.set_of_books_id,
	  p_vacant_position_flag   => c_positions_rec.vacant_position_flag,
	  p_availability_status    => c_positions_rec.availability_status,
	  p_transaction_id         => c_positions_rec.transaction_id,
	  p_transaction_status     => c_positions_rec.transaction_status,
	  p_attribute1             => c_positions_rec.attribute1,
	  p_attribute2             => c_positions_rec.attribute2,
	  p_attribute3             => c_positions_rec.attribute3,
	  p_attribute4             => c_positions_rec.attribute4,
	  p_attribute5             => c_positions_rec.attribute5,
	  p_attribute6             => c_positions_rec.attribute6,
	  p_attribute7             => c_positions_rec.attribute7,
	  p_attribute8             => c_positions_rec.attribute8,
	  p_attribute9             => c_positions_rec.attribute9,
	  p_attribute10            => c_positions_rec.attribute10,
	  p_attribute11            => c_positions_rec.attribute11,
	  p_attribute12            => c_positions_rec.attribute12,
	  p_attribute13            => c_positions_rec.attribute13,
	  p_attribute14            => c_positions_rec.attribute14,
	  p_attribute15            => c_positions_rec.attribute15,
	  p_attribute16            => c_positions_rec.attribute16,
	  p_attribute17            => c_positions_rec.attribute17,
	  p_attribute18            => c_positions_rec.attribute18,
	  p_attribute19            => c_positions_rec.attribute19,
	  p_attribute20            => c_positions_rec.attribute20,
	  p_attribute_category     => c_positions_rec.attribute_category,
	  p_name                   => c_positions_rec.name);
Line: 4085

  TYPE l_update_tbl               IS TABLE OF VARCHAR2(1) INDEX BY BINARY_INTEGER;
Line: 4091

  l_fte_update            l_update_tbl;
Line: 4099

  l_cost_update           l_update_tbl;
Line: 4108

  l_account_update        l_update_tbl;
Line: 4137

    /*select *
      from PSB_WS_POSITION_LINES a
     where exists
	  (select 1
	     from PSB_WS_LINES_POSITIONS b
	    where b.position_line_id = a.position_line_id
	      and b.worksheet_id = p_worksheet_id);*/
Line: 4146

     select a.position_id, a.position_line_id
       from PSB_WS_POSITION_LINES a,
	    PSB_WS_LINES_POSITIONS b
      where a.position_line_id = b.position_line_id
	and b.worksheet_id = p_worksheet_id;
Line: 4154

    select code_combination_id, currency_code, sum(nvl(ytd_amount, 0)) annual_amount
      from PSB_WS_ACCOUNT_LINES
     where position_line_id = poslineid
       and budget_year_id = budgetyearid
       and end_stage_seq is null
     group by code_combination_id, currency_code;
Line: 4162

    select currency_code, element_set_id,
	   sum(nvl(ytd_amount,0)) annual_amount,
	   sum(nvl(period1_amount,0)) period1_amount,
	   sum(nvl(period2_amount,0)) period2_amount,
	   sum(nvl(period3_amount,0)) period3_amount,
	   sum(nvl(period4_amount,0)) period4_amount,
	   sum(nvl(period5_amount,0)) period5_amount,
	   sum(nvl(period6_amount,0)) period6_amount,
	   sum(nvl(period7_amount,0)) period7_amount,
	   sum(nvl(period8_amount,0)) period8_amount,
	   sum(nvl(period9_amount,0)) period9_amount,
	   sum(nvl(period10_amount,0)) period10_amount,
	   sum(nvl(period11_amount,0)) period11_amount,
	   sum(nvl(period12_amount,0)) period12_amount
      from psb_ws_account_lines
     where position_line_id = poslineid
       and budget_year_id   = budgetyearid
       and end_stage_seq is null
    group by currency_code, element_set_id;
Line: 4183

    select sum(nvl(period1_fte, 0)) period1_fte, sum(nvl(period2_fte, 0)) period2_fte,
	   sum(nvl(period3_fte, 0)) period3_fte, sum(nvl(period4_fte, 0)) period4_fte,
	   sum(nvl(period5_fte, 0)) period5_fte, sum(nvl(period6_fte, 0)) period6_fte,
	   sum(nvl(period7_fte, 0)) period7_fte, sum(nvl(period8_fte, 0)) period8_fte,
	   sum(nvl(period9_fte, 0)) period9_fte, sum(nvl(period10_fte, 0)) period10_fte,
	   sum(nvl(period11_fte, 0)) period11_fte, sum(nvl(period12_fte, 0)) period12_fte
      from PSB_WS_FTE_LINES
     where position_line_id = poslineid
       and budget_year_id = budgetyearid
       and end_stage_seq is null;
Line: 4195

    select pay_element_id, sum(nvl(element_cost, 0)) element_cost
      from PSB_WS_ELEMENT_LINES
     where position_line_id = poslineid
       and budget_year_id = budgetyearid
       and element_set_id = elemsetid
       and currency_code = currency
       and end_stage_seq is null
     group by pay_element_id;
Line: 4205

    select a.pay_element_id
      from PSB_PAY_ELEMENTS a,
	   PSB_PAY_ELEMENTS b
     where a.name = b.name
       and a.data_extract_id = p_target_data_extract_id
       and b.pay_element_id = elemid;
Line: 4213

    select a.position_id, a.budget_group_id
      from PSB_POSITIONS a,
	   PSB_POSITIONS b
     where (((b.hr_employee_id is null) and
            (a.hr_employee_id is null))
             or ((b.hr_employee_id is not null )
                 and (a.hr_employee_id = b.hr_employee_id)))
       /* Start bug 3625364 */
       /*and a.name = b.name*/
       and a.hr_position_id = b.hr_position_id
       /* End bug 3625364 */
       and a.data_extract_id = p_target_data_extract_id
       and b.position_id = posid;
Line: 4263

  l_position_rec.position_id.delete;
Line: 4264

  l_position_rec.position_line_id.delete;
Line: 4762

	UPDATE PSB_POSITION_FTE
	   SET fte =l_fte_fte(i),
	     last_update_date = sysdate,
	       last_updated_by = FND_GLOBAL.USER_ID,
	       last_update_login = FND_GLOBAL.LOGIN_ID
	 WHERE position_id = l_fte_position_id(i)
	   AND nvl(hr_budget_id,-1) = nvl(p_hr_budget_id,-1)
	   AND budget_revision_id is null
	   AND base_line_version = l_base_line_version
	   AND start_date = l_fte_start_date(i)
	   AND end_date = l_fte_end_date(i);
Line: 4779

	    l_fte_update(i) := 'Y';
Line: 4781

	    l_fte_update(i) := 'N';
Line: 4786

	  IF l_fte_update(i) = 'N' THEN

	    Modify_Position_FTE
	      (p_api_version => 1.0,
	       p_return_status => l_return_status,
	       p_msg_count => l_msg_count,
	       p_msg_data => l_msg_data,
	       p_position_id => l_fte_position_id(i),
	       p_hr_budget_id => p_hr_budget_id,
	       p_budget_revision_id => null,
	       p_base_line_version => l_base_line_version,
	       p_fte => l_fte_fte(i),
	       p_start_date => l_fte_start_date(i),
	       p_end_date => l_fte_end_date(i));
Line: 4810

      l_fte_position_id.delete;
Line: 4811

      l_fte_start_date.delete;
Line: 4812

      l_fte_end_date.delete;
Line: 4813

      l_fte_fte.delete;
Line: 4814

      l_fte_update.delete;
Line: 4831

	  UPDATE PSB_POSITION_COSTS
	     SET element_cost = l_cost_element_cost(i),
		 last_update_date = sysdate,
		 last_updated_by = FND_GLOBAL.USER_ID,
		 last_update_login = FND_GLOBAL.LOGIN_ID
	   WHERE position_id = l_cost_position_id(i)
	     AND nvl(hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
	     AND pay_element_id = l_cost_element_id(i)
	     AND currency_code = l_cost_currency_code(i)
	     AND budget_revision_id is null
	     AND base_line_version = l_base_line_version
	     AND start_date = l_cost_start_date(i)
	     AND end_date = l_cost_end_date(i);
Line: 4850

	      l_cost_update(i) := 'Y';
Line: 4852

	      l_cost_update(i) := 'N';
Line: 4857

	    IF l_cost_update(i) = 'N' THEN

	     Modify_Position_Costs
	       (p_api_version => 1.0,
		p_return_status => l_return_status,
		p_msg_count => l_msg_count,
		p_msg_data => l_msg_data,
		p_position_id => l_cost_position_id(i),
		p_hr_budget_id => p_hr_budget_id,
		p_pay_element_id => l_cost_element_id(i),
		p_budget_revision_id => null,
		p_base_line_version => l_base_line_version,
		p_start_date => l_cost_start_date(i),
		p_end_date => l_cost_end_date(i),
		p_currency_code => l_cost_currency_code(i),
		p_element_cost => l_cost_element_cost(i));
Line: 4883

      l_cost_position_id.delete;
Line: 4884

      l_cost_start_date.delete;
Line: 4885

      l_cost_end_date.delete;
Line: 4886

      l_cost_element_id.delete;
Line: 4887

      l_cost_currency_code.delete;
Line: 4888

      l_cost_element_cost.delete;
Line: 4889

      l_cost_update.delete;
Line: 4907

	  UPDATE PSB_POSITION_ACCOUNTS
	     SET amount = l_account_amount(i),
		 budget_group_id = l_account_bg_id(i),
		 last_update_date = sysdate,
		 last_updated_by = FND_GLOBAL.USER_ID,
		 last_update_login = FND_GLOBAL.LOGIN_ID
	   WHERE position_id = l_account_position_id(i)
	     AND nvl(hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
	     AND code_combination_id = l_account_cc_id(i)
	     AND currency_code = l_account_currency_code(i)
	     AND budget_revision_id is null
	     AND base_line_version = l_base_line_version
	     AND start_date = l_account_start_date(i)
	     AND end_date = l_account_end_date(i);
Line: 4927

	      l_account_update(i) := 'Y';
Line: 4929

	      l_account_update(i) := 'N';
Line: 4935

	    IF l_account_update(i) = 'N' THEN
	     Modify_Position_Accounts
	      (p_api_version => 1.0,
	       p_return_status => l_return_status,
	       p_msg_count => l_msg_count,
	       p_msg_data => l_msg_data,
	       p_position_id => l_account_position_id(i),
	       p_hr_budget_id => p_hr_budget_id,
	       p_budget_revision_id => null,
	       p_budget_group_id => l_account_bg_id(i),
	       p_base_line_version => l_base_line_version,
	       p_start_date => l_account_start_date(i),
	       p_end_date => l_account_end_date(i),
	       p_code_combination_id => l_account_cc_id(i),
	       p_currency_code => l_account_currency_code(i),
	       p_amount => l_account_amount(i));
Line: 4961

       l_account_position_id.delete;
Line: 4962

       l_account_start_date.delete;
Line: 4963

       l_account_end_date.delete;
Line: 4964

       l_account_cc_id.delete;
Line: 4965

       l_account_currency_code.delete;
Line: 4966

       l_account_amount.delete;
Line: 4967

       l_account_bg_id.delete;
Line: 4968

       l_account_update.delete;
Line: 5000

      UPDATE PSB_POSITION_FTE
	 SET fte = l_fte_fte(i),
	     last_update_date = sysdate,
	     last_updated_by = FND_GLOBAL.USER_ID,
	     last_update_login = FND_GLOBAL.LOGIN_ID
       WHERE position_id = l_fte_position_id(i)
	 AND nvl(hr_budget_id,-1) = nvl(p_hr_budget_id,-1)
	 AND budget_revision_id is null
	 AND base_line_version = l_base_line_version
	 AND start_date = l_fte_start_date(i)
	 AND end_date = l_fte_end_date(i);
Line: 5017

	    l_fte_update(i) := 'Y';
Line: 5019

	    l_fte_update(i) := 'N';
Line: 5025

	  IF l_fte_update(i) = 'N' THEN
	    Modify_Position_FTE
	      (p_api_version => 1.0,
	       p_return_status => l_return_status,
	       p_msg_count => l_msg_count,
	       p_msg_data => l_msg_data,
	       p_position_id => l_fte_position_id(i),
	       p_hr_budget_id => p_hr_budget_id,
	       p_budget_revision_id => null,
	       p_base_line_version => l_base_line_version,
	       p_fte => l_fte_fte(i),
	       p_start_date => l_fte_start_date(i),
	       p_end_date => l_fte_end_date(i));
Line: 5048

    l_fte_position_id.delete;
Line: 5049

    l_fte_start_date.delete;
Line: 5050

    l_fte_end_date.delete;
Line: 5051

    l_fte_fte.delete;
Line: 5052

    l_fte_update.delete;
Line: 5070

	  UPDATE PSB_POSITION_COSTS
	     SET element_cost = l_cost_element_cost(i),
		 last_update_date = sysdate,
		 last_updated_by = FND_GLOBAL.USER_ID,
		 last_update_login = FND_GLOBAL.LOGIN_ID
	   WHERE position_id = l_cost_position_id(i)
	     AND nvl(hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
	     AND pay_element_id = l_cost_element_id(i)
	     AND currency_code = l_cost_currency_code(i)
	     AND budget_revision_id is null
	     AND base_line_version = l_base_line_version
	     AND start_date = l_cost_start_date(i)
	     AND end_date = l_cost_end_date(i);
Line: 5090

	    l_cost_update(i) := 'Y';
Line: 5092

	    l_cost_update(i) := 'N';
Line: 5097

	  IF l_cost_update(i) = 'N' THEN

	    Modify_Position_Costs
	       (p_api_version => 1.0,
		p_return_status => l_return_status,
		p_msg_count => l_msg_count,
		p_msg_data => l_msg_data,
		p_position_id => l_cost_position_id(i),
		p_hr_budget_id => p_hr_budget_id,
		p_pay_element_id => l_cost_element_id(i),
		p_budget_revision_id => null,
		p_base_line_version => l_base_line_version,
		p_start_date => l_cost_start_date(i),
		p_end_date => l_cost_end_date(i),
		p_currency_code => l_cost_currency_code(i),
		p_element_cost => l_cost_element_cost(i));
Line: 5123

    l_cost_position_id.delete;
Line: 5124

    l_cost_start_date.delete;
Line: 5125

    l_cost_end_date.delete;
Line: 5126

    l_cost_element_id.delete;
Line: 5127

    l_cost_currency_code.delete;
Line: 5128

    l_cost_element_cost.delete;
Line: 5129

    l_cost_update.delete;
Line: 5148

	  UPDATE PSB_POSITION_ACCOUNTS
	     SET amount = l_account_amount(i),
		 budget_group_id = l_account_bg_id(i),
		 last_update_date = sysdate,
		 last_updated_by = FND_GLOBAL.USER_ID,
		 last_update_login = FND_GLOBAL.LOGIN_ID
	   WHERE position_id = l_account_position_id(i)
	     AND nvl(hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
	     AND code_combination_id = l_account_cc_id(i)
	     AND currency_code = l_account_currency_code(i)
	     AND budget_revision_id is null
	     AND base_line_version = l_base_line_version
	     AND start_date = l_account_start_date(i)
	     AND end_date = l_account_end_date(i);
Line: 5168

	    l_account_update(i) := 'Y';
Line: 5170

	    l_account_update(i) := 'N';
Line: 5176

	   IF l_account_update(i) = 'N' THEN
	     Modify_Position_Accounts
	      (p_api_version => 1.0,
	       p_return_status => l_return_status,
	       p_msg_count => l_msg_count,
	       p_msg_data => l_msg_data,
	       p_position_id => l_account_position_id(i),
	       p_hr_budget_id => p_hr_budget_id,
	       p_budget_revision_id => null,
	       p_budget_group_id => l_account_bg_id(i),
	       p_base_line_version => l_base_line_version,
	       p_start_date => l_account_start_date(i),
	       p_end_date => l_account_end_date(i),
	       p_code_combination_id => l_account_cc_id(i),
	       p_currency_code => l_account_currency_code(i),
	       p_amount => l_account_amount(i));
Line: 5202

     l_account_position_id.delete;
Line: 5203

     l_account_start_date.delete;
Line: 5204

     l_account_end_date.delete;
Line: 5205

     l_account_cc_id.delete;
Line: 5206

     l_account_currency_code.delete;
Line: 5207

     l_account_amount.delete;
Line: 5208

     l_account_bg_id.delete;
Line: 5209

     l_account_update.delete;
Line: 5268

    update PSB_POSITION_EVENTS_ALL
       set org_id = FND_PROFILE.VALUE('ORG_ID'),
	   transfer_to_interface = p_transfer_to_interface,
	   transfer_to_hrms = p_transfer_to_hrms,
	   interface_last_update_date = sysdate,
	   interface_last_updated_by = FND_GLOBAL.USER_ID,
	   interface_last_update_login = FND_GLOBAL.LOGIN_ID,
	   hrms_last_update_date = sysdate,
	   hrms_last_updated_by = FND_GLOBAL.USER_ID,
	   hrms_last_update_login = FND_GLOBAL.LOGIN_ID
     where event_type = p_event_type
       and source_id = p_source_id
       and from_budget_year_id = p_from_budget_year_id
       and to_budget_year_id = p_to_budget_year_id
       and hr_budget_id is null;
Line: 5288

    update PSB_POSITION_EVENTS_ALL
       set org_id = FND_PROFILE.VALUE('ORG_ID'),
	   transfer_to_interface = p_transfer_to_interface,
	   transfer_to_hrms = p_transfer_to_hrms,
	   interface_last_update_date = sysdate,
	   interface_last_updated_by = FND_GLOBAL.USER_ID,
	   interface_last_update_login = FND_GLOBAL.LOGIN_ID,
	   hrms_last_update_date = sysdate,
	   hrms_last_updated_by = FND_GLOBAL.USER_ID,
	   hrms_last_update_login = FND_GLOBAL.LOGIN_ID
     where event_type = p_event_type
       and source_id = p_source_id
       and from_budget_year_id = p_from_budget_year_id
       and to_budget_year_id = p_to_budget_year_id
       and hr_budget_id = p_hr_budget_id;
Line: 5310

    INSERT INTO PSB_POSITION_EVENTS_ALL
	  (position_event_id,
	   event_type,
	   source_id,
	   org_id,
	   hr_budget_id,
	   from_budget_year_id,
	   to_budget_year_id,
	   transfer_to_interface,
	   transfer_to_hrms,
	   interface_created_by,
	   interface_creation_date,
	   interface_last_update_date,
	   interface_last_updated_by,
	   interface_last_update_login,
	   hrms_created_by,
	   hrms_creation_date,
	   hrms_last_update_date,
	   hrms_last_updated_by,
	   hrms_last_update_login)
    VALUES (PSB_POSITION_EVENTS_ALL_S.NEXTVAL,
	    p_event_type,
	    p_source_id,
	    FND_PROFILE.VALUE('ORG_ID'),
	    p_hr_budget_id,
	    p_from_budget_year_id,
	    p_to_budget_year_id,
	    p_transfer_to_interface,
	    p_transfer_to_hrms,
	    FND_GLOBAL.USER_ID,
	    sysdate,
	    sysdate,
	    FND_GLOBAL.USER_ID,
	    FND_GLOBAL.LOGIN_ID,
	    FND_GLOBAL.USER_ID,
	    sysdate,
	    sysdate,
	    FND_GLOBAL.USER_ID,
	    FND_GLOBAL.LOGIN_ID) RETURNING position_event_id into l_position_event_id;
Line: 5396

    select 'Exists'
      from dual
     where exists
	  (select 'Exists'
	     from psb_ws_position_lines wpl, psb_ws_lines_positions wlp
	    where wpl.position_id = p_position_id
	      and wlp.position_line_id = wpl.position_line_id
	      and wlp.worksheet_id = p_source_id);
Line: 5406

    select 'Exists'
      from dual
     where exists
	  (select 'Exists'
	     from psb_budget_revision_positions brp, psb_budget_revision_pos_lines brpl
	    where brp.position_id = p_position_id
	      and brpl.budget_revision_pos_line_id = brp.budget_revision_pos_line_id
	      and brpl.budget_revision_id = p_source_id);
Line: 5452

    select 'Exists'
      from dual
     where exists
	  (select 'Exists'
	     from psb_ws_position_lines wpl, psb_ws_lines_positions wlp, psb_ws_account_lines wal
	    where wpl.position_id = p_position_id
	      and wlp.position_line_id = wpl.position_line_id
	      and wlp.worksheet_id = p_source_id
	      and wal.position_line_id = wpl.position_line_id);
Line: 5463

    select 'Exists'
      from dual
     where exists
	  (select 'Exists'
	     from psb_position_accounts
	    where budget_revision_id = p_source_id
	      and position_id = p_position_id);
Line: 5517

    select data_extract_id from psb_worksheets where worksheet_id = p_source_id;
Line: 5520

    select budget_group_id from psb_budget_revisions where budget_revision_id = p_source_id;
Line: 5523

    select position_id, name, hr_position_id, hr_employee_id
      from psb_positions
     where data_extract_id = l_data_extract_id;
Line: 5529

    select name, transaction_id
      from psb_positions
     where position_id = positionid
       and hr_position_id is null;
Line: 5712

    select a.data_extract_id,
	   b.business_group_id,
	   b.position_id_flex_num,
	   a.budget_calendar_id,
	   a.budget_group_id,
	   a.flex_mapping_set_id
      from PSB_WORKSHEETS a,
	   PSB_DATA_EXTRACTS b
     where a.worksheet_id = p_worksheet_id
       and b.data_extract_id = a.data_extract_id;
Line: 5724

    Select nvl(root_budget_group_id, budget_group_id) budget_group_id,
	   nvl(root_set_of_books_id, set_of_books_id) set_of_books_id,
	   nvl(root_short_name, short_name) short_name,
	   business_group_id
      from psb_budget_groups_v
     where budget_group_id = l_budget_group_id;
Line: 5816

    INSERT INTO PSB_DATA_EXTRACTS
	  (DATA_EXTRACT_ID, DATA_EXTRACT_NAME, DATA_EXTRACT_METHOD,
	   SET_OF_BOOKS_ID, BUSINESS_GROUP_ID, BUDGET_GROUP_ID,
	   POSITION_ID_FLEX_NUM, BASE_SALARY_DATE, REQ_DATA_AS_OF_DATE,
	   LAST_EXTRACT_DATE, LAST_UPDATE_DATE, LAST_UPDATED_BY,
	   LAST_UPDATE_LOGIN, CREATED_BY, CREATION_DATE, SYSTEM_DATA_EXTRACT)
    VALUES (PSB_DATA_EXTRACTS_S.NEXTVAL, l_data_extract_name, 'CREATE',
	    l_root_set_of_books_id, l_business_group_id, l_root_budget_group_id,
	    l_position_id_flex_num, null, sysdate,
	    sysdate, sysdate, FND_GLOBAL.USER_ID,
	    FND_GLOBAL.LOGIN_ID, FND_GLOBAL.USER_ID, sysdate, 'Y') RETURNING data_extract_id into l_system_data_extract_id;
Line: 6069

    FOR l_data_extract_rec IN (SELECT data_extract_id
	               	       FROM   psb_worksheets
	               	       WHERE  worksheet_id = p_worksheet_id)
    LOOP
      l_data_extract_Id := l_data_extract_rec.data_extract_id;
Line: 6078

    FOR l_att_fte_rec IN (SELECT attribute_id FROM psb_attributes a,
                                                   psb_data_extracts b
			  WHERE a.business_group_id = b.business_group_id
			  AND a.system_attribute_type = 'FTE'
			  AND b.data_extract_id = l_data_extract_Id)
    LOOP
      g_fte_attribute_Id := l_att_fte_rec.attribute_id;
Line: 6094

    FOR li_csr IN ( SELECT 1 new_bud
			  FROM   dual
			  WHERE EXISTS (SELECT 1
			  		  FROM psb_position_events_all
			  		  WHERE event_type = 'BP'
			                AND hr_budget_id = p_hr_budget_id)) LOOP
      lp_num_var := li_csr.new_bud;
Line: 6220

PROCEDURE Insert_Position_Accounts
( p_return_status         OUT  NOCOPY  VARCHAR2,
  p_msg_count             OUT  NOCOPY  NUMBER,
  p_msg_data              OUT  NOCOPY  VARCHAR2,
  p_position_id           IN   NUMBER,
  p_hr_budget_id          IN   NUMBER,
  p_start_date            IN   DATE,
  p_end_date              IN   DATE,
  p_code_combination_id   IN   NUMBER,
  p_budget_group_id       IN   NUMBER,
  p_currency_code         IN   VARCHAR2,
  p_amount                IN   NUMBER,
  p_budget_revision_id    IN   NUMBER,
  p_base_line_version     IN   VARCHAR2
) IS

  l_api_name            CONSTANT VARCHAR2(30)   := 'Insert_Position_Accounts';
Line: 6241

  insert into PSB_POSITION_ACCOUNTS
	(position_account_line_id, position_id, hr_budget_id, budget_revision_id, budget_group_id,
	 base_line_version, start_date, end_date, code_combination_id, currency_code,
	 amount, last_update_date, last_updated_by, last_update_login, created_by, creation_date)
   values (PSB_POSITION_ACCOUNTS_S.NEXTVAL, p_position_id, p_hr_budget_id, p_budget_revision_id, p_budget_group_id,
	   p_base_line_version, p_start_date, p_end_date, p_code_combination_id, p_currency_code,
	   p_amount, sysdate, FND_GLOBAL.USER_ID, FND_GLOBAL.LOGIN_ID, FND_GLOBAL.USER_ID, sysdate)
  RETURNING position_account_line_id into l_position_account_line_id;
Line: 6280

END Insert_Position_Accounts;
Line: 6284

PROCEDURE Update_Position_Accounts
( p_return_status             OUT  NOCOPY  VARCHAR2,
  p_msg_count                 OUT  NOCOPY  NUMBER,
  p_msg_data                  OUT  NOCOPY  VARCHAR2,
  p_position_account_line_id  IN   NUMBER,
  p_budget_group_id           IN   NUMBER,
  p_start_date                IN   DATE := FND_API.G_MISS_DATE,
  p_end_date                  IN   DATE := FND_API.G_MISS_DATE,
  p_amount                    IN   NUMBER
) IS

  l_api_name            CONSTANT VARCHAR2(30)   := 'Update_Position_Accounts';
Line: 6299

  update PSB_POSITION_ACCOUNTS
     set amount = p_amount,
	 budget_group_id = p_budget_group_id,
	 start_date = decode(p_start_date, FND_API.G_MISS_DATE, start_date, p_start_date),
	 end_date = decode(p_end_date, FND_API.G_MISS_DATE, end_date, p_end_date),
	 last_update_date = sysdate,
	 last_updated_by = FND_GLOBAL.USER_ID,
	 last_update_login = FND_GLOBAL.LOGIN_ID
    where position_account_line_id = p_position_account_line_id;
Line: 6339

END Update_Position_Accounts;
Line: 6343

PROCEDURE Delete_Position_Accounts
( p_return_status             OUT  NOCOPY  VARCHAR2,
  p_msg_count                 OUT  NOCOPY  NUMBER,
  p_msg_data                  OUT  NOCOPY  VARCHAR2,
  p_position_account_line_id  IN   NUMBER
) IS

  l_api_name            CONSTANT VARCHAR2(30)   := 'Delete_Position_Accounts';
Line: 6354

  delete from PSB_POSITION_ACCOUNTS
   where position_account_line_id = p_position_account_line_id;
Line: 6387

END Delete_Position_Accounts;
Line: 6418

  l_updated_record        BOOLEAN;
Line: 6422

  l_update_flag           BOOLEAN := TRUE;
Line: 6426

    select *
      from PSB_POSITION_ACCOUNTS
     where position_id = p_position_id
       and nvl(hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
       and code_combination_id = p_code_combination_id
       and currency_code = p_currency_code
       and nvl(budget_revision_id, -1) = nvl(p_budget_revision_id, -1)
       and nvl(base_line_version, FND_API.G_MISS_CHAR) = nvl(p_base_line_version, FND_API.G_MISS_CHAR)
       and ((((p_end_date is not null)
	 and ((start_date <= p_end_date)
	  and (end_date is null))
	  or ((start_date between p_start_date and p_end_date)
	   or (end_date between p_start_date and p_end_date)
	  or ((start_date < p_start_date)
	  and (end_date > p_end_date)))))
	  or ((p_end_date is null)
	  and (nvl(end_date, p_start_date) >= p_start_date)));
Line: 6466

  update PSB_POSITION_ACCOUNTS
     set amount = p_amount,
	 budget_group_id = p_budget_group_id,
	 last_update_date = sysdate,
	 last_updated_by = FND_GLOBAL.USER_ID,
	 last_update_login = FND_GLOBAL.LOGIN_ID
   where position_id = p_position_id
     and nvl(hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
     and code_combination_id = p_code_combination_id
     and currency_code = p_currency_code
     and nvl(budget_revision_id, -1) = nvl(p_budget_revision_id, -1)
     and nvl(base_line_version, FND_API.G_MISS_CHAR) = nvl(p_base_line_version, FND_API.G_MISS_CHAR)
     and start_date = p_start_date
     and nvl(end_date, FND_API.G_MISS_DATE) = nvl(p_end_date, FND_API.G_MISS_DATE);
Line: 6483

      l_update_flag := FALSE;
Line: 6487

      l_update_flag := FALSE;
Line: 6490

  if not l_update_flag then --SQL%NOTFOUND then
  /*For Bug No : 1808322 End*/
  begin

    for l_init_index in 1..g_accounts.Count loop
      g_accounts(l_init_index).position_account_line_id := null;
Line: 6505

      g_accounts(l_init_index).delete_flag := null;
Line: 6529

      g_accounts(g_num_accounts).delete_flag := TRUE;
Line: 6538

      Insert_Position_Accounts
	   (p_return_status => l_return_status,
	    p_msg_count     => l_msg_count,
	    p_msg_data      => l_msg_data,
	    p_position_id => p_position_id,
	    p_hr_budget_id => p_hr_budget_id,
	    p_start_date => p_start_date,
	    p_end_date => p_end_date,
	    p_code_combination_id => p_code_combination_id,
	    p_budget_group_id => p_budget_group_id,
	    p_currency_code => p_currency_code,
	    p_amount => p_amount,
	    p_budget_revision_id => p_budget_revision_id,
	    p_base_line_version => p_base_line_version);
Line: 6563

	l_updated_record := FALSE;
Line: 6570

	  Update_Position_Accounts
		(p_return_status => l_return_status,
	         p_msg_count     => l_msg_count,
	         p_msg_data      => l_msg_data,
		 p_position_account_line_id => g_accounts(l_account_index).position_account_line_id,
		 p_budget_group_id => p_budget_group_id,
		 p_end_date => p_end_date,
		 p_amount => p_amount);
Line: 6583

	  g_accounts(l_account_index).delete_flag := FALSE;
Line: 6601

	    Update_Position_Accounts
		  (p_return_status => l_return_status,
	           p_msg_count     => l_msg_count,
	           p_msg_data      => l_msg_data,
		   p_position_account_line_id => g_accounts(l_account_index).position_account_line_id,
		   p_budget_group_id => p_budget_group_id,
		   p_end_date => p_start_date - 1,
		   p_amount => Prorate (p_original_amount => g_accounts(l_account_index).amount,
					p_original_start_date => g_accounts(l_account_index).start_date,
					p_original_end_date => g_accounts(l_account_index).end_date,
					p_new_start_date => g_accounts(l_account_index).start_date,
					p_new_end_date => p_start_date - 1));
Line: 6617

	      l_updated_record := TRUE;
Line: 6620

	    g_accounts(l_account_index).delete_flag := FALSE;
Line: 6629

	    Update_Position_Accounts
		  (p_return_status => l_return_status,
	           p_msg_count     => l_msg_count,
	           p_msg_data      => l_msg_data,
		   p_position_account_line_id => g_accounts(l_account_index).position_account_line_id,
		   p_budget_group_id => p_budget_group_id,
		   p_start_date => p_end_date + 1,
		   p_amount => Prorate (p_original_amount => g_accounts(l_account_index).amount,
					p_original_start_date => g_accounts(l_account_index).start_date,
					p_original_end_date => g_accounts(l_account_index).end_date,
					p_new_start_date => p_end_date + 1,
					p_new_end_date => g_accounts(l_account_index).end_date));
Line: 6645

	      l_updated_record := FALSE;
Line: 6648

	    g_accounts(l_account_index).delete_flag := FALSE;
Line: 6656

	    Insert_Position_Accounts
		  (p_return_status => l_return_status,
	           p_msg_count     => l_msg_count,
	           p_msg_data      => l_msg_data,
		   p_position_id => p_position_id,
		   p_hr_budget_id => p_hr_budget_id,
		   p_start_date => p_start_date,
		   p_end_date => p_end_date,
		   p_code_combination_id => p_code_combination_id,
		   p_budget_group_id => p_budget_group_id,
		   p_currency_code => p_currency_code,
		   p_amount => p_amount,
		   p_budget_revision_id => p_budget_revision_id,
		   p_base_line_version => p_base_line_version);
Line: 6686

	      if l_updated_record then
	      begin

		Insert_Position_Accounts
		      (p_return_status => l_return_status,
	               p_msg_count     => l_msg_count,
	               p_msg_data      => l_msg_data,
		       p_position_id => g_accounts(l_account_index).position_id,
		       p_hr_budget_id => p_hr_budget_id,
		       p_start_date => p_end_date + 1,
		       p_end_date => g_accounts(l_account_index).end_date,
		       p_code_combination_id => g_accounts(l_account_index).code_combination_id,
		       p_budget_group_id => g_accounts(l_account_index).budget_group_id,
		       p_currency_code => g_accounts(l_account_index).currency_code,
		       p_amount => Prorate (p_original_amount => g_accounts(l_account_index).amount,
					    p_original_start_date => g_accounts(l_account_index).start_date,
					    p_original_end_date => g_accounts(l_account_index).end_date,
					    p_new_start_date => p_end_date + 1,
					    p_new_end_date => g_accounts(l_account_index).end_date),
		       p_budget_revision_id => g_accounts(l_account_index).budget_revision_id,
		       p_base_line_version => g_accounts(l_account_index).base_line_version);
Line: 6716

		Update_Position_Accounts
		      (p_return_status => l_return_status,
	               p_msg_count     => l_msg_count,
	               p_msg_data      => l_msg_data,
		       p_position_account_line_id => g_accounts(l_account_index).position_account_line_id,
		       p_budget_group_id => p_budget_group_id,
		       p_start_date => p_end_date + 1,
		       p_end_date => g_accounts(l_account_index).end_date,
		       p_amount => Prorate (p_original_amount => g_accounts(l_account_index).amount,
					    p_original_start_date => g_accounts(l_account_index).start_date,
					    p_original_end_date => g_accounts(l_account_index).end_date,
					    p_new_start_date => p_end_date + 1,
					    p_new_end_date => g_accounts(l_account_index).end_date));
Line: 6734

		g_accounts(l_account_index).delete_flag := FALSE;
Line: 6755

      if g_accounts(l_account_index).delete_flag then
      begin

	Delete_Position_Accounts
	      (p_return_status => l_return_status,
	       p_msg_count     => l_msg_count,
	       p_msg_data      => l_msg_data,
	       p_position_account_line_id => g_accounts(l_account_index).position_account_line_id);
Line: 6819

PROCEDURE Insert_Position_Costs
( p_return_status        OUT  NOCOPY  VARCHAR2,
  p_msg_count            OUT  NOCOPY  NUMBER,
  p_msg_data             OUT  NOCOPY  VARCHAR2,
  p_position_id          IN   NUMBER,
  p_hr_budget_id         IN   NUMBER,
  p_pay_element_id       IN   NUMBER,
  p_budget_revision_id   IN   NUMBER,
  p_base_line_version    IN   VARCHAR2,
  p_start_date           IN   DATE,
  p_end_date             IN   DATE,
  p_currency_code        IN   VARCHAR2,
  p_element_cost         IN   NUMBER
) IS

  l_api_name               CONSTANT VARCHAR2(30)   := 'Insert_Position_Costs';
Line: 6839

  insert into PSB_POSITION_COSTS
	(position_element_line_id, position_id, hr_budget_id, pay_element_id, budget_revision_id,
	 base_line_version, currency_code, start_date, end_date,
	 element_cost, last_update_date, last_updated_by, last_update_login, created_by, creation_date)
   values (PSB_POSITION_COSTS_S.NEXTVAL, p_position_id, p_hr_budget_id, p_pay_element_id, p_budget_revision_id,
	   p_base_line_version, p_currency_code, p_start_date, p_end_date,
	   p_element_cost, sysdate, FND_GLOBAL.USER_ID, FND_GLOBAL.LOGIN_ID, FND_GLOBAL.USER_ID, sysdate)
  RETURNING position_element_line_id INTO l_position_element_line_id;
Line: 6875

END Insert_Position_Costs;
Line: 6879

PROCEDURE Update_Position_Costs
( p_return_status             OUT  NOCOPY  VARCHAR2,
  p_msg_count                 OUT  NOCOPY  NUMBER,
  p_msg_data                  OUT  NOCOPY  VARCHAR2,
  p_position_element_line_id  IN   NUMBER,
  p_start_date                IN   DATE := FND_API.G_MISS_DATE,
  p_end_date                  IN   DATE := FND_API.G_MISS_DATE,
  p_element_cost              IN   NUMBER
) IS

  l_api_name               CONSTANT VARCHAR2(30)   := 'Update_Position_Costs';
Line: 6893

  update PSB_POSITION_COSTS
     set element_cost = p_element_cost,
	 start_date = decode(p_start_date, FND_API.G_MISS_DATE, start_date, p_start_date),
	 end_date = decode(p_end_date, FND_API.G_MISS_DATE, end_date, p_end_date),
	 last_update_date = sysdate,
	 last_updated_by = FND_GLOBAL.USER_ID,
	 last_update_login = FND_GLOBAL.LOGIN_ID
   where position_element_line_id = p_position_element_line_id;
Line: 6932

END Update_Position_Costs;
Line: 6936

PROCEDURE Delete_Position_Costs
( p_return_status             OUT  NOCOPY  VARCHAR2,
  p_msg_count                 OUT  NOCOPY  NUMBER,
  p_msg_data                  OUT  NOCOPY  VARCHAR2,
  p_position_element_line_id  IN   NUMBER
) IS

 l_api_name               CONSTANT VARCHAR2(30)   := 'Delete_Position_Costs';
Line: 6947

  delete from PSB_POSITION_COSTS
   where position_element_line_id = p_position_element_line_id;
Line: 6980

END Delete_Position_Costs;
Line: 7010

  l_updated_record       BOOLEAN;
Line: 7014

  l_update_flag           BOOLEAN := TRUE;
Line: 7018

    select *
      from PSB_POSITION_COSTS
     where position_id = p_position_id
       and nvl(hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
       and pay_element_id = p_pay_element_id
       and currency_code = p_currency_code
       and nvl(budget_revision_id, -1) = nvl(p_budget_revision_id, -1)
       and nvl(base_line_version, FND_API.G_MISS_CHAR) = nvl(p_base_line_version, FND_API.G_MISS_CHAR)
       and ((((p_end_date is not null)
	 and ((start_date <= p_end_date)
	  and (end_date is null))
	  or ((start_date between p_start_date and p_end_date)
	   or (end_date between p_start_date and p_end_date)
	  or ((start_date < p_start_date)
	  and (end_date > p_end_date)))))
	  or ((p_end_date is null)
	  and (nvl(end_date, p_start_date) >= p_start_date)));
Line: 7057

  update PSB_POSITION_COSTS
     set element_cost = p_element_cost,
	 last_update_date = sysdate,
	 last_updated_by = FND_GLOBAL.USER_ID,
	 last_update_login = FND_GLOBAL.LOGIN_ID
   where position_id = p_position_id
     and nvl(hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
     and pay_element_id = p_pay_element_id
     and currency_code = p_currency_code
     and nvl(budget_revision_id, -1) = nvl(p_budget_revision_id, -1)
     and nvl(base_line_version, FND_API.G_MISS_CHAR) = nvl(p_base_line_version, FND_API.G_MISS_CHAR)
     and start_date = p_start_date
     and nvl(end_date, FND_API.G_MISS_DATE) = nvl(p_end_date, FND_API.G_MISS_DATE);
Line: 7073

      l_update_flag := FALSE;
Line: 7077

      l_update_flag := FALSE;
Line: 7080

  if not l_update_flag then --if SQL%NOTFOUND then
  /*For Bug No : 1808322 End*/
  begin

    for l_init_index in 1..g_costs.Count loop
      g_costs(l_init_index).position_element_line_id := null;
Line: 7094

      g_costs(l_init_index).delete_flag := null;
Line: 7115

      g_costs(g_num_costs).delete_flag := TRUE;
Line: 7124

      Insert_Position_Costs
	   (p_return_status => l_return_status,
	    p_msg_count     => l_msg_count,
	    p_msg_data      => l_msg_data,
	    p_position_id => p_position_id,
	    p_hr_budget_id => p_hr_budget_id,
	    p_pay_element_id => p_pay_element_id,
	    p_start_date => p_start_date,
	    p_end_date => p_end_date,
	    p_currency_code => p_currency_code,
	    p_element_cost => p_element_cost,
	    p_budget_revision_id => p_budget_revision_id,
	    p_base_line_version => p_base_line_version);
Line: 7148

	l_updated_record := FALSE;
Line: 7155

	  Update_Position_Costs
		(p_return_status => l_return_status,
	         p_msg_count     => l_msg_count,
	         p_msg_data      => l_msg_data,
		 p_position_element_line_id => g_costs(l_cost_index).position_element_line_id,
		 p_end_date => p_end_date,
		 p_element_cost => p_element_cost);
Line: 7167

	  g_costs(l_cost_index).delete_flag := FALSE;
Line: 7185

	    Update_Position_Costs
		  (p_return_status => l_return_status,
	           p_msg_count     => l_msg_count,
	           p_msg_data      => l_msg_data,
		   p_position_element_line_id => g_costs(l_cost_index).position_element_line_id,
		   p_end_date => p_start_date - 1,
		   p_element_cost => Prorate (p_original_amount => g_costs(l_cost_index).element_cost,
					      p_original_start_date => g_costs(l_cost_index).start_date,
					      p_original_end_date => g_costs(l_cost_index).end_date,
					      p_new_start_date => g_costs(l_cost_index).start_date,
					      p_new_end_date => p_start_date - 1));
Line: 7200

	      l_updated_record := TRUE;
Line: 7203

	    g_costs(l_cost_index).delete_flag := FALSE;
Line: 7212

	    Update_Position_Costs
		  (p_return_status => l_return_status,
	           p_msg_count     => l_msg_count,
	           p_msg_data      => l_msg_data,
		   p_position_element_line_id => g_costs(l_cost_index).position_element_line_id,
		   p_start_date => p_end_date + 1,
		   p_element_cost => Prorate (p_original_amount => g_costs(l_cost_index).element_cost,
					      p_original_start_date => g_costs(l_cost_index).start_date,
					      p_original_end_date => g_costs(l_cost_index).end_date,
					      p_new_start_date => p_end_date + 1,
					      p_new_end_date => g_costs(l_cost_index).end_date));
Line: 7227

	      l_updated_record := FALSE;
Line: 7230

	    g_costs(l_cost_index).delete_flag := FALSE;
Line: 7238

	    Insert_Position_Costs
		  (p_return_status => l_return_status,
	           p_msg_count     => l_msg_count,
	           p_msg_data      => l_msg_data,
		   p_position_id => p_position_id,
		   p_hr_budget_id => p_hr_budget_id,
		   p_pay_element_id => p_pay_element_id,
		   p_start_date => p_start_date,
		   p_end_date => p_end_date,
		   p_currency_code => p_currency_code,
		   p_element_cost => p_element_cost,
		   p_budget_revision_id => p_budget_revision_id,
		   p_base_line_version => p_base_line_version);
Line: 7267

	      if l_updated_record then
	      begin

		Insert_Position_Costs
		      (p_return_status => l_return_status,
	               p_msg_count     => l_msg_count,
	               p_msg_data      => l_msg_data,
		       p_position_id => g_costs(l_cost_index).position_id,
		       p_hr_budget_id => p_hr_budget_id,
		       p_pay_element_id => g_costs(l_cost_index).pay_element_id,
		       p_start_date => p_end_date + 1,
		       p_end_date => g_costs(l_cost_index).end_date,
		       p_currency_code => g_costs(l_cost_index).currency_code,
		       p_element_cost => Prorate (p_original_amount => g_costs(l_cost_index).element_cost,
						  p_original_start_date => g_costs(l_cost_index).start_date,
						  p_original_end_date => g_costs(l_cost_index).end_date,
						  p_new_start_date => p_end_date + 1,
						  p_new_end_date => g_costs(l_cost_index).end_date),
		       p_budget_revision_id => g_costs(l_cost_index).budget_revision_id,
		       p_base_line_version => g_costs(l_cost_index).base_line_version);
Line: 7296

		Update_Position_Costs
		      (p_return_status => l_return_status,
	               p_msg_count     => l_msg_count,
	               p_msg_data      => l_msg_data,
		       p_position_element_line_id => g_costs(l_cost_index).position_element_line_id,
		       p_start_date => p_end_date + 1,
		       p_end_date => g_costs(l_cost_index).end_date,
		       p_element_cost => Prorate (p_original_amount => g_costs(l_cost_index).element_cost,
						  p_original_start_date => g_costs(l_cost_index).start_date,
						  p_original_end_date => g_costs(l_cost_index).end_date,
						  p_new_start_date => p_end_date + 1,
						  p_new_end_date => g_costs(l_cost_index).end_date));
Line: 7313

		g_costs(l_cost_index).delete_flag := FALSE;
Line: 7334

      if g_costs(l_cost_index).delete_flag then
      begin

	Delete_Position_Costs
	      (p_return_status => l_return_status,
	       p_msg_count     => l_msg_count,
	       p_msg_data      => l_msg_data,
	       p_position_element_line_id => g_costs(l_cost_index).position_element_line_id);
Line: 7398

PROCEDURE Insert_Position_FTE
( p_return_status          OUT  NOCOPY  VARCHAR2,
  p_msg_count              OUT  NOCOPY  NUMBER,
  p_msg_data               OUT  NOCOPY  VARCHAR2,
  p_position_id            IN   NUMBER,
  p_hr_budget_id           IN   NUMBER,
  p_budget_revision_id     IN   NUMBER,
  p_base_line_version      IN   VARCHAR2,
  p_start_date             IN   DATE,
  p_end_date               IN   DATE,
  p_fte                    IN   NUMBER
) IS

  l_api_name               CONSTANT VARCHAR2(30)   := 'Insert_Position_FTE';
Line: 7418

  insert into PSB_POSITION_FTE
	(position_fte_line_id, position_id, hr_budget_id, budget_revision_id, base_line_version,
	 start_date, end_date, fte, last_update_date, last_updated_by, last_update_login,
	 created_by, creation_date)
   VALUES (PSB_POSITION_FTE_S.NEXTVAL, p_position_id, p_hr_budget_id, p_budget_revision_id, p_base_line_version,
	   p_start_date, p_end_date, nvl(p_fte, 0), sysdate, FND_GLOBAL.USER_ID, FND_GLOBAL.LOGIN_ID,
	   FND_GLOBAL.USER_ID, sysdate) RETURNING position_fte_line_id INTO l_position_fte_line_id;
Line: 7456

END Insert_Position_FTE;
Line: 7460

PROCEDURE Update_Position_FTE
( p_return_status         OUT  NOCOPY  VARCHAR2,
  p_msg_count             OUT  NOCOPY  NUMBER,
  p_msg_data              OUT  NOCOPY  VARCHAR2,
  p_position_fte_line_id  IN   NUMBER,
  p_start_date            IN   DATE := FND_API.G_MISS_DATE,
  p_end_date              IN   DATE := FND_API.G_MISS_DATE,
  p_fte                   IN   NUMBER
) IS

  l_api_name               CONSTANT VARCHAR2(30)   := 'Update_Position_FTE';
Line: 7474

  update PSB_POSITION_FTE
     set fte = nvl(p_fte, 0),
	 start_date = decode(p_start_date, FND_API.G_MISS_DATE, start_date, p_start_date),
	 end_date = decode(p_end_date, FND_API.G_MISS_DATE, end_date, p_end_date),
	 last_update_date = sysdate,
	 last_updated_by = FND_GLOBAL.USER_ID,
	 last_update_login = FND_GLOBAL.LOGIN_ID
    where position_fte_line_id = p_position_fte_line_id;
Line: 7513

END Update_Position_FTE;
Line: 7517

PROCEDURE Delete_Position_FTE
( p_return_status         OUT  NOCOPY  VARCHAR2,
  p_msg_count             OUT  NOCOPY  NUMBER,
  p_msg_data              OUT  NOCOPY  VARCHAR2,
  p_position_fte_line_id  IN   NUMBER
) IS

  l_api_name               CONSTANT VARCHAR2(30)   := 'Delete_Position_FTE';
Line: 7528

  delete from PSB_POSITION_FTE
   where position_fte_line_id = p_position_fte_line_id;
Line: 7561

END Delete_Position_FTE;
Line: 7589

  l_updated_record         BOOLEAN;
Line: 7591

  l_update_flag           BOOLEAN := TRUE;
Line: 7597

    select *
      from PSB_POSITION_FTE
     where position_id = p_position_id
       and nvl(hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
       and nvl(budget_revision_id, -1) = nvl(p_budget_revision_id, -1)
       and nvl(base_line_version, FND_API.G_MISS_CHAR) = nvl(p_base_line_version, FND_API.G_MISS_CHAR)
       and ((((p_end_date is not null)
	 and ((start_date <= p_end_date)
	  and (end_date is null))
	  or ((start_date between p_start_date and p_end_date)
	   or (end_date between p_start_date and p_end_date)
	  or ((start_date < p_start_date)
	  and (end_date > p_end_date)))))
	  or ((p_end_date is null)
	  and (nvl(end_date, p_start_date) >= p_start_date)));
Line: 7635

  update PSB_POSITION_FTE
     set fte = nvl(p_fte, 0),
	 last_update_date = sysdate,
	 last_updated_by = FND_GLOBAL.USER_ID,
	 last_update_login = FND_GLOBAL.LOGIN_ID
   where position_id = p_position_id
     and nvl(hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
     and nvl(budget_revision_id, -1) = nvl(p_budget_revision_id, -1)
     and nvl(base_line_version, FND_API.G_MISS_CHAR) = nvl(p_base_line_version, FND_API.G_MISS_CHAR)
     and start_date = p_start_date
     and nvl(end_date, FND_API.G_MISS_DATE) = nvl(p_end_date, FND_API.G_MISS_DATE);
Line: 7649

      l_update_flag := FALSE;
Line: 7653

      l_update_flag := FALSE;
Line: 7656

  if not l_update_flag then --if SQL%NOTFOUND then
  /*For Bug No : 1808322 End*/
  begin

    for l_init_index in 1..g_fte.Count loop
      g_fte(l_init_index).position_fte_line_id := null;
Line: 7668

      g_fte(l_init_index).delete_flag := null;
Line: 7687

      g_fte(g_num_fte).delete_flag := TRUE;
Line: 7695

      Insert_Position_FTE
	   (p_return_status => l_return_status,
	    p_msg_count     => l_msg_count,
	    p_msg_data      => l_msg_data,
	    p_position_id   => p_position_id,
	    p_hr_budget_id  => p_hr_budget_id,
	    p_start_date    => p_start_date,
	    p_end_date      => p_end_date,
	    p_fte           => p_fte,
	    p_budget_revision_id => p_budget_revision_id,
	    p_base_line_version  => p_base_line_version);
Line: 7717

	l_updated_record := FALSE;
Line: 7724

	  Update_Position_FTE
		(p_return_status => l_return_status,
	         p_msg_count     => l_msg_count,
	         p_msg_data      => l_msg_data,
		 p_position_fte_line_id => g_fte(l_fte_index).position_fte_line_id,
		 p_end_date => p_end_date,
		 p_fte => p_fte);
Line: 7736

	  g_fte(l_fte_index).delete_flag := FALSE;
Line: 7754

	    Update_Position_FTE
		  (p_return_status => l_return_status,
	           p_msg_count     => l_msg_count,
	           p_msg_data      => l_msg_data,
		   p_position_fte_line_id => g_fte(l_fte_index).position_fte_line_id,
		   p_end_date => p_start_date - 1,
		   p_fte => g_fte(l_fte_index).fte);
Line: 7765

	      l_updated_record := TRUE;
Line: 7768

	    g_fte(l_fte_index).delete_flag := FALSE;
Line: 7777

	    Update_Position_FTE
		  (p_return_status => l_return_status,
	           p_msg_count     => l_msg_count,
	           p_msg_data      => l_msg_data,
		   p_position_fte_line_id => g_fte(l_fte_index).position_fte_line_id,
		   p_start_date => p_end_date + 1,
		   p_fte => g_fte(l_fte_index).fte);
Line: 7788

	      l_updated_record := FALSE;
Line: 7791

	    g_fte(l_fte_index).delete_flag := FALSE;
Line: 7799

	    Insert_Position_FTE
		  (p_return_status => l_return_status,
	           p_msg_count     => l_msg_count,
	           p_msg_data      => l_msg_data,
		   p_position_id => p_position_id,
		   p_hr_budget_id => p_hr_budget_id,
		   p_start_date => p_start_date,
		   p_end_date => p_end_date,
		   p_fte => p_fte,
		   p_budget_revision_id => p_budget_revision_id,
		   p_base_line_version => p_base_line_version);
Line: 7826

	      if l_updated_record then
	      begin

		Insert_Position_FTE
		      (p_return_status => l_return_status,
	               p_msg_count     => l_msg_count,
	               p_msg_data      => l_msg_data,
		       p_position_id => g_fte(l_fte_index).position_id,
		       p_hr_budget_id => p_hr_budget_id,
		       p_start_date => p_end_date + 1,
		       p_end_date => g_fte(l_fte_index).end_date,
		       p_fte => g_fte(l_fte_index).fte,
		       p_budget_revision_id => g_fte(l_fte_index).budget_revision_id,
		       p_base_line_version => g_fte(l_fte_index).base_line_version);
Line: 7849

		Update_Position_FTE
		      (p_return_status => l_return_status,
	               p_msg_count     => l_msg_count,
	               p_msg_data      => l_msg_data,
		       p_position_fte_line_id => g_fte(l_fte_index).position_fte_line_id,
		       p_start_date => p_end_date + 1,
		       p_end_date => g_fte(l_fte_index).end_date,
		       p_fte => g_fte(l_fte_index).fte);
Line: 7862

		g_fte(l_fte_index).delete_flag := FALSE;
Line: 7883

      if g_fte(l_fte_index).delete_flag then
      begin

	Delete_Position_FTE
	      (p_return_status => l_return_status,
	       p_msg_count     => l_msg_count,
	       p_msg_data      => l_msg_data,
	       p_position_fte_line_id => g_fte(l_fte_index).position_fte_line_id);
Line: 7961

    select short_name, nvl(organization_id, business_group_id) organization_id,
	   effective_start_date, effective_end_date
      from PSB_BUDGET_GROUPS
     where budget_group_type = 'R'
     start with budget_group_id = p_budget_group_id
   connect by prior budget_group_id = parent_budget_group_id;
Line: 8050

    select pc.proc_period_type
      from pqh_psb_budgets pb, pay_calendars pc
     where pb.budget_id = p_hr_budget_id
       and pc.period_set_name = pb.period_set_name;
Line: 8056

    select min(period_distribution_type) psb_period_type
      from psb_budget_periods
     where budget_period_id between p_from_budget_year_id and p_to_budget_year_id
       and budget_period_type = 'Y';
Line: 8062

    select meaning from fnd_lookups
     where lookup_type = 'PSB_PERIOD_DISTRIBUTION_TYPES'
       and lookup_code = l_psb_period_type;
Line: 8067

    select tpt.display_period_type
      from per_time_period_types tpt, per_time_period_rules tpr
     where tpr.number_per_fiscal_year = tpt.number_per_fiscal_year
       and tpr.proc_period_type = l_hrms_period_type;
Line: 8167

    select b.pay_element_id
      from PSB_PAY_ELEMENTS a,
	   PSB_PAY_ELEMENTS b
     where a.pay_element_id = p_element_id
       and b.data_extract_id = p_data_extract_id
       and b.name = a.name;
Line: 8175

    select 'Exists'
      from dual
     where exists
	  (select 'Exists'
	     from psb_ws_lines_positions wlp, psb_ws_position_lines wpl, psb_position_assignments ppa
	    where wlp.worksheet_id = p_source_id
	      and wpl.position_line_id = wlp.position_line_id
	      and ppa.position_id = wpl.position_id
	      and ppa.pay_element_id = l_element_id
	   /* For Bug No. 2599262 : Start */
	      and (ppa.worksheet_id = p_source_id OR ppa.worksheet_id IS NULL)
	   /* For Bug No. 2599262 : End */
	   );
Line: 8190

    select 'Exists'
      from dual
     where exists
	  (select 'Exists'
	     from psb_budget_revision_pos_lines brpl, psb_budget_revision_positions brp, psb_position_assignments ppa
	    where brpl.budget_revision_id = p_source_id
	      and brp.budget_revision_pos_line_id = brpl.budget_revision_pos_line_id
	      and ppa.position_id = brp.position_id
	      and ppa.pay_element_id = p_element_id
	   /* For Bug No. 2599262 : Start */
	      and (ppa.worksheet_id = p_source_id OR ppa.worksheet_id IS NULL)
	   /* For Bug No. 2599262 : End */
	   );
Line: 8245

    select pay_freq_payroll_id
      from hr_all_positions_f
     where position_id = p_hr_position_id
       /*For Bug No : 2292003 Start*/
       --and p_effective_start_date between effective_start_date and effective_end_date
       and ((p_effective_start_date between effective_start_date and effective_end_date) OR
	    (p_effective_end_date between effective_start_date and effective_end_date)
	   );
Line: 8256

    select payroll_id
      from per_all_assignments_f
     where position_id = p_hr_position_id
       and person_id in
	  (select hr_employee_id from PSB_POSITIONS
	    where hr_position_id = p_hr_position_id
	      and data_extract_id = p_data_extract_id)
       /*For Bug No : 2292003 Start*/
       --and p_effective_start_date between effective_start_date and effective_end_date
       and ((p_effective_start_date between effective_start_date and effective_end_date) OR
	    (p_effective_end_date between effective_start_date and effective_end_date)
	   )
       /*For Bug No : 2292003 End*/
       and assignment_type = 'E';
Line: 8310

    select position_id, name, hr_position_id, hr_employee_id, effective_start_date
      from psb_positions
     where data_extract_id = p_data_extract_id;
Line: 8315

    select position_id, name, hr_position_id, hr_employee_id, effective_start_date
      from psb_positions
     where data_extract_id = p_system_data_extract_id;
Line: 8321

    select name, transaction_id
      from psb_positions
     where position_id = positionid
       and hr_position_id is null;
Line: 8486

    select pay_element_id, name
      from psb_pay_elements
     where data_extract_id = p_system_data_extract_id
       and budget_set_id is null;
Line: 8565

    select ppe.pay_element_id, ppe.budget_set_id, sum(nvl(ppc.element_cost,0)) element_cost
      from psb_pay_elements ppe,
	   psb_position_costs ppc,
	   psb_positions pp
     where ppe.data_extract_id = p_data_extract_id
       and ppc.pay_element_id = ppe.pay_element_id
       and pp.data_extract_id = p_data_extract_id
       and pp.hr_position_id = p_hr_position_id
       and ppc.position_id = pp.position_id
       and nvl(ppc.hr_budget_id, -1) = nvl(p_hr_budget_id, -1)
       and ((p_event_type = 'BP' and ppc.base_line_version = 'C')
	   or (p_event_type = 'BR' and ppc.budget_revision_id = p_source_id))
       and ppc.currency_code = p_currency_code
       and ((ppc.start_date between p_start_date and p_end_date)
	 or (ppc.end_date between p_start_date and p_end_date)
	 or ((ppc.start_date < p_start_date) and (ppc.end_date > p_end_date)))
    group by ppe.budget_set_id, ppe.pay_element_id;
Line: 8653

    select distinct c.pay_element_id, b.code_combination_id,
	   b.distribution_percent
      from PSB_PAY_ELEMENTS c, PSB_POSITION_PAY_DISTRIBUTIONS b
     where c.data_extract_id = p_data_extract_id
       and c.salary_flag = 'Y'
       and b.position_id in
	  (select a.position_id from PSB_POSITIONS a
	    where a.hr_position_id = p_hr_position_id
	      and a.data_extract_id = p_data_extract_id)
       and exists
	  (select 1 from PSB_POSITION_ASSIGNMENTS d
	    where d.position_id = b.position_id and d.pay_element_id = c.pay_element_id)
       and ((b.worksheet_id = p_source_id)
	 or (b.worksheet_id is null
       and not exists
	  (select 1 from PSB_POSITION_PAY_DISTRIBUTIONS c
	    where c.position_id = b.position_id
	      and c.worksheet_id = p_source_id)))
       and b.chart_of_accounts_id = p_gl_flex_code
       and b.code_combination_id is not null
       and (((p_end_date is not null)
	 and (((b.effective_start_date <= p_end_date)
	   and (b.effective_end_date is null))
	   or ((b.effective_start_date between p_start_date and p_end_date)
	   or (b.effective_end_date between p_start_date and p_end_date)
	   or ((b.effective_start_date < p_start_date)
	   and (b.effective_end_date > p_end_date)))))
	or ((p_end_date is null)
	and (nvl(b.effective_end_date, p_start_date) >= p_start_date)))
     order by b.distribution_percent desc;
Line: 8824

    select distinct a.segment1, a.segment2, a.segment3, a.segment4,
	   a.segment5, a.segment6, a.segment7, a.segment8,
	   a.segment9, a.segment10, a.segment11, a.segment12,
	   a.segment13, a.segment14, a.segment15, a.segment16,
	   a.segment17, a.segment18, a.segment19, a.segment20,
	   a.segment21, a.segment22, a.segment23, a.segment24,
	   a.segment25, a.segment26, a.segment27, a.segment28,
	   a.segment29, a.segment30,
	   a.code_combination_id, a.distribution_percent, e.pay_element_id,
           e.follow_salary, /* bug No: 3666828 */ e.name
      from PSB_PAY_ELEMENTS e, PSB_PAY_ELEMENT_DISTRIBUTIONS a,
	   PSB_ELEMENT_POS_SET_GROUPS b,
	   PSB_SET_RELATIONS c,
	   PSB_BUDGET_POSITIONS d
     where e.data_extract_id = p_data_extract_id
       and e.salary_flag <> 'Y'
       and a.chart_of_accounts_id = p_gl_flex_code
       and (((a.effective_start_date <= p_end_date)
	 and (a.effective_end_date is null))
	 or ((a.effective_start_date between p_start_date and p_end_date)
	  or (a.effective_end_date between p_start_date and p_end_date)
	 or ((a.effective_start_date < p_start_date)
	 and (a.effective_end_date > p_end_date))))
       and a.position_set_group_id = b.position_set_group_id
       and b.position_set_group_id = c.position_set_group_id
       and b.pay_element_id = e.pay_element_id
       and c.account_position_set_id = d.account_position_set_id
       and exists
	  (select 1 from PSB_POSITION_ASSIGNMENTS g
	    where g.position_id = d.position_id
            and g.pay_element_id = e.pay_element_id)
       and d.position_id in
	  (select f.position_id from PSB_POSITIONS f
	    where f.hr_position_id = p_hr_position_id
	      and f.data_extract_id = p_data_extract_id);
Line: 9407

    select version_number, budget_version_id, object_version_number, date_from, date_to,
	   budget_unit1_value, budget_unit2_value, budget_unit3_value
      from pqh_psb_budget_versions
     where budget_id = p_hr_budget_id
       and version_number =
	  (select max(version_number) from pqh_psb_budget_versions
	    where budget_id = p_hr_budget_id);
Line: 9416

    select version_number, budget_version_id, object_version_number
      from pqh_psb_budget_versions
     where budget_id = p_hr_budget_id
       and date_from = p_start_date
       and date_to = p_end_date;
Line: 9423

    select sum(ppc.element_cost) total_cost
      from psb_positions pp, psb_position_costs ppc
     where pp.data_extract_id = p_system_data_extract_id
       and exists
	  (select 'Exists'
	     from psb_positions pp1, psb_ws_position_lines wpl, psb_ws_lines_positions wlp
	    where pp1.data_extract_id = p_data_extract_id
	      and pp1.hr_position_id = pp.hr_position_id
	      and wpl.position_id = pp1.position_id
	      and wlp.position_line_id = wpl.position_line_id
	      and wlp.worksheet_id = p_source_id)
       and ppc.position_id = pp.position_id
       and ppc.hr_budget_id = p_hr_budget_id
       and ppc.base_line_version = 'O'
       and ppc.currency_code = p_currency_code
       and ppc.budget_revision_id is null
       and ((ppc.start_date between p_start_date and p_end_date)
	 or (ppc.end_date between p_start_date and p_end_date)
	 or ((ppc.start_date < p_start_date) and (ppc.end_date > p_end_date)));
Line: 9444

    select sum(decode(b.revision_type, 'I', b.revision_amount,
				       'D', -b.revision_amount)) revision_amount
      from psb_budget_revision_lines a,
	   psb_budget_revision_accounts b
     where a.budget_revision_id = p_source_id
       and b.budget_revision_acct_line_id = a.budget_revision_acct_line_id
       and b.position_id is not null;
Line: 9453

    select sum(avg(ppf.fte)) total_fte
      from psb_positions pp, psb_position_fte ppf
     where pp.data_extract_id = p_system_data_extract_id
       and exists
	  (select 'Exists'
	     from psb_positions pp1, psb_ws_position_lines wpl, psb_ws_lines_positions wlp
	    where pp1.data_extract_id = p_data_extract_id
	      and pp1.hr_position_id = pp.hr_position_id
	      and wpl.position_id = pp1.position_id
	      and wlp.position_line_id = wpl.position_line_id
	      and wlp.worksheet_id = p_source_id)
       and ppf.position_id = pp.position_id
       and ppf.hr_budget_id = p_hr_budget_id
       and ppf.base_line_version = 'O'
       and ppf.budget_revision_id is null
       and ((ppf.start_date between p_start_date and p_end_date)
	 or (ppf.end_date between p_start_date and p_end_date)
	 or ((ppf.start_date < p_start_date) and (ppf.end_date > p_end_date)))
     group by ppf.position_id;
Line: 9474

    select brp.position_id, brp.effective_start_date, brp.effective_end_date,
	   brp.revision_type, brp.revision_value_type, brp.revision_value
      from psb_budget_revision_pos_lines brpl,
	   psb_budget_revision_positions brp
     where brpl.budget_revision_id = p_source_id
       and brp.budget_revision_pos_line_id = brpl.budget_revision_pos_line_id;
Line: 9486

  SELECT position_id
  FROM   psb_ws_position_lines a, psb_ws_lines_positions b
  WHERE  worksheet_id = p_source_id
  AND    a.position_line_id = b.position_line_id;
Line: 9530

        l_position_id_tbl.DELETE;
Line: 9675

    pqh_psb_interface_api.update_budget_version
      (p_validate              => false,
       p_budget_id             => p_hr_budget_id,
       p_budget_version_id     => l_budget_version_id,
       p_version_number        => l_version_number,
       p_date_from             => l_date_from,
       p_date_to               => l_date_to,
       p_transfered_to_gl_flag => 'N',
       p_xfer_to_other_apps_cd => 'N',
       p_object_version_number => l_object_version_number,
       p_budget_unit1_value    => l_budget_unit1_value,
       p_budget_unit2_value    => l_budget_unit2_value,
       p_budget_unit3_value    => l_budget_unit3_value,
       p_effective_date        => sysdate);
Line: 9697

      add_message('PSB', 'PSB_PQH_UPDATE_BUDGET_VERSION');
Line: 9912

    select dflt_budget_element_id,
	   element_type_id,
	   dflt_dist_percentage
      from pqh_psb_dflt_budget_elements
     where dflt_budget_set_id = p_dflt_budget_set_id;
Line: 9919

    select *
      from pqh_psb_budget_elements
     where budget_set_id = p_pqh_budget_set_id
       and element_type_id = elemtypeid;
Line: 9925

    select *
      from pqh_psb_budget_fund_srcs
     where budget_element_id = l_pqh_budget_element_id
       and cost_allocation_keyflex_id = l_cost_keyflex_id;
Line: 9965

	pqh_psb_interface_api.update_budget_element
	  (p_validate => false,
	   p_budget_element_id => c_pqh_budget_elements_rec.budget_element_id,
	   p_budget_set_id => p_pqh_budget_set_id,
	   p_element_type_id => c_dflt_budget_elem_rec.element_type_id,
	   p_distribution_percentage => c_dflt_budget_elem_rec.dflt_dist_percentage,
	   p_object_version_number => c_pqh_budget_elements_rec.object_version_number);
Line: 9977

	   add_message('PSB', 'PSB_PQH_UPDATE_BUDGET_ELEMENT');
Line: 10029

	  pqh_psb_interface_api.update_budget_fund_src
	     (p_validate                       =>  false,
	      p_budget_fund_src_id             =>  c_pqh_fund_srcs_rec.budget_fund_src_id,
	      p_budget_element_id              =>  l_pqh_budget_element_id,
	      p_cost_allocation_keyflex_id     =>  l_cost_keyflex_id,
	      p_distribution_percentage        =>  g_budgetset_dists(l_dist_index).percent,
	      p_object_version_number          =>  c_pqh_fund_srcs_rec.object_version_number);
Line: 10041

	     add_message('PSB', 'PSB_PQH_UPDATE_BUDGET_FUND_SRC');
Line: 10156

    select a.start_date, a.end_date, a.fte, b.cost
      from
	  (
	   select ppf.start_date,
		  ppf.end_date,
		  sum(ppf.fte) fte
	     from psb_position_fte ppf,
		  psb_positions pp
	    where pp.data_extract_id = p_system_data_extract_id
	      and pp.hr_position_id = p_hr_position_id
	      and ppf.position_id = pp.position_id
	      and ppf.hr_budget_id = p_hr_budget_id
	      and ((p_event_type = 'BP' and ppf.base_line_version = 'C')
		   or (p_event_type = 'BR' and ppf.budget_revision_id = p_source_id))
	      and ((ppf.start_date between p_start_date and p_end_date)
		or (ppf.end_date between p_start_date and p_end_date)
		or ((ppf.start_date < p_start_date) and (ppf.end_date > p_end_date)))
	 group by ppf.start_date, ppf.end_date
	  ) a,
	  (select ppc.start_date, ppc.end_date, sum(ppc.element_cost) cost
	     from psb_position_costs ppc, psb_positions pp
	    where pp.data_extract_id = p_system_data_extract_id
	      and pp.hr_position_id = p_hr_position_id
	      and ppc.position_id = pp.position_id
	      and ppc.hr_budget_id = p_hr_budget_id
	      and ((p_event_type = 'BP' and ppc.base_line_version = 'C')
		   or (p_event_type = 'BR' and ppc.budget_revision_id = p_source_id))
	      and ppc.currency_code = p_currency_code
	      and ((ppc.start_date between p_start_date and p_end_date)
		or (ppc.end_date between p_start_date and p_end_date)
		or ((ppc.start_date < p_start_date) and (ppc.end_date > p_end_date)))
	 group by ppc.start_date, ppc.end_date
	   ) b
       where b.start_date between a.start_date and a.end_date
	   or b.end_date between a.start_date and a.end_date
	   or ((b.start_date < a.start_date) and (b.end_date > a.end_date));
Line: 10194

    select *
      from pqh_psb_budget_periods
     where budget_detail_id = p_pqh_budget_detail_id
       and start_time_period_id = start_period_id
       and end_time_period_id = end_period_id;
Line: 10201

    select pt.time_period_id, pt.start_date, pt.end_date
      from per_time_periods pt, pqh_psb_budgets pb
     where pb.budget_id = p_hr_budget_id
       and pt.period_set_name = pb.period_set_name
       and startdate between pt.start_date and pt.end_date;
Line: 10208

    select pt.time_period_id, pt.start_date, pt.end_date
      from per_time_periods pt, pqh_psb_budgets pb
     where pb.budget_id = p_hr_budget_id
       and pt.period_set_name = pb.period_set_name
       and ((pt.start_date between startdate and enddate)
	 or (pt.end_date between startdate and enddate)
	 or ((pt.start_date < startdate) and (pt.end_date > enddate)));
Line: 10217

    select ppe.budget_set_id hr_budget_set_id,
	   sum(nvl(ppc.element_cost,0)) budget_set_cost
      from psb_pay_elements ppe,
	   psb_position_costs ppc,
	   psb_positions pp
     where ppe.data_extract_id = p_system_data_extract_id
       and pp.hr_position_id = p_hr_position_id
       and pp.data_extract_id = p_system_data_extract_id
       and ppc.position_id = pp.position_id
       and ppc.pay_element_id = ppe.pay_element_id
       and ppc.hr_budget_id = p_hr_budget_id
       and ((p_event_type = 'BP' and ppc.base_line_version = 'C')
	   or (p_event_type = 'BR' and ppc.budget_revision_id = p_source_id))
       and ppc.currency_code = p_currency_code
       and ((ppc.start_date between startdate and enddate)
	 or (ppc.end_date between startdate and enddate)
	 or ((ppc.start_date < startdate) and (ppc.end_date > enddate)))
    group by ppe.budget_set_id;
Line: 10237

    select *
      from pqh_psb_budget_sets
     where budget_period_id = l_pqh_budget_period_id
       and dflt_budget_set_id = hrbudgetsetid;
Line: 10385

	  pqh_psb_interface_api.update_budget_period
	    (p_validate => false,
	     p_budget_period_id => c_pqh_budget_periods_rec.budget_period_id,
	     p_budget_detail_id => c_pqh_budget_periods_rec.budget_detail_id,
	     p_start_time_period_id => c_pqh_budget_periods_rec.start_time_period_id,
	     p_end_time_period_id => c_pqh_budget_periods_rec.end_time_period_id,
	     p_budget_unit1_value_type_cd => 'V',
	     p_budget_unit1_value => l_budget_unit1_value,
	     p_budget_unit2_value_type_cd => 'V',
	     p_budget_unit2_value => l_budget_unit2_value,
	     p_budget_unit3_value_type_cd => 'V',
	     p_budget_unit3_value => l_budget_unit3_value,
	     p_object_version_number => c_pqh_budget_periods_rec.object_version_number);
Line: 10403

	    add_message('PSB', 'PSB_PQH_UPDATE_BUDGET_PERIOD');
Line: 10473

	    pqh_psb_interface_api.update_budget_set
	       (p_validate => false,
		p_budget_set_id => c_pqh_budget_sets_rec.budget_set_id,
		p_dflt_budget_set_id => l_bs_cost.hr_budget_set_id(l_bs_index),
		p_budget_period_id => l_pqh_budget_period_id,
		p_budget_unit1_value_type_cd => 'V',
		p_budget_unit1_value => l_budget_unit1_value,
		p_budget_unit2_value_type_cd => 'V',
		p_budget_unit2_value => l_budget_unit2_value,
		p_budget_unit3_value_type_cd => 'V',
		p_budget_unit3_value => l_budget_unit3_value,
		p_object_version_number => c_pqh_budget_sets_rec.object_version_number,
		p_effective_date => sysdate);
Line: 10491

	      add_message('PSB', 'PSB_PQH_UPDATE_BUDGET_SET');
Line: 10598

    select *
      from pay_payroll_gl_flex_maps
     where payroll_id = p_payroll_id
       and gl_set_of_books_id = p_sob_id;
Line: 10605

    select payroll_name from pay_all_payrolls_f where payroll_id = p_payroll_id;
Line: 10622

	g_map_str := 'SELECT cost_allocation_keyflex_id '||
		      ' FROM pay_cost_allocation_keyflex cakf, gl_code_combinations glcc '||
		     ' WHERE cakf.id_flex_num = :b1 '||
		       ' AND cakf.'||c_map_segments_rec.payroll_cost_segment ||' = glcc.'||c_map_segments_rec.gl_account_segment ;
Line: 10833

    select a.fte_position_id, a.fte, b.cost
      from
	  (
	   select pp.hr_position_id fte_position_id, sum(avg_fte) fte
	     from
		 (select pp.position_id, avg(ppf.fte) avg_fte
		    from psb_positions pp, psb_position_fte ppf
		   where ppf.position_id = pp.position_id
		     and ppf.base_line_version = 'C'
		     and ppf.hr_budget_id = p_hr_budget_id
		     and ((ppf.start_date between p_start_date and p_end_date)
		       or (ppf.end_date between p_start_date and p_end_date)
		       or ((ppf.start_date < p_start_date) and (ppf.end_date > p_end_date)))
		   group by pp.position_id) pf, psb_positions pp
	     where pp.data_extract_id = p_system_data_extract_id
	       and pp.position_id = pf.position_id
	     group by pp.hr_position_id
	  ) a,
	  (
	   select pp.hr_position_id cost_position_id, sum(ppc.element_cost) cost
	     from psb_position_costs ppc, psb_positions pp
	    where pp.data_extract_id = p_system_data_extract_id
	      and ppc.hr_budget_id = p_hr_budget_id
	      and ppc.position_id = pp.position_id
	      and ppc.base_line_version = 'C'
	      and ppc.currency_code = p_currency_code
	      and ((ppc.start_date between p_start_date and p_end_date)
		or (ppc.end_date between p_start_date and p_end_date)
		or ((ppc.start_date < p_start_date) and (ppc.end_date > p_end_date)))
	     group by pp.hr_position_id
	   ) b
     where a.fte_position_id = b.cost_position_id;
Line: 10867

    select position_id, hr_employee_id, name, effective_start_date
      from psb_positions
     where data_extract_id = decode(p_event_type, 'BP', p_data_extract_id, p_system_data_extract_id)
       and hr_position_id = positionid
       and rownum < 2;
Line: 10874

    select position_id
      from psb_positions
     where data_extract_id = p_system_data_extract_id
       and hr_position_id = positionid
       and rownum < 2;
Line: 10881

    select *
      from pqh_psb_budget_details
     where budget_version_id = p_pqh_budget_version_id
       and position_id = positionid;
Line: 10887

    select *
      from pqh_psb_budget_details
     where budget_version_id = p_pqh_budget_version_id
       and budget_detail_id = l_pqh_budget_detail_id;
Line: 10893

    select sum(decode(b.revision_type, 'I', b.revision_amount,
				       'D', -b.revision_amount)) revision_amount
      from psb_budget_revision_lines a,
	   psb_budget_revision_accounts b,
	   psb_positions pp
     where a.budget_revision_id = p_source_id
       and b.budget_revision_acct_line_id = a.budget_revision_acct_line_id
       and pp.position_id = b.position_id
       and pp.data_extract_id = p_system_data_extract_id
       and pp.hr_position_id = positionid;
Line: 10905

    select a.attribute_id, a.attribute_value_id, c.attribute_value , hr_value_id
      from psb_position_assignments a,
	   psb_attributes b,
	   psb_attribute_values c
     where a.position_id  = positionid
       and a.data_extract_id = p_system_data_extract_id -- system_data_extract_id
       and a.attribute_id = b.attribute_id
       and b.system_attribute_type = 'JOB_CLASS'
       and c.attribute_value_id = a.attribute_value_id
       and c.data_extract_id = p_system_data_extract_id;
Line: 10917

    select a.attribute_id, a.attribute_value_id, c.attribute_value , hr_value_id
      from psb_position_assignments a,
	   psb_attributes b,
	   psb_attribute_values c
     where a.position_id  = positionid
       and a.data_extract_id = p_system_data_extract_id -- system_data_extract_id
       and a.attribute_id = b.attribute_id
       and b.system_attribute_type = 'ORG'
       and c.attribute_value_id = a.attribute_value_id
       and c.data_extract_id = p_system_data_extract_id;
Line: 10929

    select *
      from pqh_psb_budget_versions
     where budget_version_id = p_pqh_budget_version_id;
Line: 10935

    select set_of_books_id
     from psb_data_extracts
    where data_extract_id = p_system_data_extract_id;
Line: 11230

	   pqh_psb_interface_api.update_budget_detail
	     (p_validate => false,
	      p_budget_detail_id => c_pqh_budget_details_rec.budget_detail_id,
	      p_position_id => l_positions.hr_position_id(l_position_index),
	      p_job_id => l_job_id,
	      p_organization_id => l_org_id,
	      p_budget_version_id => c_pqh_budget_details_rec.budget_version_id,
	      p_budget_unit1_value_type_cd => 'V',
	      p_budget_unit1_value => l_budget_unit1_value,
	      p_budget_unit2_value_type_cd => 'V',
	      p_budget_unit2_value => l_budget_unit2_value,
	      p_budget_unit3_value_type_cd => 'V',
	      p_budget_unit3_value => l_budget_unit3_value,
	      p_object_version_number => c_pqh_budget_details_rec.object_version_number);
Line: 11249

	     add_message('PSB', 'PSB_PQH_UPDATE_BUDGET_DETAIL');
Line: 11308

		  (select avg(budget_unit1_value) period_avg_value
		     from pqh_psb_budget_periods
		    where budget_detail_id = l_pqh_budget_detail_id) loop
		 l_period_avg_value := c_period_avg_rec.period_avg_value;
Line: 11316

		 pqh_psb_interface_api.update_budget_detail
		    (p_validate => false,
		     p_budget_detail_id => l_pqh_budget_detail_id,
		     p_position_id => l_positions.hr_position_id(l_position_index),
		     p_budget_version_id => p_pqh_budget_version_id,
		     p_budget_unit1_value_type_cd => 'V',
		     p_budget_unit1_value => l_period_avg_value,
		     p_object_version_number => l_new_object_version_number);
Line: 11329

		   add_message('PSB', 'PSB_PQH_UPDATE_BUDGET_DETAIL');
Line: 11341

		  (select avg(budget_unit2_value) period_avg_value
		     from pqh_psb_budget_periods
		    where budget_detail_id = l_pqh_budget_detail_id) loop
		 l_period_avg_value := c_period_avg_rec.period_avg_value;
Line: 11349

		 pqh_psb_interface_api.update_budget_detail
		    (p_validate => false,
		     p_budget_detail_id => l_pqh_budget_detail_id,
		     p_position_id => l_positions.hr_position_id(l_position_index),
		     p_budget_version_id => p_pqh_budget_version_id,
		     p_budget_unit2_value_type_cd => 'V',
		     p_budget_unit2_value => l_period_avg_value,
		     p_object_version_number => l_new_object_version_number);
Line: 11362

		   add_message('PSB', 'PSB_PQH_UPDATE_BUDGET_DETAIL');
Line: 11374

		  (select avg(budget_unit3_value) period_avg_value
		     from pqh_psb_budget_periods
		    where budget_detail_id = l_pqh_budget_detail_id) loop
		 l_period_avg_value := c_period_avg_rec.period_avg_value;
Line: 11382

		 pqh_psb_interface_api.update_budget_detail
		    (p_validate => false,
		     p_budget_detail_id => l_pqh_budget_detail_id,
		     p_position_id => l_positions.hr_position_id(l_position_index),
		     p_budget_version_id => p_pqh_budget_version_id,
		     p_budget_unit3_value_type_cd => 'V',
		     p_budget_unit3_value => l_period_avg_value,
		     p_object_version_number => l_new_object_version_number);
Line: 11395

		   add_message('PSB', 'PSB_PQH_UPDATE_BUDGET_DETAIL');
Line: 11425

	       pqh_psb_interface_api.update_budget_version
		 (p_validate              => false,
		  p_budget_id             => p_hr_budget_id,
		  p_budget_version_id     => p_pqh_budget_version_id,
		  p_version_number        => l_version_number,
		  p_object_version_number => l_ver_object_version_number,
		  p_date_from             => l_start_date,
		  p_date_to               => l_end_date,
		  p_transfered_to_gl_flag => 'N',
		  p_xfer_to_other_apps_cd => 'N',
		  p_budget_unit1_value    => l_orig_budget_unit1_value,
		  p_budget_unit2_value    => l_orig_budget_unit2_value,
		  p_budget_unit3_value    => l_orig_budget_unit3_value,
		  p_effective_date        => sysdate);
Line: 11447

		 add_message('PSB', 'PSB_PQH_UPDATE_BUDGET_VERSION');
Line: 11578

    select shared_type_id, system_type_cd
      from per_shared_types_vl
     where system_type_cd in ('FTE', 'MONEY');
Line: 11583

    select budget_name, currency_code, business_group_id, budget_unit1_id, budget_unit2_id,
	   budget_unit3_id, budget_unit1_aggregate, budget_unit2_aggregate, budget_unit3_aggregate
      from pqh_psb_budgets
     where budget_id = p_hr_budget_id;
Line: 11592

    select currency_code, to_number(cost_allocation_structure) id_flex_num
      from per_business_groups_perf
     where business_group_id = l_business_group_id;
Line: 11598

    select nvl(chart_of_accounts_id, root_chart_of_accounts_id) flex_code,
	   nvl(root_budget_group_id, budget_group_id) root_budget_group_id
      from PSB_BUDGET_GROUPS_V
     where budget_group_id = l_budget_group_id;
Line: 11604

    select budget_calendar_id, budget_group_id, data_extract_id
      from PSB_WORKSHEETS
     where worksheet_id = p_source_id;
Line: 11609

    select budget_group_id
      from psb_budget_revisions
     where budget_revision_id = p_source_id;
Line: 11616

    select min(start_date) start_date, max(end_date) end_date
      from psb_budget_periods
     where budget_period_id between p_from_budget_year_id and p_to_budget_year_id
       and budget_calendar_id = l_budget_calendar_id
       and budget_period_type = 'Y';
Line: 11624

   select min(start_date) start_date, max(end_date) end_date
     from psb_position_fte
    where budget_revision_id = p_source_id
      and hr_budget_id = p_hr_budget_id;
Line: 11953

    select attribute_id
      from psb_attributes_vl
     where business_group_id = p_business_group_id
       and system_attribute_type = 'ORG';
Line: 11989

    select count(*)
      into l_syscount
      from psb_attribute_values
     where attribute_id = l_sysorg_id;
Line: 11994

    select count(*)
      into l_usrcount
      from psb_attribute_values
     where attribute_id = p_attribute_id;
Line: 12004

      Update psb_attribute_values
	 set attribute_id = l_sysorg_id
       where attribute_id = p_attribute_id;
Line: 12009

      Update psb_attribute_values_i
	 set attribute_id = l_sysorg_id
       where attribute_id = p_attribute_id;
Line: 12014

      update psb_account_position_set_lines
	 set attribute_id = l_sysorg_id
       where attribute_id = p_attribute_id;
Line: 12019

      Update psb_parameter_formulas
	 set attribute_id = l_sysorg_id
       where attribute_id = p_attribute_id;
Line: 12027

      Update psb_default_assignments
	 set attribute_id = l_sysorg_id
       where attribute_id = p_attribute_id;
Line: 12032

      Update psb_position_assignments
	 set attribute_id = l_sysorg_id
       where attribute_id = p_attribute_id;
Line: 12037

      Delete from psb_attributes_tl
       where attribute_id = p_attribute_id;
Line: 12041

      Delete from psb_attributes
       where attribute_id = p_attribute_id;
Line: 12050

      Update psb_attribute_values
	 set attribute_id = p_attribute_id
       where attribute_id = l_sysorg_id;
Line: 12055

      Update psb_attribute_values_i
	 set attribute_id = p_attribute_id
       where attribute_id = l_sysorg_id;
Line: 12060

      update psb_account_position_set_lines
	 set attribute_id = p_attribute_id
       where attribute_id = l_sysorg_id;
Line: 12065

      Update psb_parameter_formulas
	 set attribute_id = p_attribute_id
       where attribute_id = l_sysorg_id;
Line: 12073

      Update psb_default_assignments
	 set attribute_id = p_attribute_id
       where attribute_id = l_sysorg_id;
Line: 12078

      Update psb_position_assignments
	 set attribute_id = p_attribute_id
       where attribute_id = l_sysorg_id;
Line: 12083

      Delete from psb_attributes_tl
       where attribute_id = p_attribute_id;
Line: 12086

      Update psb_attributes_tl
	 set attribute_id = p_attribute_id
       where attribute_id = l_sysorg_id;
Line: 12091

      Delete from psb_attributes
       where attribute_id = p_attribute_id;
Line: 12094

      Update psb_attributes
	 set attribute_id = p_attribute_id
       where attribute_id = l_sysorg_id;
Line: 12234

   select PSB_ELEMENT_POS_SET_GROUPS_S.NEXTVAL seq
    from dual;
Line: 12238

  select *  from PSB_ELEMENT_POS_SET_GROUPS
   where pay_element_id = elemid;
Line: 12242

    select position_set_group_id
      from PSB_ELEMENT_POS_SET_GROUPS
     where pay_element_id = p_new_pay_element_id
       and name = psg_name;
Line: 12260

	--Insert the position set group for new element
	for c_elempossetgrp_seq_rec in c_elempossetgrp_seq loop
	  l_possetgrp_id := c_elempossetgrp_seq_rec.seq;
Line: 12265

	PSB_ELEMENT_POS_SET_GROUPS_PVT.Insert_Row
	   (p_api_version => 1.0,
	    p_return_status => l_return_status,
	    p_msg_count => l_msg_count,
	    p_msg_data => l_msg_data,
	    p_position_set_group_id => l_possetgrp_id,
	    p_pay_element_id => p_new_pay_element_id,
	    p_name => c_possetgrp_rec.name,
	    p_last_update_date => sysdate,
	    p_last_updated_by => FND_GLOBAL.USER_ID,
	    p_last_update_login => FND_GLOBAL.LOGIN_ID,
	    p_created_by => FND_GLOBAL.USER_ID,
	    p_creation_date => sysdate);
Line: 12330

  l_attribute_selection_type      VARCHAR2(1);
Line: 12341

    select *
      from PSB_SET_RELATIONS
     where position_set_group_id = possetgrpid;
Line: 12346

    select set_relation_id
      from PSB_SET_RELATIONS
     where position_set_group_id = possetgrpid
       and account_position_set_id = pos_set_id;
Line: 12352

    select *
      from PSB_ACCOUNT_POSITION_SETS
     where account_position_set_id = possetid;
Line: 12357

    select account_position_set_id , attribute_selection_type, rowid
      from PSB_ACCOUNT_POSITION_SETS
     where data_extract_id = p_target_data_extract_id
       and account_or_position_type = 'P'
       and name = possetname;
Line: 12364

    select PSB_ACCOUNT_POSITION_SETS_S.NEXTVAL seq
      from dual;
Line: 12368

    select PSB_SET_RELATIONS_S.NEXTVAL seq
      from dual;
Line: 12385

	      l_attribute_selection_type := c_posset_rec.attribute_selection_type;
Line: 12391

	      --Insert the position set
	      for c_posset_seq_rec in c_posset_seq loop
		l_position_set_id := c_posset_seq_rec.seq;
Line: 12396

	      PSB_ACCOUNT_POSITION_SET_PVT.Insert_Row
		 (p_api_version => 1.0,
		  p_return_status => l_return_status,
		  p_msg_count => l_msg_count,
		  p_msg_data => l_msg_data,
		  p_row_id => l_rowid,
		  p_account_position_set_id => l_position_set_id,
		  p_name => c_posset_rec.name,
		  p_set_of_books_id => c_posset_rec.set_of_books_id,
		  p_use_in_budget_group_flag => c_posset_rec.use_in_budget_group_flag,
		  p_data_extract_id => p_target_data_extract_id,
		  p_budget_group_id => p_budget_group_id,
		  p_global_or_local_type => c_posset_rec.global_or_local_type,
		  p_account_or_position_type =>c_posset_rec.account_or_position_type,
		  p_attribute_selection_type => c_posset_rec.attribute_selection_type,
		  p_business_group_id => c_posset_rec.business_group_id,
		  p_last_update_date => sysdate,
		  p_last_updated_by => FND_GLOBAL.USER_ID,
		  p_last_update_login => FND_GLOBAL.LOGIN_ID,
		  p_created_by => FND_GLOBAL.USER_ID,
		  p_creation_date => sysdate);
Line: 12421

	       --Position set is inserted
	    end;
Line: 12423

	    elsif c_posset_rec.attribute_selection_type <> l_attribute_selection_type then
		begin
	       --Update the Position Set with the new selection type
		  PSB_ACCOUNT_POSITION_SET_PVT.Update_Row
		     (p_api_version => 1.0,
		      p_return_status => l_return_status,
		      p_msg_count => l_msg_count,
		      p_msg_data => l_msg_data,
		      p_row_id => lp_rowid,
		      p_account_position_set_id => l_position_set_id,
		      p_name => c_posset_rec.name,
		      p_set_of_books_id => c_posset_rec.set_of_books_id,
		      p_data_extract_id => p_target_data_extract_id,
		      p_global_or_local_type => c_posset_rec.global_or_local_type,
		      p_account_or_position_type => c_posset_rec.account_or_position_type,
		      p_attribute_selection_type =>c_posset_rec.attribute_selection_type,
		      p_business_group_id => c_posset_rec.business_group_id,
		      p_last_update_date => sysdate,
		      p_last_updated_by => FND_GLOBAL.USER_ID,
		      p_last_update_login => FND_GLOBAL.LOGIN_ID);
Line: 12447

		--Position set is updated
		end;
Line: 12461

	    PSB_SET_RELATION_PVT.Insert_Row
	       (p_api_version => 1.0,
		p_return_status => l_return_status,
		p_msg_count => l_msg_count,
		p_msg_data => l_msg_data,
		p_row_id => l_rowid,
		p_set_relation_id => l_set_relation_id,
		p_account_position_set_id => l_position_set_id,
		p_allocation_rule_id => null,
		p_budget_group_id => null,
		p_budget_workflow_rule_id => null,
		p_constraint_id => null,
		p_default_rule_id => null,
		p_parameter_id => null,
		p_position_set_group_id => p_new_psg_id,
		/* Budget Revision Rules Enhancement Start */
		p_rule_id => null,
		p_apply_balance_flag => null,
		/* Budget Revision Rules Enhancement End */
		p_effective_start_date => null,
		p_effective_end_date => null,
		p_last_update_date => sysdate,
		p_last_updated_by => FND_GLOBAL.USER_ID,
		p_last_update_login => FND_GLOBAL.LOGIN_ID,
		p_created_by => FND_GLOBAL.USER_ID,
		p_creation_date => sysdate);
Line: 12524

  l_attribute_selection_type      VARCHAR2(1);
Line: 12539

    select *
      from PSB_ACCOUNT_POSITION_SET_LINES
     where account_position_set_id = possetid;
Line: 12544

    select *
      from PSB_POSITION_SET_LINE_VALUES
     where line_sequence_id = lineseqid;
Line: 12549

    select a.attribute_value_id
      from PSB_ATTRIBUTE_VALUES a,
	   PSB_ATTRIBUTE_VALUES b
     where a.data_extract_id = p_target_data_extract_id
       and a.attribute_value = b.attribute_value
       and a.attribute_id    = b.attribute_id -- added for Bug#4262388
       and b.attribute_value_id = attrvalid;
Line: 12558

    select line_sequence_id
      from PSB_ACCOUNT_POSITION_SET_LINES
     where attribute_id = attrid
       and account_position_set_id = possetid;
Line: 12564

    select attribute_value_id
      from PSB_ATTRIBUTE_VALUES
     where attribute_value_id = attr_val_id
       and attribute_value in
	   (select a.attribute_value
	      from PSB_ATTRIBUTE_VALUES a,
		   PSB_POSITION_SET_LINE_VALUES b
	     where a.attribute_value_id = b.attribute_value_id
	       and b.line_sequence_id = lineseqid);
Line: 12575

    select PSB_ACCT_POSITION_SET_LINES_S.NEXTVAL seq
      from dual;
Line: 12579

    select PSB_POSITION_SET_LINE_VALUES_S.NEXTVAL seq
      from dual;
Line: 12598

		  PSB_ACCT_POSITION_SET_LINE_PVT.Insert_Row
		     (p_api_version => 1.0,
		      p_return_status => l_return_status,
		      p_msg_count => l_msg_count,
		      p_msg_data => l_msg_data,
		      p_row_id => l_rowid,
		      p_line_sequence_id => l_line_sequence_id,
		      p_account_position_set_id => p_new_posset_id,
		      p_description => c_possetline_rec.description,
		      p_business_group_id => c_possetline_rec.business_group_id,
		      p_attribute_id => c_possetline_rec.attribute_id,
		      p_include_or_exclude_type => c_possetline_rec.include_or_exclude_type,
		      p_segment1_low => c_possetline_rec.segment1_low,
		      p_segment2_low => c_possetline_rec.segment2_low,
		      p_segment3_low => c_possetline_rec.segment3_low,
		      p_segment4_low => c_possetline_rec.segment4_low,
		      p_segment5_low => c_possetline_rec.segment5_low,
		      p_segment6_low => c_possetline_rec.segment6_low,
		      p_segment7_low => c_possetline_rec.segment7_low,
		      p_segment8_low => c_possetline_rec.segment8_low,
		      p_segment9_low => c_possetline_rec.segment9_low,
		      p_segment10_low => c_possetline_rec.segment10_low,
		      p_segment11_low => c_possetline_rec.segment11_low,
		      p_segment12_low => c_possetline_rec.segment12_low,
		      p_segment13_low => c_possetline_rec.segment13_low,
		      p_segment14_low => c_possetline_rec.segment14_low,
		      p_segment15_low => c_possetline_rec.segment15_low,
		      p_segment16_low => c_possetline_rec.segment16_low,
		      p_segment17_low => c_possetline_rec.segment17_low,
		      p_segment18_low => c_possetline_rec.segment18_low,
		      p_segment19_low => c_possetline_rec.segment19_low,
		      p_segment20_low => c_possetline_rec.segment20_low,
		      p_segment21_low => c_possetline_rec.segment21_low,
		      p_segment22_low => c_possetline_rec.segment22_low,
		      p_segment23_low => c_possetline_rec.segment23_low,
		      p_segment24_low => c_possetline_rec.segment24_low,
		      p_segment25_low => c_possetline_rec.segment25_low,
		      p_segment26_low => c_possetline_rec.segment26_low,
		      p_segment27_low => c_possetline_rec.segment27_low,
		      p_segment28_low => c_possetline_rec.segment28_low,
		      p_segment29_low => c_possetline_rec.segment29_low,
		      p_segment30_low => c_possetline_rec.segment30_low,
		      p_segment1_high => c_possetline_rec.segment1_high,
		      p_segment2_high => c_possetline_rec.segment2_high,
		      p_segment3_high => c_possetline_rec.segment3_high,
		      p_segment4_high => c_possetline_rec.segment4_high,
		      p_segment5_high => c_possetline_rec.segment5_high,
		      p_segment6_high => c_possetline_rec.segment6_high,
		      p_segment7_high => c_possetline_rec.segment7_high,
		      p_segment8_high => c_possetline_rec.segment8_high,
		      p_segment9_high => c_possetline_rec.segment9_high,
		      p_segment10_high => c_possetline_rec.segment10_high,
		      p_segment11_high => c_possetline_rec.segment11_high,
		      p_segment12_high => c_possetline_rec.segment12_high,
		      p_segment13_high => c_possetline_rec.segment13_high,
		      p_segment14_high => c_possetline_rec.segment14_high,
		      p_segment15_high => c_possetline_rec.segment15_high,
		      p_segment16_high => c_possetline_rec.segment16_high,
		      p_segment17_high => c_possetline_rec.segment17_high,
		      p_segment18_high => c_possetline_rec.segment18_high,
		      p_segment19_high => c_possetline_rec.segment19_high,
		      p_segment20_high => c_possetline_rec.segment20_high,
		      p_segment21_high => c_possetline_rec.segment21_high,
		      p_segment22_high => c_possetline_rec.segment22_high,
		      p_segment23_high => c_possetline_rec.segment23_high,
		      p_segment24_high => c_possetline_rec.segment24_high,
		      p_segment25_high => c_possetline_rec.segment25_high,
		      p_segment26_high => c_possetline_rec.segment26_high,
		      p_segment27_high => c_possetline_rec.segment27_high,
		      p_segment28_high => c_possetline_rec.segment28_high,
		      p_segment29_high => c_possetline_rec.segment29_high,
		      p_segment30_high => c_possetline_rec.segment30_high,
		      p_context => c_possetline_rec.context,
		      p_attribute1 => c_possetline_rec.attribute1,
		      p_attribute2 => c_possetline_rec.attribute2,
		      p_attribute3 => c_possetline_rec.attribute3,
		      p_attribute4 => c_possetline_rec.attribute4,
		      p_attribute5 => c_possetline_rec.attribute5,
		      p_attribute6 => c_possetline_rec.attribute6,
		      p_attribute7 => c_possetline_rec.attribute7,
		      p_attribute8 => c_possetline_rec.attribute8,
		      p_attribute9 => c_possetline_rec.attribute9,
		      p_attribute10 => c_possetline_rec.attribute10,
		      p_last_update_date => sysdate,
		      p_last_updated_by => FND_GLOBAL.USER_ID,
		      p_last_update_login => FND_GLOBAL.LOGIN_ID,
		      p_created_by => FND_GLOBAL.USER_ID,
		      p_creation_date => sysdate);
Line: 12711

		      PSB_POS_SET_LINE_VALUES_PVT.Insert_Row
			 (p_api_version => 1.0,
			  p_return_status => l_return_status,
			  p_msg_count => l_msg_count,
			  p_msg_data => l_msg_data,
			  p_row_id => l_rowid,
			  p_value_sequence_id => l_value_sequence_id,
			  p_line_sequence_id => l_line_sequence_id,
			  p_attribute_value_id => l_attribute_value_id,
			  p_attribute_value => c_possetlineval_rec.attribute_value,
			  p_last_update_date => sysdate,
			  p_last_updated_by => FND_GLOBAL.USER_ID,
			  p_last_update_login => FND_GLOBAL.LOGIN_ID,
			  p_created_by => FND_GLOBAL.USER_ID,
			  p_creation_date => sysdate);
Line: 12768

    select *
      from PSB_PAY_ELEMENT_DISTRIBUTIONS
     where position_set_group_id = possetgrpid;
Line: 12773

    select PSB_PAY_ELEMENT_DISTRIBUTION_S.NEXTVAL seq
      from dual;
Line: 12777

    select distribution_id, distribution_percent
      from PSB_PAY_ELEMENT_DISTRIBUTIONS
     where position_set_group_id = psg_id
       and ((cc_id is not null and code_combination_id = cc_id) or (concatenated_segments = con_segments));
Line: 12819

		--Check whether the line is already exists or not, if exists update the line o/w insert new one

		  l_distribution_exists  := FALSE;
Line: 12830

		 --Insert the line
		  for c_elemdist_seq_rec in c_elemdist_seq loop
		    l_distribution_id := c_elemdist_seq_rec.seq;
Line: 12835

		  PSB_ELEMENT_DISTRIBUTIONS_PVT.Insert_Row
		     (p_api_version => 1.0,
		      p_return_status => l_return_status,
		      p_msg_count => l_msg_count,
		      p_msg_data => l_msg_data,
		      p_distribution_id => l_distribution_id,
		      p_position_set_group_id => p_new_psg_id,
		      p_chart_of_accounts_id => c_elemdist_rec.chart_of_accounts_id,
		      p_effective_start_date => l_year_start_date,
		      p_effective_end_date => l_year_end_date,
		      p_distribution_percent => c_elemdist_rec.distribution_percent,
		      p_concatenated_segments => null,
		      p_code_combination_id => l_mapped_ccid,
		      p_distribution_set_id => c_elemdist_rec.distribution_set_id,
		      p_segment1 => null,
		      p_segment2 => null,
		      p_segment3 => null,
		      p_segment4 => null,
		      p_segment5 => null,
		      p_segment6 => null,
		      p_segment7 => null,
		      p_segment8 => null,
		      p_segment9 => null,
		      p_segment10 => null,
		      p_segment11 => null,
		      p_segment12 => null,
		      p_segment13 => null,
		      p_segment14 => null,
		      p_segment15 => null,
		      p_segment16 => null,
		      p_segment17 => null,
		      p_segment18 => null,
		      p_segment19 => null,
		      p_segment20 => null,
		      p_segment21 => null,
		      p_segment22 => null,
		      p_segment23 => null,
		      p_segment24 => null,
		      p_segment25 => null,
		      p_segment26 => null,
		      p_segment27 => null,
		      p_segment28 => null,
		      p_segment29 => null,
		      p_segment30 => null,
		      p_last_update_date => sysdate,
		      p_last_updated_by => FND_GLOBAL.USER_ID,
		      p_last_update_login => FND_GLOBAL.LOGIN_ID,
		      p_created_by => FND_GLOBAL.USER_ID,
		      p_creation_date => sysdate);
Line: 12888

		end;    --End of insert line
Line: 12890

		begin   --Update line
		  PSB_ELEMENT_DISTRIBUTIONS_PVT.Update_Row
		     (p_api_version => 1.0,
		      p_return_status => l_return_status,
		      p_msg_count => l_msg_count,
		      p_msg_data => l_msg_data,
		      p_distribution_id => l_distribution_id,
		      p_position_set_group_id => p_new_psg_id,
		      p_chart_of_accounts_id => c_elemdist_rec.chart_of_accounts_id,
		      p_effective_start_date => l_year_start_date,
		      p_effective_end_date => l_year_end_date,
		      p_distribution_percent => c_elemdist_rec.distribution_percent,
		      p_concatenated_segments => null,
		      p_code_combination_id => l_mapped_ccid,
		      p_distribution_set_id => c_elemdist_rec.distribution_set_id,
		      p_segment1 => null,
		      p_segment2 => null,
		      p_segment3 => null,
		      p_segment4 => null,
		      p_segment5 => null,
		      p_segment6 => null,
		      p_segment7 => null,
		      p_segment8 => null,
		      p_segment9 => null,
		      p_segment10 => null,
		      p_segment11 => null,
		      p_segment12 => null,
		      p_segment13 => null,
		      p_segment14 => null,
		      p_segment15 => null,
		      p_segment16 => null,
		      p_segment17 => null,
		      p_segment18 => null,
		      p_segment19 => null,
		      p_segment20 => null,
		      p_segment21 => null,
		      p_segment22 => null,
		      p_segment23 => null,
		      p_segment24 => null,
		      p_segment25 => null,
		      p_segment26 => null,
		      p_segment27 => null,
		      p_segment28 => null,
		      p_segment29 => null,
		      p_segment30 => null,
		      p_last_update_date => sysdate,
		      p_last_updated_by => FND_GLOBAL.USER_ID,
		      p_last_update_login => FND_GLOBAL.LOGIN_ID);
Line: 12944

		end if;         --End of update line
Line: 12966

	 begin  --Insert the line
	 --
	    for c_elemdist_seq_rec in c_elemdist_seq loop
	      l_distribution_id := c_elemdist_seq_rec.seq;
Line: 12972

	    PSB_ELEMENT_DISTRIBUTIONS_PVT.Insert_Row
	       (p_api_version => 1.0,
		p_return_status => l_return_status,
		p_msg_count => l_msg_count,
		p_msg_data => l_msg_data,
		p_distribution_id => l_distribution_id,
		p_position_set_group_id => p_new_psg_id,
		p_chart_of_accounts_id => c_elemdist_rec.chart_of_accounts_id,
		p_effective_start_date => c_elemdist_rec.effective_start_date,
		p_effective_end_date => c_elemdist_rec.effective_end_date,
		p_distribution_percent => c_elemdist_rec.distribution_percent,
		p_concatenated_segments => c_elemdist_rec.concatenated_segments,
		p_code_combination_id => c_elemdist_rec.code_combination_id,
		p_distribution_set_id => c_elemdist_rec.distribution_set_id,
		p_segment1 => c_elemdist_rec.segment1,
		p_segment2 => c_elemdist_rec.segment2,
		p_segment3 => c_elemdist_rec.segment3,
		p_segment4 => c_elemdist_rec.segment4,
		p_segment5 => c_elemdist_rec.segment5,
		p_segment6 => c_elemdist_rec.segment6,
		p_segment7 => c_elemdist_rec.segment7,
		p_segment8 => c_elemdist_rec.segment8,
		p_segment9 => c_elemdist_rec.segment9,
		p_segment10 => c_elemdist_rec.segment10,
		p_segment11 => c_elemdist_rec.segment11,
		p_segment12 => c_elemdist_rec.segment12,
		p_segment13 => c_elemdist_rec.segment13,
		p_segment14 => c_elemdist_rec.segment14,
		p_segment15 => c_elemdist_rec.segment15,
		p_segment16 => c_elemdist_rec.segment16,
		p_segment17 => c_elemdist_rec.segment17,
		p_segment18 => c_elemdist_rec.segment18,
		p_segment19 => c_elemdist_rec.segment19,
		p_segment20 => c_elemdist_rec.segment20,
		p_segment21 => c_elemdist_rec.segment21,
		p_segment22 => c_elemdist_rec.segment22,
		p_segment23 => c_elemdist_rec.segment23,
		p_segment24 => c_elemdist_rec.segment24,
		p_segment25 => c_elemdist_rec.segment25,
		p_segment26 => c_elemdist_rec.segment26,
		p_segment27 => c_elemdist_rec.segment27,
		p_segment28 => c_elemdist_rec.segment28,
		p_segment29 => c_elemdist_rec.segment29,
		p_segment30 => c_elemdist_rec.segment30,
		p_last_update_date => sysdate,
		p_last_updated_by => FND_GLOBAL.USER_ID,
		p_last_update_login => FND_GLOBAL.LOGIN_ID,
		p_created_by => FND_GLOBAL.USER_ID,
		p_creation_date => sysdate);
Line: 13025

	  end;          --End of Insert line where flex mapping doesn't exist
Line: 13027

	  begin         --Update the line
	  --
	    PSB_ELEMENT_DISTRIBUTIONS_PVT.Update_Row
	       (p_api_version => 1.0,
		p_return_status => l_return_status,
		p_msg_count => l_msg_count,
		p_msg_data => l_msg_data,
		p_distribution_id => l_distribution_id,
		p_position_set_group_id => p_new_psg_id,
		p_chart_of_accounts_id => c_elemdist_rec.chart_of_accounts_id,
		p_effective_start_date => c_elemdist_rec.effective_start_date,
		p_effective_end_date => c_elemdist_rec.effective_end_date,
		p_distribution_percent => c_elemdist_rec.distribution_percent,
		p_concatenated_segments => c_elemdist_rec.concatenated_segments,
		p_code_combination_id => c_elemdist_rec.code_combination_id,
		p_distribution_set_id => c_elemdist_rec.distribution_set_id,
		p_segment1 => c_elemdist_rec.segment1,
		p_segment2 => c_elemdist_rec.segment2,
		p_segment3 => c_elemdist_rec.segment3,
		p_segment4 => c_elemdist_rec.segment4,
		p_segment5 => c_elemdist_rec.segment5,
		p_segment6 => c_elemdist_rec.segment6,
		p_segment7 => c_elemdist_rec.segment7,
		p_segment8 => c_elemdist_rec.segment8,
		p_segment9 => c_elemdist_rec.segment9,
		p_segment10 => c_elemdist_rec.segment10,
		p_segment11 => c_elemdist_rec.segment11,
		p_segment12 => c_elemdist_rec.segment12,
		p_segment13 => c_elemdist_rec.segment13,
		p_segment14 => c_elemdist_rec.segment14,
		p_segment15 => c_elemdist_rec.segment15,
		p_segment16 => c_elemdist_rec.segment16,
		p_segment17 => c_elemdist_rec.segment17,
		p_segment18 => c_elemdist_rec.segment18,
		p_segment19 => c_elemdist_rec.segment19,
		p_segment20 => c_elemdist_rec.segment20,
		p_segment21 => c_elemdist_rec.segment21,
		p_segment22 => c_elemdist_rec.segment22,
		p_segment23 => c_elemdist_rec.segment23,
		p_segment24 => c_elemdist_rec.segment24,
		p_segment25 => c_elemdist_rec.segment25,
		p_segment26 => c_elemdist_rec.segment26,
		p_segment27 => c_elemdist_rec.segment27,
		p_segment28 => c_elemdist_rec.segment28,
		p_segment29 => c_elemdist_rec.segment29,
		p_segment30 => c_elemdist_rec.segment30,
		p_last_update_date => sysdate,
		p_last_updated_by => FND_GLOBAL.USER_ID,
		p_last_update_login => FND_GLOBAL.LOGIN_ID);
Line: 13081

	  end if;       --End of Insert line where flex mapping doesn't exist