Friday, October 25, 2013

Commonly used Unix scripts in Oracle apps

Send Email with attachment in Unix script

#====================================================== =====
#Email Body
#====================================================== =====
MESSAGE="Hi,

This is the message body

Thanks
Naren
"

echo ======================================================= ========
echo "Emailing output files to $email_id"
echo ======================================================= ========

(echo "$MESSAGE"; uuencode $output.txt)| mail -s "Test Email subject : $today_date" $email_id

#====================================================== =====


Connect to Oracle and execute select statement from UNIX

ORACLE_PW=`echo "$1"`

OUTFILE_PATH=`$ORACLE_HOME/bin/sqlplus -s ${ORACLE_PW} << GET_OUTFILE
SET PAGESIZE 0
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET ECHO OFF
select outfile_name
from fnd_concurrent_requests
where request_id = ${REQ_ID}
AND requested_by = ${USER_ID};
exit;

GET_OUTFILE`

2nd method 
FCP_LOGIN=`echo $1 | awk '{print $3}'|sed  "s/FCP_LOGIN=\"//; s/\"//"`
get_path() {
      path=`echo "$FCP_LOGIN
            set pagesize 0
            select directory_path
            from all_directories where directory_name ='Test_OUTBOUND';
            exit;"|sqlplus -s`
      if [ $? -ne 0 ]
      then
         echo "Unable to find the Directory Path"
         return 1
     fi
    return 1
    }
get_path
    echo 'Path   ' $path

Find  files from  unix prompt
  find . -name "*.txt" -print

Find the word in  all UNIX files under a directory 

 In below example search for word 'POSPAY_FTP' in all files under a directory

grep -r 'POSPAY_FTP' *
in short grep -r 'string1' directory path


 Check for  directory existence and is writable.

Example 
OUT_DIR=$XXP_TOP/data/outbound
if [ ! -d ${OUT_DIR} -o ! -w ${OUT_DIR} ]
then
   echo "================================================================="
   echo " ERROR: Directory ${OUT_DIR} does not exist or is not writeable"
   echo "======================================================================"
   exit 20
fi

-----------------------------------------------------------


Find Command in Unix and Linux Examples

Find is one of the powerful utility of Unix (or Linux) used for searching the files in a directory hierarchy. The syntax of find command is

find [pathnames] [conditions]

Let see some practical exercises on using find command.

1. How to run the last executed find command?

!find

This will execute the last find command. It also displays the last find command executed along with the result on the terminal.

2. How to find for a file using name?

find -name "sum.java"
./bkp/sum.java
./sum.java

This will find all the files with name "sum.java" in the current directory and sub-directories.

3. How to find for files using name and ignoring case?

find -iname "sum.java"
./SUM.java
./bkp/sum.java
./sum.java

This will find all the files with name "sum.java" while ignoring the case in the current directory and sub-directories.

4. How to find for a file in the current directory only?

find -maxdepth 1 -name "sum.java"
./sum.java

This will find for the file "sum.java" in the current directory only

5. How to find for files containing a specific word in its name?

find -name "*java*"
./SUM.java
./bkp/sum.java
./sum.java
./multiply.java

It displayed all the files which have the word "java" in the filename

6. How to find for files in a specific directory?

find /etc -name "*java*"

This will look for the files in the /etc directory with "java" in the filename

7. How to find the files whose name are not "sum.java"?

find -not -name "sum.java"
.
./SUM.java
./bkp
./multiply.java

This is like inverting the match. It prints all the files except the given file "sum.java".

8. How to limit the file searches to specific directories?

find -name "sum.java"
./tmp/sum.java
./bkp/var/tmp/files/sum.java
./bkp/var/tmp/sum.java
./bkp/var/sum.java
./bkp/sum.java
./sum.java

You can see here the find command displayed all the files with name "sum.java" in the current directory and sub-directories.

a. How to print the files in the current directory and one level down to the current directory?

find -maxdepth 2 -name "sum.java"
./tmp/sum.java
./bkp/sum.java
./sum.java

b. How to print the files in the current directory and two levels down to the current directory?

find -maxdepth 3 -name "sum.java"
./tmp/sum.java
./bkp/var/sum.java
./bkp/sum.java
./sum.java

c. How to print the files in the subdirectories between level 1 and 4?

find -mindepth 2 -maxdepth 5 -name "sum.java"
./tmp/sum.java
./bkp/var/tmp/files/sum.java
./bkp/var/tmp/sum.java
./bkp/var/sum.java
./bkp/sum.java

9. How to find the empty files in a directory?

find . -maxdepth 1 -empty
./empty_file

10. How to find the largest file in the current directory and sub directories

find . -type f -exec ls -s {} \; | sort -n -r | head -1

The find command "find . -type f -exec ls -s {} \;" will list all the files along with the size of the file. Then the sort command will sort the files based on the size. The head command will pick only the first line from the output of sort.

11. How to find the smallest file in the current directory and sub directories

find . -type f -exec ls -s {} \; | sort -n -r | tail -1

Another method using find is

find . -type f -exec ls -s {} \; | sort -n  | head -1

12. How to find files based on the file type?

a. Finding socket files

find . -type s

b. Finding directories

find . -type d

c. Finding hidden directories

find -type d -name ".*"

d. Finding regular files

find . -type f

e. Finding hidden files

find . -type f -name ".*"

13. How to find files based on the size?

a. Finding files whose size is exactly 10M

find . -size 10M

b. Finding files larger than 10M size

find . -size +10M

c. Finding files smaller than 10M size

find . -size -10M

14. How to find the files which are modified after the modification of a give file.

find -newer "sum.java"

This will display all the files which are modified after the file "sum.java"

15. Display the files which are accessed after the modification of a give file.

find -anewer "sum.java"

16. Display the files which are changed after the modification of a give file.

find -cnewer "sum.java"

17. How to find the files based on the file permissions?

find . -perm 777

This will display the files which have read, write, and execute permissions. To know the permissions of files and directories use the command "ls -l".

18. Find the files which are modified within 30 minutes.

find . -mmin -30

19. Find the files which are modified within 1 day.

find . -mtime -1

20. How to find the files which are modified 30 minutes back

find . -not -mmin -30

21. How to find the files which are modified 1 day back.

find . -not -mtime -1

22. Print the files which are accessed within 1 hour.

find . -amin -60

23. Print the files which are accessed within 1 day.

find . -atime -1

24. Display the files which are changed within 2 hours.

find . -cmin -120

25. Display the files which are changed within 2 days.

find . -ctime -2

26. How to find the files which are created between two files.

find . -cnewer f1 -and ! -cnewer f2

So far we have just find the files and displayed on the terminal. Now we will see how to perform some operations on the files.

1. How to find the permissions of the files which contain the name "java"?

find -name "*java*"|xargs ls -l

Alternate method is

find -name "*java*" -exec ls -l {} \;

2. Find the files which have the name "java" in it and then display only the files which have "class" word in them?

find -name "*java*" -exec grep -H class {} \;

3. How to remove files which contain the name "java".

find -name "*java*" -exec rm -r {} \;

This will delete all the files which have the word “java" in the file name in the current directory and sub-directories.

Thursday, October 17, 2013

Oracle Application API's

Oracle AOL 

FND_PROGRAM.EXECUTABLE

FND_PROGRAM.DELETE_EXECUTABLE


FND_PROGRAM.REGISTER


FND_PROGRAM.DELETE_PROGRAM


FND_PROGRAM.PARAMETER


FND_PROGRAM.DELETE_PARAMETER


FND_PROGRAM.INCOMPATIBILITY


FND_PROGRAM.DELETE_INCOMPATIBILITY


FND_PROGRAM.REQUEST_GROUP


FND_PROGRAM.DELETE_GROUP


FND_PROGRAM.ADD_TO_GROUP


FND_PROGRAM.REMOVE_FROM_GROUP


FND_REQUEST.SUBMIT_REQUEST


FND_CONCURRENT.WAIT_FOR_REQUEST


FND_REQUEST.SET_PRINT_OPTIONS


