Who's Online
1 registered (Chris Abraham), 2 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Recent Posts
P11d's
by Chris Abraham
0 seconds ago
Oracle eBsuiness HRMS Trusted Recon Query Help
by CT
Today at 02:24 PM
Concurrent Request - running slow
by CT
Today at 12:48 PM
Pension Auto Enrolment
by delboy
Today at 12:13 PM
Oracle eBsuiness HRMS Trusted Reconcilaition Help
by Mani
Today at 07:35 AM
Element to recover value in balance on leaving
by jkavia
Yesterday at 11:04 AM
Assignment EIT not displaying in Self Service
by CT
Yesterday at 06:45 AM
Vehicle Mileage Setup
by Chris Abraham
21/05/12 12:24 PM
In which table is external learning data stored
by DMC
21/05/12 08:45 AM
Oracle Payroll and Cash Management
by Gus
20/05/12 11:27 AM
Top Posters (30 Days)
CT 40
delboy 39
Vigneswar Battu 15
pat.woodall 10
Mani 6
Gus 4
bcooper 4
Ryan 3
Jan 3
DMC 3
(Views)Popular Topics
Family Pack K issues thread 20170
CREATE_GRADE api returns:PLS-00306: wrong number o 15200
Still trying to locate... 13855
Creating hr jobs ORA-20001: HR_289477_JOB_GROUP_ID 11907
Viewing Output of another user 10324
HR_PF.K RUP4 10298
Review of my Release 12 laptop 9747
Enhanced Retro & Release 12 9402
Adding a taskflow button to a form 9140
Family Pack K 7910
Topic Options
Rate This Topic
#5862 - 27/09/10 11:41 AM Person API.update
Anna Suntha Offline
stranger

Registered: 26/09/10
Posts: 3
Hi

I am a newbie to API. Could someone share with me the code for employee update.api. I have to update email address, date of birth and first name based on the person id.

Thanks in advance

Regards
anna

Top
#5864 - 27/09/10 05:55 PM Re: Person API.update [Re: Anna Suntha]
Sudhir Offline
hanger-on

Registered: 02/02/09
Posts: 53
Loc: UK
Hi Anna,

API are provided by oracle, which saves us time to write the code to do the task.

As a developer, you would write a wrapper code, in which you incorporate the business rules / validations and call API.

As you are newbie, i suggest fundatmentals of Object Version NUmber is very important, you can learn all about API in the article provided by oracle in the following note.

Understanding and Using APIs in Oracle HRMS [ID 72310.1]

Cheers
Sudhir

Top
#5865 - 28/09/10 02:00 AM Re: Person API.update [Re: Sudhir]
Anna Suntha Offline
stranger

Registered: 26/09/10
Posts: 3
Hi Sudhir

Thanks for your prompt reply

I was managed to write a wrapper for my requirement but unfortunately receiving an error "unsupported construct or internal error"

If you have time could you please check the coding for me

Thanks
anna

Code:
DECLARE

ln_person_id          NUMBER;
lv_emp_number         per_all_people_f.employee_number%TYPE; -- IN/OUT
ln_ovn                per_all_people_f.object_version_number%TYPE; -- IN/OUT
ld_eff_start_date     DATE;  --OUT
ld_eff_end_date       DATE; -- OUT
lv_email_address      per_all_people_f.email_address%TYPE;
lv_title              per_all_people_f.title%TYPE;
ld_date_of_birth      per_all_people_f.date_of_birth%TYPE;
lv_first_name         per_all_people_f.first_name%TYPE;
lv_middle_name        per_all_people_f.middle_names%TYPE;
lv_last_name          per_all_people_f.last_name%TYPE;
lv_sex                per_all_people_f.sex%TYPE;
lv_country_of_birth   per_all_people_f.country_of_birth%TYPE;
lv_known_as           per_all_people_f.known_as%TYPE;
lc_mode               VARCHAR2(50);
lc_chg_date            DATE;
--lv_umid             future development;

--OUT
lv_full_name          per_all_people_f.full_name%TYPE; 
ln_comment_id         NUMBER;
lb_cmbn_warn          BOOLEAN;
lb_payroll_warn       BOOLEAN;
lb_orig_hire_warn     BOOLEAN;

--- Constants
lc_emp_apl             CONSTANT VARCHAR2(1)   := 'Y';
c_chg_date             CONSTANT DATE           := TRUNC(SYSDATE);
lc_upd_mode            CONSTANT VARCHAR2(50)  := 'UPDATE';
lc_upd_ovr_mode        CONSTANT VARCHAR2(50)  := 'UPDATE_OVERRIDE';
lc_correct_mode        CONSTANT VARCHAR2(50)  := 'CORRECTION';