FND_GLOBAL.USER_IDFND_GLOBAL.APPS_INITIALIZE(user_id in number,resp_id in

number,resp_appl_id in number);


FND_GLOBAL.LOGIN_ID


FND_GLOBAL.CONC_LOGIN_ID


FND_GLOBAL.PROG_APPL_ID


FND_GLOBAL.CONC_PROGRAM_ID


FND_GLOBAL.CONC_REQUEST_ID


FND_PROFILE.PUT(name,value)


FND_PROFILE.GET(name IN varchar2,value out varchar2)


FND_USER_PKG.CREATEUSER 


FND_USER_PKG.UPDATEUSER

FND_USER_PKG.ADDRESP

FND_USER_PKG.DELRESP


PO


PO_CUSTOM_PRICE_PUB

PO_DOCUMENT_CONTROL_PUB

PO_DOC_MANAGER_PUB

PO_WFDS_PUB

AP


POS_VENDOR_PUB_PKG.CREATE_VENDOR

AP_NOTES_PUB

AP_WEB_AUDIT_LIST_PUB


HRMS



HR_EMPLOYEE_API.CREATE_EMPLOYEE

HR_PERSON_API.UPDATE_PERSON

HR_CONTACT_REL_API.CREATE_CONTACT

HR_EMPLOYEE_API.HIRE_INTO_JOB

HR_PERSON_ADDRESS_API.CREATE_PERSON_ADDRESS

HR_PERSON_ADDRESS_API.UPDATE_PERSON_ADDRESS

PAY_ELEMENT_ENTRY_API.DELETE_ELEMENT_ENTRY

HR_EMPLOYEE_API.RE_HIRE_EX_EMPLOYEE

HR_PERSONAL_PAY_METHOD_API.CREATE_PERSONAL_PAY_METHOD

HR_PHONE_API.CREATE_OR_UPDATE_PHONE

HR_MAINTAIN_PROPOSAL_API.CRE_OR_UPD_SALARY_PROPOSAL

PAY_FEDERAL_TAX_RULE_API.UPDATE_FED_TAX_RULE

PAY_STATE_TAX_RULE_API.CREATE_STATE_TAX_RULE

PAY_STATE_TAX_RULE_API.UPDATE_STATE_TAX_RULE

HR_ASSIGNMENT_API.UPDATE_EMP_ASG

HR_ASSIGNMENT_API.UPDATE_EMP_ASG_CRITERIA



HR_APPLICANT_API 
HR_APPLICATION_API 

HR_ASSIGNMENT_API 
HR_CONTACT_REL_API
HR_CONTRACT_API
HR_EMPLOYEE_API 
HR_EX_EMPLOYEE_API 
HR_GRADE_RATE_VALUE_API 
HR_ORGANIZATION_API 
HR_MAINTAIN_PROPOSAL_API
HR_PERSON_API 
HR_POSITION_API 
HR_SIT_API 
HR_USER_ACCT_API 
HR_UPLOAD_PROPOSAL_API 
 PER_QUALIFICATIONS_API 
hr_maintain_proposal_api.insert_salary_proposal

DECLARE
l_pay_proposal_id              number;
l_element_entry_id             number;
l_inv_next_sal_date_warning    boolean;
l_proposed_salary_warning      boolean;
l_approved_warning             boolean;
l_payroll_warning              boolean;
l_object_version_number        number;

BEGIN

hr_maintain_proposal_api.insert_salary_proposal
(p_pay_proposal_id        =>l_pay_proposal_id
,p_assignment_id        => 5093    -- *** Enter your assignment_id here
,p_business_group_id        => 1496    -- *** Enter your business_group_id here
,p_change_date            => to_date('01-APR-2001','DD-MON-YYYY')
,p_proposal_reason        => 'NEWH'  -- *** Enter your own reason here   
,p_proposed_salary_n        => 17500
,p_object_version_number    => l_object_version_number
,p_multiple_components        => 'N'
,p_approved            => 'Y'
,p_validate            => FALSE
,p_element_entry_id        => l_element_entry_id
,p_inv_next_sal_date_warning    => l_inv_next_sal_date_warning
,p_proposed_salary_warning    => l_proposed_salary_warning
,p_approved_warning        => l_approved_warning
,p_payroll_warning        => l_payroll_warning);

END;
/

-- Go to API List
hr_position_api.delete_position

set serveroutput on;

declare

l_true                    boolean     :=false;
l_POSITION_ID             NUMBER        := 75502;
l_DATE                       DATE        := to_date('01-feb-2013', 'DD-MON-YYYY');
l_obj                   NUMBER;
l_datetrack_mode        varchar(30)  := 'ZAP';
l_date1      Date;
l_date2      Date;

cursor csr_ovn is
       select max(object_version_number)
       from hr_All_positions_f where position_id=l_POSITION_ID;
begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

            hr_position_api.delete_position
            (
              p_validate                 => l_true 
             ,p_position_id              => l_POSITION_ID
             ,p_object_version_number     => l_obj
             ,p_datetrack_mode             => l_datetrack_mode
             ,p_effective_date          => l_date
             ,p_security_profile_id      => 42
             ,p_effective_start_date           => l_date1
             ,p_effective_end_date             => l_date2
            );
end;
/


-- Go to API List
per_qualifications_api.update_qualification

set serveroutput on;
declare
l_date                            date          := to_date('27-JAN-2012', 'DD-MON-YYYY');
l_true                            boolean     := false;
l_QUALIFICATION_ID                 number      := 56905;
l_obj                              NUMBER;
l_title        varchar2(100)        := 'UPDATED_API' ;

cursor csr_ovn is
       select max(object_version_number)
       from per_qualifications where person_id=32063;
begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

per_qualifications_api.UPDATE_QUALIFICATION(
        p_effective_date        =>    l_date
       ,p_qualification_id        =>  l_QUALIFICATION_ID
       ,p_title                    =>  l_title
       ,p_object_version_number    =>  l_obj
);
end;
/

-- Go to API List
hr_contract_api.create_contract

set serveroutput on;
Declare

 /* Out variables */
   p_validate                       boolean    default false;
   p_contract_id                    number;
   p_effective_start_date           date;
   p_effective_end_date             date;
   p_object_version_number          number;
   l_date                            date := to_date('01-JAN-2013','DD-MON-YYYY');
   /* In variables*/
 
   p_person_id                      number;
   p_reference                      varchar2(240);
   p_type                           varchar2(240);
   p_status                         varchar2(240);
   p_effective_date                 date;

BEGIN

hr_contract_api.create_contract (
p_validate                        => false
,p_contract_id                    => p_contract_id
,p_effective_start_date           => p_effective_start_date
,p_effective_end_date             => p_effective_end_date
,p_object_version_number          => p_object_version_number
,p_person_id                      => 18689
,p_reference                      => 9874  -- Random number
,p_type                           => 'UNSPECIFIED_PERIOD'  -- defined by the CONTRACT_TYPE lookup type.
,p_status                         => 'A-ACTIVE'   -- defined by the CONTRACT_STATUS lookup type.
,p_effective_date                 => l_date
);
END;
/

-- Go to API List
hr_ex_employee_api.actual_termination_emp

set serveroutput on;

declare

    l_period_of_service_id         number := 3123;
    l_date                date   := to_date('01-AUG-2000', 'DD-MON-YYYY');
    l_true                    boolean  := false;
    l_leaving_reason        varchar2(2000) := 'QPJ';
    l_term_date            date   := to_date('31-AUG-2000', 'DD-MON-YYYY');
    l_lsp_date            date   := to_date('31-AUG-2000', 'DD-MON-YYYY');
    l_batch_id            number := 103;
    l_fp_date            date   := to_date('31-AUG-2000', 'DD-MON-YYYY');
    l_obj                number;
    l_actual_termination_date    date := to_date('31-AUG-2000', 'DD-MON-YYYY');
    l_SUPERVISOR_WARNING           BOOLEAN;              
    l_EVENT_WARNING                BOOLEAN;               
    l_INTERVIEW_WARNING            BOOLEAN;             
    l_REVIEW_WARNING               BOOLEAN;             
    l_RECRUITER_WARNING            BOOLEAN;            
    l_ASG_FUTURE_CHANGES_WARNING   BOOLEAN;          
    l_ENTRIES_CHANGED_WARNING      VARCHAR2(30);           
    l_PAY_PROPOSAL_WARNING         BOOLEAN;       

cursor csr_ovn is
       select max(object_version_number)
       from per_periods_of_Service where period_of_service_id=3123;

begin

open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

  --  execute API to insert leave date
      
    hr_ex_employee_api.actual_termination_emp
    (
    p_validate                =>  l_true
       ,p_effective_date        =>  l_date
       ,p_period_of_service_id    =>  l_period_of_service_id
       ,p_object_version_number   =>  l_obj
       ,p_leaving_reason          =>  l_leaving_reason
       ,p_actual_termination_date => l_actual_termination_date
    ,p_SUPERVISOR_WARNING     =>    l_SUPERVISOR_WARNING              
    ,p_EVENT_WARNING          =>    l_EVENT_WARNING                  
    ,p_INTERVIEW_WARNING      =>    l_INTERVIEW_WARNING               
    ,p_REVIEW_WARNING         =>     l_REVIEW_WARNING               
    ,p_RECRUITER_WARNING      =>    l_RECRUITER_WARNING            
    ,p_ASG_FUTURE_CHANGES_WARNING =>  l_ASG_FUTURE_CHANGES_WARNING          
    ,p_ENTRIES_CHANGED_WARNING    =>  l_ENTRIES_CHANGED_WARNING           
    ,p_PAY_PROPOSAL_WARNING       =>  l_PAY_PROPOSAL_WARNING   
    );
end;
/

-- Go to API List
hr_person_absence_api.create_person_absence

set serveroutput on;

DECLARE
l_absence_days            Number :=2;
l_absence_hours            Number;
l_absence_attendance_id        Number;                                                 
l_object_version_number        Number;                                                  
l_occurance            Number;                                                  
l_dur_dys_less_warning        boolean;                                                 
l_dur_hrs_less_warning        boolean;                                                 
l_exceeds_pto_entit_warning    boolean;                                                 
l_exceeds_run_total_warning    boolean;                                                 
l_abs_overlap_warning        boolean;                                                 
l_abs_day_after_warning        boolean;                                                 
l_dur_overwritten_warning    boolean;
BEGIN
HR_PERSON_ABSENCE_API.create_person_absence                                                                   
  (p_validate                => FALSE                                  
  ,p_effective_date            => to_date('01-APR-2002','DD-MON-YYYY')                                                    
  ,p_person_id                => 2831                                             
  ,p_business_group_id            => 1379                                               
  ,p_absence_attendance_type_id        => 272                                                
  ,p_abs_attendance_reason_id        => 443                                                                    
  ,p_date_start                => to_date('01-APR-2002','DD-MON-YYYY')                                                                     
  ,p_date_end                => to_date('02-APR-2002','DD-MON-YYYY')                                                                    
  ,p_absence_days            => l_absence_days                                                 
  ,p_absence_hours            => l_absence_hours                                                                                    
  ,p_absence_attendance_id        => l_absence_attendance_id                                                 
  ,p_object_version_number        => l_object_version_number                                                   
  ,p_occurrence             => l_occurance                                                  
  ,p_dur_dys_less_warning        => l_dur_dys_less_warning                                                
  ,p_dur_hrs_less_warning        => l_dur_hrs_less_warning                                                
  ,p_exceeds_pto_entit_warning        => l_exceeds_pto_entit_warning                                                 
  ,p_exceeds_run_total_warning        => l_exceeds_run_total_warning                                                 
  ,p_abs_overlap_warning        => l_abs_overlap_warning                                                 
  ,p_abs_day_after_warning        => l_abs_day_after_warning    
  ,p_dur_overwritten_warning        => l_dur_overwritten_warning                                                
  );                                                                                              
END;
/

-- Go to API List
hr_contact_rel_api.create_contact

set serveroutput on;

DECLARE
l_validate_mode          BOOLEAN := FALSE;
l_datetrack_update_mode  VARCHAR2(30);
l_row_id                 ROWID;
l_business_group_id     NUMBER;
l_contact_type         VARCHAR2(30);
l_contact_title             VARCHAR2(30);
l_primary_flag             VARCHAR2(30);
l_attribute16             VARCHAR2(150);
l_contact_full_name             VARCHAR2(240);
l_person_type_id        NUMBER;
l_sex                VARCHAR2(30);
l_per_start_date    DATE;
l_per_end_date        DATE;
l_per_comment_id    NUMBER;
l_name_comb_warning    BOOLEAN;
l_contact_relationship_id NUMBER;
l_contact_rel_ovn NUMBER;
l_contact_person_id NUMBER;
l_contact_person_ovn NUMBER;
l_errors VARCHAR2(100);
L_ORIG_HIRE_WARNING boolean;
BEGIN
HR_CONTACT_REL_API.CREATE_CONTACT
( P_VALIDATE                 =>    FALSE
, P_DATE_START              =>  '04-AUG-1999'
, P_START_DATE                  =>    '04-AUG-1999'
, P_BUSINESS_GROUP_ID         =>    626
, P_PERSON_ID                 =>    367
-- , P_CONTACT_PERSON_ID         =>    NULL
, P_CONTACT_TYPE              =>     'F'
, P_PRIMARY_CONTACT_FLAG     =>    'N'
, P_CONT_ATTRIBUTE16        =>    NULL
, P_LAST_NAME                 =>    'BLOGGY1'
, P_SEX                      =>    'M'
, P_PERSON_TYPE_ID        =>    101
, P_DATE_OF_BIRTH             =>    '12-SEP-1977'
, P_FIRST_NAME                 =>    'FRED'
--, P_TITLE                  =>    l_contact_title
, P_CONTACT_RELATIONSHIP_ID     =>    l_contact_relationship_id
, P_CTR_OBJECT_VERSION_NUMBER     =>     l_contact_rel_ovn
, P_PER_PERSON_ID        =>    l_contact_person_id
, P_PER_OBJECT_VERSION_NUMBER     =>     l_contact_person_ovn
, P_PER_EFFECTIVE_START_DATE     =>    l_per_start_date
, P_PER_EFFECTIVE_END_DATE       =>     l_per_end_date
, P_FULL_NAME            =>    l_contact_full_name
, P_PER_COMMENT_ID        =>    l_per_comment_id
, P_NAME_COMBINATION_WARNING    =>    l_name_comb_warning
, P_ORIG_HIRE_WARNING    => L_ORIG_HIRE_WARNING
);
END;
/


-- Go to API
List
hr_applicant_api.create_gb_applicant

set serverout on;
declare
    l_person_id            per_people_f.person_id%TYPE;
    l_assignment_id            per_assignments_f.assignment_id%TYPE;
    l_per_object_version_number    per_people_f.object_version_number%TYPE;
    l_asg_object_version_number    per_people_f.object_version_number%TYPE;
    l_apl_object_version_number    per_applications.object_version_number%TYPE;
    l_per_effective_start_date    per_people_v.effective_start_date%TYPE;
    l_per_effective_end_date    per_people_v.effective_end_date%TYPE;
    l_full_name            per_people_f.full_name%TYPE;
    l_per_comment_id        per_people_f.comment_id%TYPE;
    l_application_id        per_applications.application_id%TYPE;
    l_assignment_sequence        per_people_assignments_view.assignment_sequence%TYPE;
    l_applicant_number        per_people_f.applicant_number%TYPE;
    l_name_combination_warning    boolean;
    l_assign_payroll_warning    boolean;
    l_orig_hire_warning        boolean;