CURSOR csr_get_person 
IS 
SELECT *
FROM  per_all_people_f papf
WHERE (c_chg_date BETWEEN papf.effective_start_date AND papf.effective_end_date
        OR papf.effective_start_date > c_chg_date)

--AND papf.current_employee_flag = lc_emp_apl
;

BEGIN
  FOR per_rec IN csr_get_person LOOP
    ln_person_id            := per_rec.person_id;
    lv_emp_number           := per_rec.employee_number;
    ln_ovn                  := per_rec.object_version_number;
    ld_eff_start_date       := per_rec.effective_start_date;
    ld_eff_end_date         := per_rec.effective_end_date;
    lv_email_address        := per_rec.email_address;
    lv_title                := per_rec.title;
    ld_date_of_birth        := per_rec.date_of_birth;
    lv_first_name           := per_rec.first_name;
    lv_middle_name          := per_rec.middle_names;
    lv_last_name            := per_rec.last_name;
    lv_sex                  := per_rec.sex;
    lv_country_of_birth     := per_rec.country_of_birth;
    lv_known_as             := per_rec.known_as;
    
    
---- effective date and date track     
    IF ld_eff_end_date = hr_general.end_of_time THEN 
       lc_mode := lc_upd_mode;
    ELSE
      lc_mode := lc_upd_ovr_mode;
    END IF;
    
    IF ld_eff_start_date = c_chg_date THEN
      lc_mode := lc_correct_mode;
    END IF;
    
    IF ld_eff_start_date > c_chg_date THEN
      lc_chg_date := ld_eff_start_date;
      lc_mode := lc_correct_mode;
    ELSE
      lc_chg_date := c_chg_date;
    END IF;

    hr_au_person_api.update_au_person
    ( p_effective_date                  => c_chg_date
    ,p_datetrack_update_mode            => lc_mode 
    ,p_person_id                        => ln_person_id
    ,p_object_version_number            => ln_ovn 
    ,p_employee_number                  => lv_emp_number
    ,p_title                            => lv_title
    ,p_date_of_birth                    => ld_date_of_birth
    ,p_first_name                       => lv_first_name 
    ,p_middle_name                      => lv_middle_name
    ,p.last_name                        => lv_last_name
    ,p_sex                              => lv_sex
    ,p_country_of_birth                 => lv_country_of_birth
    ,p_known_as                         => lv_known_as
    ,p_effective_start_date             => ld_eff_start_date  --out
    ,p_effective_end_date               => ld_eff_end_date --out
    ,p_full_name                        => lv_full_name --out
    ,p_comment_id                       => ln_comment_id --out
    ,p_cmbn_warn                        => lb_cmbn_warn --out
    ,p_payroll_warn                     => lb_payroll_warn --out
    ,p_orig_hire_warn                   => lb_orig_hire_warn --out
);
 
  END LOOP; -- per rec
--  EXCEPTION
END;





Edited by bcooper (28/09/10 08:21 AM)
Edit Reason: Code formatting

Top
#5868 - 28/09/10 08:30 AM Re: Person API.update [Re: Anna Suntha]
bcooper Offline

Guru
*****

Registered: 11/03/05
Posts: 1112
Loc: Earth, Europe, England, here
Hmmm, where to start...

What are you attempting to achieve with your code? From the looks of it, you are performing a query on the person table, and then using the query results to update the same table, with the same values. Thus not achieving a lot (other than changing the last_update_date).

Also, you may wish to take a look at the HR_DT_API code - this provides global constants for the various datetrack modes, and also provides useful function calls for determining the datetrack mode to use (just by passing in the KEY and dates).
_________________________
HCM Aces is for sale! Please contact me if you are interested.
Also my random musings courtesy of Twitter

Top
#7449 - 27/02/12 04:16 AM Re: Person API.update [Re: Anna Suntha]
asha Offline
passing stranger

Registered: 17/02/12
Posts: 1
Hi All,

Am trying to update person ssn and salary. Salary is working fine but the issue comes in ssn. The update api in the loop is not working for every object version number.

For example if select statement is fetching 4 records for a person for which the ssn has to be changed to a particular person the prg is changing only one record with highest value..

Can any one help me out..

Thanks in advance.

Top



Moderator:  bcooper, CT 
Forum Stats
792 Members
48 Forums
1584 Topics
7663 Posts

Max Online: 67 @ 14/04/12 05:38 PM
Today's Birthdays
No Birthdays
Recent vacancies
Top Posters
CT 1188
bcooper 1112
delboy 597
Geoff Dixon 369
SBi 356
vkumar 223
kp_rapolu 213
cbrookes 197
Gavin Harris 163
Gus 146
May
Su M Tu W Th F Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31