begin
hr_applicant_api.create_gb_applicant
(
P_VALIDATE               =>     FALSE
,P_DATE_RECEIVED        =>    to_date('31-DEC-1999','DD-MON-YYYY')
,P_DATE_OF_BIRTH        =>    to_date('01-OCT-1985','DD-MON-YYYY')
,P_BUSINESS_GROUP_ID        =>    1379  
,P_LAST_NAME                    =>    'VF-TEST3' 
,P_APPLICANT_NUMBER             =>    l_applicant_number
,P_PERSON_ID                    =>    L_PERSON_ID 
,P_ASSIGNMENT_ID                =>    L_ASSIGNMENT_ID 
,P_APPLICATION_ID               =>    l_application_id 
,P_PER_OBJECT_VERSION_NUMBER    =>    L_PER_OBJECT_VERSION_NUMBER 
,P_ASG_OBJECT_VERSION_NUMBER    =>    L_ASG_OBJECT_VERSION_NUMBER 
,P_APL_OBJECT_VERSION_NUMBER    =>    L_APL_OBJECT_VERSION_NUMBER 
,P_PER_EFFECTIVE_START_DATE     =>    L_PER_EFFECTIVE_START_DATE 
,P_PER_EFFECTIVE_END_DATE       =>    L_PER_EFFECTIVE_END_DATE 
,P_FULL_NAME                    =>    L_FULL_NAME 
,P_PER_COMMENT_ID               =>    L_PER_COMMENT_ID 
,P_ASSIGNMENT_SEQUENCE          =>    L_ASSIGNMENT_SEQUENCE 
,P_NAME_COMBINATION_WARNING     =>    L_NAME_COMBINATION_WARNING 
,P_ORIG_HIRE_WARNING            =>    L_ORIG_HIRE_WARNING
);
end;
/


-- Go to API List
hr_employee_api.create_gb_employee

set serverout on;
declare
    l_employee_number        per_people_f.employee_number%TYPE;
    l_person_id            per_people_f.person_id%TYPE;
    l_assignment_id            per_assignments_f.assignment_id%TYPE;
    l_per_object_version_number    per_people_f.object_version_number%TYPE;
    l_asg_object_version_number    per_people_f.object_version_number%TYPE;
    l_per_effective_start_date    per_people_v.effective_start_date%TYPE;
    l_per_effective_end_date    per_people_v.effective_end_date%TYPE;
    l_full_name            per_people_f.full_name%TYPE;
    l_per_comment_id        per_people_f.comment_id%TYPE;
    l_assignment_sequence        per_people_assignments_view.assignment_sequence%TYPE;
    l_assignment_number        per_people_assignments_view.assignment_number%TYPE;
    l_name_combination_warning    boolean;
    l_assign_payroll_warning    boolean;
  
begin
    hr_employee_api.create_gb_employee
    (
    p_validate        =>    FALSE
    ,p_hire_date        =>    to_date('01-Jul-2000','DD-MON-YYYY')
    ,p_business_group_id    =>    1021
    ,p_first_name        =>    'FONGY'
    ,p_last_name        =>    'FONGY'
    ,p_sex            =>    'M'
    ,p_ni_number        =>    'WP934486A'
    ,p_employee_number    =>    l_employee_number
    ,p_person_id        =>    l_person_id
    ,p_assignment_id    =>    l_assignment_id
    ,p_per_object_version_number    =>    l_per_object_version_number  
    ,p_asg_object_version_number    =>    l_asg_object_version_number
    ,p_per_effective_start_date    =>    l_per_effective_start_date
    ,p_per_effective_end_date    =>    l_per_effective_end_date
    ,p_full_name            =>    l_full_name
    ,p_per_comment_id        =>    l_per_comment_id
    ,p_assignment_sequence        =>    l_assignment_sequence
    ,p_assignment_number        =>    l_assignment_number
    ,p_name_combination_warning    =>    l_name_combination_warning
    ,p_assign_payroll_warning    =>    l_assign_payroll_warning
    );
    dbms_output.put_line ('Person ID: ' || to_char(l_person_id));
end;
/


-- Go to API List
hr_organization_api.create_organization

set serveroutput on;

declare
l_date                    date           := to_date('01-jan-2000','DD-MON-YYYY');
l_true                    boolean     := false;
l_business_group_id        number        := 626;
l_language_code            varchar2(10)    := 'US';
l_name                    varchar2(80)    := 'NJ TEST ORG';
l_internal_external_flag    varchar2(80)    := 'INT';
l_organization_id         number;
l_object_version_number        number;
l_duplicate_org_warning        boolean;

begin
hr_organization_api.create_organization
   (  p_validate                      =>     l_true
     ,p_effective_date                =>    l_date
     ,p_language_code                 =>    l_language_code
     ,p_business_group_id             =>    l_business_group_id
     ,p_date_from                     =>    l_date
     ,p_name                          =>    l_name
     ,p_internal_external_flag        =>    l_internal_external_flag
     ,p_organization_id               =>    l_organization_id
     ,p_object_version_number         =>    l_object_version_number
     ,P_duplicate_org_warning          =>    l_duplicate_org_warning
);
end;
/


-- Go to API List
hr_position_api.create_position

set serveroutput on;

declare

l_true                    boolean     :=false;
l_obj                      NUMBER;
l_JOB_ID                        NUMBER        :=614;
l_ORGANIZATION_ID                  NUMBER        :=1379;
l_DATE_EFFECTIVE                DATE        := to_date('01-DEC-2000', 'DD-MON-YYYY');
l_POSITION_ID                   NUMBER;
l_POSITION_DEFINITION_ID        NUMBER;
l_NAME                          VARCHAR2(30);
l_segment1            VARCHAR(30)    :='NJ TEST POSITION';
l_segment2            VARCHAR2(30)    :='10';

begin


hr_position_api.create_position
(
        p_validate              =>    l_true
,       p_object_version_number        =>    l_obj
,    p_JOB_ID            =>    l_JOB_ID
,    p_ORGANIZATION_ID         =>    l_ORGANIZATION_ID
,    p_DATE_EFFECTIVE        =>    l_DATE_EFFECTIVE
,    p_POSITION_ID            =>    l_POSITION_ID
,     p_POSITION_DEFINITION_ID    =>    l_POSITION_DEFINITION_ID
,     p_NAME                 =>    l_NAME
,    p_segment1            =>    l_segment1
,    p_segment2            =>    l_segment2
,    p_location_id            =>    2694
);
end;
/

-- Go to API List
hr_assignment_api.create_secondary_emp_asg

set serveroutput on;

declare
l_date                        date := to_date('01-MAR-2012','DD-MON-YYYY');
l_assignment_number         varchar2(30);
l_group_name                 varchar2(100);
l_concatenated_segments        varchar2(100);
l_cagr_grade_def_id         number;
l_cagr_concatenated_segments varchar2(100);
l_assignment_id                number;
l_soft_coding_keyflex_id    number;
l_effective_end_date        date;
l_assignment_sequence        number;
l_comment_id                number;
l_other_manager_warning        boolean;
l_hourly_salaried_warning    boolean;
l_gsp_post_process_warning    varchar2(100);
l_people_group_id             number := 169;
l_ovn                        number;
l_person_id                    number    := 367;
l_organization_id            number     :=    647;
l_payroll_id                number    := 112;
l_location_id                 number := 431;

begin
hr_assignment_api.create_secondary_emp_asg
                (p_validate                        => FALSE,
                 p_effective_date                  => to_date('01-MAR-2012','DD-MON-YYYY'),
                 p_person_id                       => l_person_id,
                 p_organization_id                 => l_organization_id,
                 p_payroll_id                      => l_payroll_id,
                 p_location_id                     => l_location_id,
                 p_assignment_number               => l_assignment_number,
                 p_group_name                      => l_group_name,
                 p_concatenated_segments           => l_concatenated_segments,
                 p_cagr_grade_def_id               => l_cagr_grade_def_id,
                 p_cagr_concatenated_segments      => l_cagr_concatenated_segments,
                 p_assignment_id                   => l_assignment_id,
                 p_soft_coding_keyflex_id          => l_soft_coding_keyflex_id,
                 p_people_group_id                 => l_people_group_id,
                 p_object_version_number           => l_ovn,
                 p_effective_start_date            => l_date,
                 p_effective_end_date              => l_effective_end_date,
                 p_assignment_sequence             => l_assignment_sequence,
                 p_comment_id                      => l_comment_id,
                 p_other_manager_warning           => l_other_manager_warning,
                 p_hourly_salaried_warning         => l_hourly_salaried_warning,
                 p_gsp_post_process_warning        => l_gsp_post_process_warning
                );
end;
/
  

-- Go to API List
hr_sit_api.create_sit

declare
l_date                date           := to_date('02-DEC-2002', 'DD-MON-YYYY');
l_true                    boolean     := false;
l_person_id              number      := 2831;
l_obj                      NUMBER;
l_business_group_id        number        := 1379;
l_id_flex_num            number        := 51058;
l_analysis_criteria_id        number;
l_person_analysis_id        number;
l_p_segment1            varchar2(250)    := '30';
l_p_segment2            varchar2(250)    := '30';
l_p_segment3            varchar2(250)    := '10';
l_p_segment4            varchar2(250)    := '30-jan-2002';
cursor csr_ovn is
       select max(object_version_number)
       from per_people_f where person_id=l_person_id;
begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;
hr_sit_api.create_sit
(
        p_validate              =>    l_true
,       p_effective_date              =>    l_date
,       p_person_id                  =>    l_person_id
,       p_pea_object_version_number        =>    l_obj
,    p_business_group_id        =>    l_business_group_id
,    p_id_flex_num            =>    l_id_flex_num
,    p_analysis_criteria_id        =>    l_analysis_criteria_id
,    p_person_analysis_id        =>    l_person_analysis_id
,    p_segment1            =>    l_p_segment1
,    p_segment2            =>    l_p_segment2
,    p_segment3            =>    l_p_segment3
,    p_segment4            =>    l_p_segment4
);
end;
/

-- Go to API List
hr_user_acct_api.create_user_acct

set serveroutput on;

declare

    l_business_group_id         number := 1379;
    l_user_id            number := 123456;
    l_true                    boolean  := false;
    l_per_effective_start_date    date   := to_date('26-JUL-2001', 'DD-MON-YYYY');
    l_per_effective_end_date    date   := to_date('31-DEC-4712', 'DD-MON-YYYY');
        l_assignment_id            number := 3976;
    l_asg_effective_start_date    date := to_date('26-JUL-2001', 'DD-MON-YYYY');
    l_asg_effective_end_date    date := to_date('31-DEC-4712', 'DD-MON-YYYY');
    l_date_from            date := to_date('26-JUL-2001', 'DD-MON-YYYY');
    l_date_to            date := to_date('31-DEC-4712', 'DD-MON-YYYY');
    l_hire_date            date := to_date('26-JUL-2001', 'DD-MON-YYYY');
    l_org_structure_id        number := 192;
    l_org_structure_version_id    number := 249;
    l_parent_org_id            number := 1;
    l_single_org_id            number := 1;
    l_run_type            varchar2(30) := 'Bum';

begin

     
    hr_user_acct_api.create_user_acct
    (
   p_validate                  =>  l_true 
  ,p_business_group_id         =>  l_business_group_id                       
  ,p_user_id                   =>  l_user_id
  ,p_per_effective_start_date  =>  l_per_effective_start_date
  ,p_per_effective_end_date    =>  l_per_effective_end_date
  ,p_assignment_id             =>  l_assignment_id
  ,p_asg_effective_start_date  =>  l_asg_effective_start_date
  ,p_asg_effective_end_date    =>  l_asg_effective_end_date
  ,p_date_from                   =>  l_date_from  
  ,p_date_to                   =>  l_date_to
  ,p_hire_date                 =>  l_hire_date
  ,p_org_structure_id           =>  l_org_structure_id  
  ,p_org_structure_version_id  =>  l_org_structure_version_id  
  ,p_parent_org_id           =>  l_parent_org_id  
  ,p_single_org_id             =>  l_single_org_id
  ,p_run_type                  =>  l_run_type
    );
end;
/


-- Go to API List
hr_assignment_api.delete_assignment

set serveroutput on;
declare
    v_date  date := to_date('21052012','ddmmyyyy');
    v_assignment_id number;
    v_person_id number;
    l_aantal number;
    l_effective_start_date       per_all_assignments_f.effective_start_date%TYPE;
    l_effective_end_date         per_all_assignments_f.effective_end_date%TYPE;
    l_loc_change_tax_inssues     boolean;
    l_delete_asg_budgets         boolean;
    l_org_now_no_manager_warning boolean;
    l_element_salary_warning     boolean;
    l_element_entries_warning    boolean;
    l_spp_warning                boolean;
    l_cost_warning               Boolean;
    l_life_events_exists         Boolean;
    l_cobra_coverage_elements    Boolean;
    l_assgt_term_elements        Boolean;
    l_object_version_number      number;
    l_fout                       varchar2(3);
    l_assignment_id              per_all_assignments_f.assignment_id%type;
    l_asg_obj_version_number     per_all_assignments_f.object_version_number%type;
    l_assignment_sequence        number;
    l_assignment_number          per_all_assignments_f.assignment_number%type;
    l_assign_payroll_warning     boolean;
    l_ontslag                    per_periods_of_service%rowtype;
    l_rowid                      varchar2(2000);
    l_dodwarning                 boolean;
    l_s_final_process_date       date;
    l_s_actual_termination_date  date;
    l_assignment_status_type_id  per_all_assignments_f.assignment_status_type_id%type;
    l_requery_required           varchar2(1);
    l_rowid                      rowid;
  cursor c_obj is
     select object_version_number
     from per_all_assignments_f paaf
     where paaf.person_id = v_person_id
      and  paaf.assignment_id = v_assignment_id
      and  v_date between paaf.effective_start_date and paaf.effective_end_date;

begin

        v_assignment_id := 35158;
        v_person_id     := 34634;
        open c_obj;
        fetch c_obj into  l_object_version_number;
        close c_obj;

        begin
            hr_assignment_api.delete_assignment
                       (p_validate                => FALSE
                                           ,p_effective_date          => v_date -1
                       ,p_datetrack_mode          => 'DELETE_NEXT_CHANGE'
                       ,p_assignment_id           => v_assignment_id
                       ,p_object_version_number   => l_object_version_number
                       ,p_effective_start_date    => l_effective_start_date
                       ,p_effective_end_date      => l_effective_end_date
                       ,p_loc_change_tax_issues   => l_loc_change_tax_inssues
                       ,p_delete_asg_budgets      => l_delete_asg_budgets
                       ,p_org_now_no_manager_warning  => l_org_now_no_manager_warning
                       ,p_element_salary_warning  => l_element_salary_warning
                       ,p_element_entries_warning  => l_element_entries_warning
                       ,p_spp_warning              => l_spp_warning
                       ,P_cost_warning             => l_cost_warning
                       ,p_life_events_exists        => l_life_events_exists
                       ,p_cobra_coverage_elements  => l_cobra_coverage_elements
                       ,p_assgt_term_elements      => l_assgt_term_elements);
--
         exception
         when others then
               dbms_output.put_line(substr(sqlerrm,1,200));
         end;


end;
/



-- Go to API List
hr_person_absence_api.update_person_absence


DECLARE
l_absence_days            Number :=3;
l_absence_hours            Number;
l_absence_attendance_id        Number :=194537;                                                 
l_obj                        Number;
l_dur_dys_less_warning        boolean;                                              
l_dur_hrs_less_warning        boolean;                                                 
l_exceeds_pto_entit_warning    boolean;                                                 
l_exceeds_run_total_warning    boolean;                                                 
l_abs_overlap_warning        boolean;                                                 
l_abs_day_after_warning        boolean;                                                 
l_dur_overwritten_warning    boolean;
l_del_element_entry_warning   boolean;
l_date_start     date :=to_date('01-sep-2011','DD-MON-YYYY');
l_date_end      date:=to_date('15-sep-2011','DD-MON-YYYY');

cursor csr_ovn is
       select max(object_version_number)
       from per_absence_attendances where absence_attendance_id=l_absence_attendance_id;
begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

        hr_person_absence_api.update_person_absence
             (p_validate                      =>    FALSE
             ,p_effective_date                =>   to_date('01-SEP-2011','DD-MON-YYYY')  
             ,p_absence_attendance_id          =>    l_absence_attendance_id
             ,p_abs_attendance_reason_id      =>    74                     -- the reason before was null - now changing to id 74 (COLD)
             ,p_absence_days                  =>   l_absence_days 
             ,p_absence_hours                 =>   l_absence_hours  
             ,p_object_version_number         =>   l_obj      
             ,p_dur_dys_less_warning          =>   l_dur_dys_less_warning 
             ,p_dur_hrs_less_warning          =>   l_dur_hrs_less_warning 
             ,p_exceeds_pto_entit_warning     =>   l_exceeds_pto_entit_warning
             ,p_exceeds_run_total_warning     =>   l_exceeds_run_total_warning
             ,p_abs_overlap_warning           =>   l_abs_overlap_warning 
             ,p_abs_day_after_warning         =>   l_abs_day_after_warning    
             ,p_dur_overwritten_warning       =>   l_dur_overwritten_warning
             ,p_del_element_entry_warning      =>   l_del_element_entry_warning 
           );
END;
/


-- Go to API List
hr_application_api.update_apl_details

set serveroutput on;

declare

l_true                    boolean     := false;
l_application_id          number      := 2592;
l_obj                      NUMBER;
l_person_id            number        :=7814;
l_attrib4            varchar2(30)    :='Applicant';


cursor csr_ovn is
       select max(object_version_number)
       from per_people_f where person_id=l_person_id;

begin

open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;


hr_application_api.update_apl_details
(
        p_validate              =>    l_true
,       p_application_id              =>    l_application_id
,       p_object_version_number        =>    l_obj
,    p_appl_attribute4        =>    l_attrib4
);
end;
/


-- Go to API List
hr_assignment_api.update_emp_asg_criteria

set serveroutput on;

declare
l_date                date   := to_date('01-OCT-2009', 'DD-MON-YYYY');
l_true                    boolean  := false;
l_assign_id              number  := 32923;
l_obj                      NUMBER;
l_datetrack_update_mode      VARCHAR2(30);
l_organization_id         number;
l_special_ceiling_step_id     number;
l_EFFECTIVE_START_DATE        DATE;
l_EFFECTIVE_END_DATE          DATE;
l_people_group_id             number;
l_group_name              varchar2(30);
l_org_now_no_manager_warning    BOOLEAN;
l_other_manager_warning        boolean;
l_spp_delete_warning        boolean;
l_entries_changed_warning    varchar2(30);
l_tax_district_changed_warning    boolean;


cursor csr_ovn is
       select max(object_version_number)
       from per_assignments_f where assignment_id=32923;

begin

open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

hr_assignment_api.update_emp_asg_criteria
(
  P_VALIDATE                     => l_true
 ,P_EFFECTIVE_DATE               => l_date
 ,P_DATETRACK_UPDATE_MODE        => 'CORRECTION'
 ,P_ASSIGNMENT_ID                => l_assign_id
 ,P_OBJECT_VERSION_NUMBER        => l_obj
-- ,p_organization_id           => 626
 ,p_special_ceiling_step_id       => l_special_ceiling_step_id
 ,P_effective_start_date       => l_effective_start_date
 ,p_effective_end_date           => l_effective_end_date
 ,p_people_group_id              => l_people_group_id
 ,p_group_name                   => l_group_name
 ,p_org_now_no_manager_warning   => l_org_now_no_manager_warning
 ,p_other_manager_warning        => l_other_manager_warning
 ,p_spp_delete_warning           => l_spp_delete_warning
 ,p_entries_changed_warning      => l_entries_changed_warning
 ,p_tax_district_changed_warning => l_tax_district_changed_warning
, p_segment11             => 'Abbott, Mr. John'
);
end;
/


-- Go to API List
hr_person_api.update_gb_person

set serveroutput on;

declare
l_date                date           := to_date('01-SEP-2002', 'DD-MON-YYYY');
l_true                    boolean     := false;
l_person_id              number      := 367
l_employee_number        varchar2(30)    := '4';
l_obj                      NUMBER;
l_attribute1        VARCHAR2(30)     := 'Yes';
l_comment_id            number;
l_datetrack_update_mode      VARCHAR2(30);
l_EFFECTIVE_START_DATE        DATE        := to_date('01-DEC-2002', 'DD-MON-YYYY');
l_EFFECTIVE_END_DATE          DATE;
l_name_combination_warning    BOOLEAN;
l_assign_payroll_warning    boolean;
l_full_name            VARCHAR2(30)    := '-Anthony--Ambrose';
l_orig_hire_warning        BOOLEAN;

cursor csr_ovn is
       select max(object_version_number)
       from per_people_f where person_id=l_person_id;

begin

open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;


hr_person_api.update_gb_person
(
        p_validate              =>    l_true
,       p_effective_date              =>    l_date
,       p_datetrack_update_mode        =>    'CORRECTION'
,       p_person_id                  =>    l_person_id
,       p_object_version_number        =>    l_obj
,       p_employee_number        =>    l_employee_number
,       p_attribute1            =>    l_attribute1
,    p_effective_start_date        =>    l_effective_start_date
,       p_effective_end_date        =>    l_effective_end_date
,       p_full_name            =>    l_full_name
,       p_comment_id            =>    l_comment_id
,       p_name_combination_warning    =>    l_name_combination_warning
,       p_assign_payroll_warning    =>    l_assign_payroll_warning
,    p_orig_hire_warning        => l_orig_hire_warning
);
end;
/

-- Go to API List
hr_sit_api.update_sit

set serveroutput on;

declare

l_date                date           := to_date('01-DEC-2000', 'DD-MON-YYYY');
l_true                    boolean     := false;
l_person_id              number      := 2831;
l_obj                      NUMBER;
l_business_group_id        number        := 1379;
l_id_flex_num            number        := 51058;
l_analysis_criteria_id        number        := 2029;
l_person_analysis_id        number        := 1735;



cursor csr_ovn is
       select max(object_version_number)
       from per_people_f where person_id=l_person_id;

begin

open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;


hr_sit_api.update_sit
(
        p_validate              =>    l_true
,       p_effective_date              =>    l_date
,       p_person_id                  =>    l_person_id
,       p_pea_object_version_number        =>    l_obj
,    p_business_group_id        =>    l_business_group_id
,    p_id_flex_num            =>    l_id_flex_num
,    p_analysis_criteria_id        =>    l_analysis_criteria_id
,    p_person_analysis_id        =>    l_person_analysis_id
,    p_analysis_criteria_id        =>    l_analysis_criteria_id
,    p_segment1            =>    '30'
,    p_segment2            =>    '40'
,    p_segment3            =>    '10'
,    p_segment4            =>    '21-JUL-2001'      

);

end;
/


-- Go to API List
hr_upload_proposal_api.upload_salary_proposal

set serveroutput on;

declare

L_VALIDATE                     BOOLEAN  := FALSE;
L_BUSINESS_GROUP_ID            NUMBER := 626;   
L_PROPOSAL_REASON              VARCHAR2(20) := 'COL';
L_PAY_PROPOSAL_ID              NUMBER := null;
L_OBJECT_VERSION_NUMBER        NUMBER := null;
L_COMPONENT_REASON             VARCHAR2(10) := null;
L_APPROVED_1                   VARCHAR2(10) := null;
L_COMPONENT_ID_1               NUMBER      := null;
L_PPC_OBJECT_VERSION_NUMBER_1  NUMBER       := null;
L_APPROVED_2                   VARCHAR2(10) := null;
L_COMPONENT_ID_2               NUMBER     := null;
L_PPC_OBJECT_VERSION_NUMBER_2  NUMBER      := null;
L_APPROVED_3                   VARCHAR2(10) := null;
L_COMPONENT_ID_3               NUMBER     := null;
L_PPC_OBJECT_VERSION_NUMBER_3  NUMBER     := null;
L_APPROVED_4                   VARCHAR2(10) := null;
L_COMPONENT_ID_4               NUMBER    := null;
L_PPC_OBJECT_VERSION_NUMBER_4  NUMBER   := null;
L_APPROVED_5                   VARCHAR2(10) := null;
L_COMPONENT_ID_5               NUMBER      := null;
L_PPC_OBJECT_VERSION_NUMBER_5  NUMBER      := null;
L_APPROVED_6                   VARCHAR2(10) := null;
L_COMPONENT_ID_6               NUMBER       := null;
L_PPC_OBJECT_VERSION_NUMBER_6  NUMBER       := null;
L_APPROVED_7                   VARCHAR2(10) := null;
L_COMPONENT_ID_7               NUMBER        := null;
L_PPC_OBJECT_VERSION_NUMBER_7  NUMBER        := null;
L_APPROVED_8                   VARCHAR2(10) := null;
L_COMPONENT_ID_8               NUMBER        := null;
L_PPC_OBJECT_VERSION_NUMBER_8  NUMBER         := null;
L_APPROVED_9                   VARCHAR2(10) := null;
L_COMPONENT_ID_9               NUMBER        := null;
L_PPC_OBJECT_VERSION_NUMBER_9  NUMBER         := null;
L_APPROVED_10                   VARCHAR2(10) := null;
L_COMPONENT_ID_10              NUMBER       := null;
L_PPC_OBJECT_VERSION_NUMBER_10 NUMBER        := null;
L_PYP_PROPOSED_SAL_WARNING     BOOLEAN       := FALSE;
l_ADDITIONAL_COMP_WARNING      BOOLEAN        := FALSE;

L_PERSON                       NUMBER       := 517;
L_ASSIGNMENT                   NUMBER       := 524;
L_START_DATE                   DATE         := NULL;
L_END_DATE                     DATE         := NULL;

L_MSG                          VARCHAR2(200) := NULL;
L_STATUS                       VARCHAR2(10) := 'VALID';
L_COUNTER                      NUMBER       := 0;

l_date             date    := to_date('01-Aug-2013', 'DD-MON-YYYY');
l_proposed_salary     VARCHAR2(30)    := '21000.00';

l_err_num                  NUMBER;
l_err_msg                  VARCHAR2(100);

begin
 hr_upload_proposal_api.upload_salary_proposal
 ( p_validate                    => FALSE
 , p_change_date                 => l_date
 , p_business_group_id           => l_business_group_id
 , p_assignment_id               => l_assignment
 , p_proposed_salary             => l_proposed_salary
 , p_proposal_reason             => l_proposal_reason
 , p_pay_proposal_id             => l_pay_proposal_id
 , p_object_version_number       => l_object_version_number
 , p_component_reason_1      => l_component_reason
 , p_approved_1           => l_approved_1
 , p_component_id_1          => l_component_id_1
 , p_ppc_object_version_number_1 => l_ppc_object_version_number_1
 , p_component_reason_2      => l_component_reason
 , p_approved_2           => l_approved_2
 , p_component_id_2          => l_component_id_2
 , p_ppc_object_version_number_2 => l_ppc_object_version_number_2
 , p_component_reason_3      => l_component_reason
 , p_approved_3           => l_approved_3
 , p_component_id_3          => l_component_id_3
 , p_ppc_object_version_number_3 => l_ppc_object_version_number_3
 , p_component_reason_4      => l_component_reason
 , p_approved_4           => l_approved_4
 , p_component_id_4          => l_component_id_4
 , p_ppc_object_version_number_4 => l_ppc_object_version_number_4
 , p_component_reason_5      => l_component_reason
 , p_approved_5           => l_approved_5
 , p_component_id_5          => l_component_id_5
 , p_ppc_object_version_number_5 => l_ppc_object_version_number_5
 , p_component_reason_6      => l_component_reason
 , p_approved_6           => l_approved_6
 , p_component_id_6          => l_component_id_6
 , p_ppc_object_version_number_6 => l_ppc_object_version_number_6
 , p_component_reason_7      => l_component_reason
 , p_approved_7           => l_approved_7
 , p_component_id_7          => l_component_id_7
 , p_ppc_object_version_number_7 => l_ppc_object_version_number_7
 , p_component_reason_8      => l_component_reason
 , p_approved_8           => l_approved_8
 , p_component_id_8          => l_component_id_8
 , p_ppc_object_version_number_8 => l_ppc_object_version_number_8
 , p_component_reason_9      => l_component_reason
 , p_approved_9           => l_approved_9
 , p_component_id_9          => l_component_id_9
 , p_ppc_object_version_number_9 => l_ppc_object_version_number_9
 , p_component_reason_10      => l_component_reason
 , p_approved_10           => l_approved_10
 , p_component_id_10          => l_component_id_10
 , p_ppc_object_version_number_10 => l_ppc_object_version_number_10
 , p_pyp_proposed_sal_warning      =>  l_pyp_proposed_sal_warning
 , p_additional_comp_warning       =>  l_additional_comp_warning
);
end;
/


-- Go to API List
hr_assignment_api.create_gb_secondary_emp_asg

DECLARE
   vv_group_name                   VARCHAR2(150);
   vn_people_group_id              NUMBER;
   vn_assignment_sequence          NUMBER;
   vn_comment_id                   NUMBER;
   vb_other_manager_warning        BOOLEAN;
   vb_hourly_salaried_warning      BOOLEAN;
   vn_cagr_grade_def_id            NUMBER;
   vv_cagr_concatenated_segments   VARCHAR2(150);
   vt_assignment_number            VARCHAR2(50);
   vt_assignment_id                NUMBER;
   vt_ass_object_version_number    NUMBER;
   vt_ass_eff_from_date            DATE;
   vt_ass_eff_to_date              DATE;
BEGIN
   vt_assignment_number := NULL;
   hr_assignment_api.create_gb_secondary_emp_asg(p_validate                    => FALSE,
                                                 p_effective_date              => TRUNC(SYSDATE),
                                                 p_person_id                   => 33255,
                                                 p_organization_id             => 8464,
                                                 --OPTIONAL
                                                 p_job_id                      => 52906,
                                                 p_location_id                 => 519,
                                                 --IN/OUT
                                                 p_assignment_number           => vt_assignment_number,
                                                 --OUT
                                                 p_group_name                  => vv_group_name,
                                                 p_assignment_id               => vt_assignment_id,
                                                 p_people_group_id             => vn_people_group_id,
                                                 p_object_version_number       => vt_ass_object_version_number,
                                                 p_effective_start_date        => vt_ass_eff_from_date,
                                                 p_effective_end_date          => vt_ass_eff_to_date,
                                                 p_assignment_sequence         => vn_assignment_sequence,
                                                 p_comment_id                  => vn_comment_id,
                                                 p_other_manager_warning       => vb_other_manager_warning,
                                                 p_hourly_salaried_warning     => vb_hourly_salaried_warning,
                                                 p_cagr_grade_def_id           => vn_cagr_grade_def_id,
                                                 p_cagr_concatenated_segments  => vv_cagr_concatenated_segments
                                                );
   DBMS_OUTPUT.put_line('ID: ' || vt_assignment_id || ', number: ' || vt_assignment_number);
END;
/


-- Go to API List
hr_assignment_api.set_new_primary_asg

DECLARE


    l_object_version_number      per_all_assignments_f.object_version_number%type;
    l_primary_assignment_id      per_all_assignments_f.assignment_id%type;
    l_primary_ovn                per_all_assignments_f.object_version_number%type;
    x_end_date                   DATE;
    x_start_date                 DATE;
    x_ovn                        per_all_assignments_f.object_version_number%type;



BEGIN
hr_assignment_api.set_new_primary_asg(p_validate => FALSE,
                                                      p_effective_date        => '02-JUN-2010',
                                                      p_person_id             => 60130,
                                                      p_assignment_id         => 59381,
                                                      p_object_version_number => x_ovn,
                                                      p_effective_start_date  => x_start_date,
                                                      p_effective_end_date    => x_end_date);
end;
/


-- Go to API List
hr_assignment_api.actual_termination_emp_asg

DECLARE

    l_object_version_number      per_all_assignments_f.object_version_number%type;
    l_primary_assignment_id      per_all_assignments_f.assignment_id%type;
    l_primary_ovn                per_all_assignments_f.object_version_number%type;
    x_end_date                   DATE;
    x_start_date                 DATE;
    x_ovn                        per_all_assignments_f.object_version_number%type;
    x_asg_future_changes_warning BOOLEAN;
    x_entries_changed_warning    VARCHAR2(100);
    x_pay_proposal_warning       BOOLEAN;


BEGIN
select max(object_version_number)
into l_primary_ovn
from per_all_assignments_f
where assignment_id=59380;
hr_assignment_api.actual_termination_emp_asg
                      (p_validate => FALSE,
                       p_assignment_id              => 59380,
                       p_object_version_number      => l_primary_ovn,
                       p_actual_termination_date    => '03-JUN-2010',
                       p_effective_start_date       => x_start_date,
                       p_effective_end_date         => x_end_date,
                       p_asg_future_changes_warning => x_asg_future_changes_warning,
                       p_entries_changed_warning    => x_entries_changed_warning,
                       p_pay_proposal_warning       => x_pay_proposal_warning);
end;
/


-- Go to API List
hr_employee_api.re_hire_ex_employee

DECLARE

l_object_version_number      per_all_people_f.object_version_number%type;
x_assignment_id              per_all_people_f.assignment_id%type;
x_asg_object_version_number  per_all_people_f.object_version_number%type;
x_effective_start_date       DATE;
x_effective_end_date         DATE;
x_assignment_sequence        per_all_assignments_f.assignment_sequence%type;
x_assignment_number          per_all_assignments_f.assignment_number%type;
x_assign_payroll_warning     BOOLEAN;


BEGIN
select max(object_version_number)
into l_object_version_number
from per_all_people_f
where person_id=72302;

hr_employee_api.re_hire_ex_employee(
              p_validate  => false,
              P_hire_date  => sysdate,
              P_person_id  => 72302,
              p_per_object_version_number => l_object_version_number,
              p_person_type_id => 44,
              p_rehire_reason => null,
              p_assignment_id   => x_assignment_id,
              p_asg_object_version_number  => x_asg_object_version_number,
              p_per_effective_start_date => x_effective_start_date,
              p_per_effective_end_date  => x_effective_end_date,
              p_assignment_sequence => x_assignment_sequence,
              p_assignment_number  => x_assignment_number,
              p_assign_payroll_warning => x_assign_payroll_warning)
end;
/



-- Go to API List
hr_person_api.update_person

set serveroutput on;

DECLARE

l_date date := to_date('01-APR-2010', 'DD-MON-YYYY');
l_true boolean := false;
l_person_id number := 35848;
l_employee_number varchar2(30) := '1178';
l_obj NUMBER :=4;
l_comment_id number;
l_EFFECTIVE_START_DATE DATE;
l_EFFECTIVE_END_DATE DATE;
l_name_combination_warning BOOLEAN;
l_assign_payroll_warning boolean;
l_orig_hire_warning BOOLEAN;
l_full_name VARCHAR2(30);
l_last_name VARCHAR2(30) := 'DIFFERENT';

BEGIN

hr_person_api.update_person
(
  p_validate => l_true
, p_effective_date => l_date
, p_datetrack_update_mode => 'CORRECTION'
, p_person_id => l_person_id
, p_object_version_number => l_obj
,  p_last_name => l_last_name
, p_employee_number => l_employee_number
, p_effective_start_date => l_effective_start_date
, p_effective_end_date => l_effective_end_date
, p_full_name => l_full_name
, p_comment_id => l_comment_id
, p_name_combination_warning => l_name_combination_warning
, p_assign_payroll_warning => l_assign_payroll_warning
, p_orig_hire_warning => l_orig_hire_warning
);
end;
/



-- Go to API List
hr_contact_rel_api.delete_contact_relationship

CONTACT_RELATIONSHIP_ID
OVN

DECLARE
l_true_boolean := FALSE;
l_contact_relationship_id := 147;
l_object_version_number := 7;

BEGIN
hr_contact_rel_api.delete_contact_relationship
(
  l_true_boolean
, l_contact_relationship_id
, l_object_version_number
);
END;
/


-- Go to API List
hr_assignment_api.update_emp_asg

set serveroutput on;
DECLARE
   i_effective_date                 DATE           := to_date('01-DEC-2012', 'DD-MON-YYYY');
   i_datetrack_update_mode          VARCHAR2 (30)  := 'CORRECTION';
   i_assignment_id                  NUMBER         := 34078;
   l_obj                                  NUMBER;
   io_cagr_grade_def_id             NUMBER;
   o_cagr_concatenated_segments     VARCHAR2 (240);
   o_concatenated_segments          VARCHAR2 (240);
   o_comment_id                     NUMBER;
   o_effective_start_date           DATE;
   o_effective_end_date             DATE;
   o_no_managers_warning            BOOLEAN;
   o_other_manager_warning          BOOLEAN;
   o_hourly_salaried_warning        BOOLEAN;
   o_gsp_post_process_warning       VARCHAR2 (240);
 
   l_people_group_id                NUMBER;
   l_object_version_number          NUMBER;
   l_special_ceiling_step_id        NUMBER;
   l_soft_coding_keyflex_id         NUMBER;
   l_group_name                     VARCHAR2 (240);
   l_effective_start_date           DATE;
   l_effective_end_date             DATE;
   l_org_now_no_manager_warning     BOOLEAN;
   l_other_manager_warning          BOOLEAN;
   l_spp_delete_warning             BOOLEAN;
   l_entries_changed_warning        VARCHAR2 (240);
   l_tax_district_changed_warning   BOOLEAN;
   l_concatenated_segments          VARCHAR2 (240);
   l_projected_assignment_end        date;

cursor csr_ovn is
       select max(object_version_number)
       from per_assignments_f where assignment_id=i_assignment_id;
begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;
 
   hr_assignment_api.update_emp_asg
   (
      p_effective_date            => i_effective_date,
      p_datetrack_update_mode        => i_datetrack_update_mode,
      p_assignment_id            => i_assignment_id,
      p_object_version_number        => l_obj,
      p_cagr_grade_def_id        => io_cagr_grade_def_id,
      p_cagr_concatenated_segments    => o_cagr_concatenated_segments,
      p_concatenated_segments        => o_concatenated_segments,
      p_soft_coding_keyflex_id        => l_soft_coding_keyflex_id,
      p_comment_id            => o_comment_id,
      p_effective_start_date        => o_effective_start_date,
      p_effective_end_date        => o_effective_end_date,
      p_no_managers_warning        => o_no_managers_warning,
      p_other_manager_warning        => o_other_manager_warning,
      p_hourly_salaried_warning        => o_hourly_salaried_warning,
      p_gsp_post_process_warning    => o_gsp_post_process_warning
      ,p_assignment_number                => 'YY123'
);
end;
/

-- Go to API List
hr_grade_rate_value_api.update_grade_rate_value

declare
l_rule_id        number := 218;
l_ovn            number;
l_start_date     date;
l_end_date       date;
l_eff_date       date := trunc(sysdate + 2);
begin
select object_version_number into l_ovn
       from pay_grade_rules_f where grade_rule_id = l_rule_id
       and l_eff_date between effective_start_date and effective_end_date;
hr_grade_rate_value_api.update_grade_rate_value
  (p_effective_date                => trunc(sysdate + 2)
  ,p_datetrack_update_mode         => 'CORRECTION'
  ,p_grade_rule_id                 => l_rule_id
  ,p_object_version_number         => l_ovn
  ,p_minimum                       => 8000
  ,p_effective_start_date          => l_start_date
  ,p_effective_end_date            => l_end_date);
end;
/





INV


INV_COST_GROUP_PUB

INV_ITEM_CATALOG_ELEM_PUB

INV_ITEM_CATEGORY_PUB

INV_ITEM_PUB

INV_ITEM_REVISION_PUB

INV_ITEM_STATUS_PUB

INV_LOT_API_PUB

INV_MATERIAL_STATUS_PUB

INV_MOVEMENT_STATISTICS_PUB

INV_MOVE_ORDER_PUB

INV_PICK_RELEASE_PUB

INV_PICK_WAVE_PICK_CONFIRM_PUB

INV_RESERVATION_PUB

INV_SERIAL_NUMBER_PUB

INV_SHIPPING_TRANSACTION_PUB