CREATE OR REPLACE PACKAGE APPS.XXHR_CONV_FND_USER_PKG IS
PROCEDURE FND_PRc(p_err_buf OUT VARCHAR2
,p_retcode OUT NUMBER);
end;
/
CREATE OR REPLACE PACKAGE BODY APPS.XXHR_CONV_FND_USER_PKG IS
PROCEDURE FND_prc
(
p_err_buf OUT VARCHAR2,
p_retcode OUT NUMBER
) IS
/* ***********************************************************
* Procedure Name : UPD_PRF
* Description : This procedure is used for updating the security Profile Option.
* Parameters IN : none
* Parameters Out: none
* Prerequisits:
************************************************************** */
l_user_name fnd_user.user_name%type;
l_employee_id per_all_people_f.person_id%type;
l_begin_date date := trunc(sysdate);
v_buss_id NUMBER;
v_err_flag VARCHAR2(1);
v_err_mesg VARCHAR2(2000);
v_err_sql_msg VARCHAR2(2000);
v_tot_cnt NUMBER DEFAULT 0;
v_tot_suc NUMBER DEFAULT 0;
v_tot_fal NUMBER DEFAULT 0;
v_application_name varchar2(100);
v_responsibility_key varchar2(100);
cursor cur_sec is
select * from xxhr_fnd_user_upload
where nvl(upload_status, 'n') <> 'y'
for update of upload_status;
CURSOR cur_sec_err IS
SELECT * FROM xxhr_fnd_user_upload WHERE upload_status = 'E';
BEGIN
v_buss_id := fnd_profile.VALUE('PER_BUSINESS_GROUP_ID');
FOR c_rec IN cur_sec
LOOP
v_tot_cnt := v_tot_cnt + 1;
fnd_file.put_line(fnd_file.log,
'*****************************************************************************************' ||
v_tot_cnt);
v_err_mesg := NULL;
v_err_flag := NULL;
IF c_rec.new_employee_id IS NULL THEN
v_err_flag := 'E';
v_err_mesg := 'Employee id cannot be NULL';
else
begin
select
papf.person_id into
l_employee_id from
per_all_people_f papf
where
person_id=c_rec.new_employee_id
and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
and papf.business_group_id= v_buss_id
and papf.current_employee_flag='Y';
exception
when others then
v_err_flag := 'E';
v_err_mesg := 'Invalid Employee';
END;
END IF;
IF nvl(v_err_flag, 'N') <> 'E' THEN
begin
fnd_user_pkg.updateuser(
x_user_name => c_rec.user_name
, x_owner => NULL
,x_employee_id => l_employee_id
);
commit;
UPDATE xxhr_fnd_user_upload
SET upload_status = 'Y', comments = NULL
WHERE CURRENT OF cur_sec;
v_tot_suc := v_tot_suc + 1;
EXCEPTION
WHEN OTHERS THEN
v_tot_fal := v_tot_fal + 1;
v_err_flag := 'E';
v_err_mesg := 'Error : Error Inserting Fnd_user - ' ||
to_char(SQLCODE) || '-' || SQLERRM;
UPDATE xxhr_fnd_user_upload
SET upload_status = 'E', comments = nvl(v_err_mesg, 'Error')
WHERE CURRENT OF cur_sec;
END;
ELSE
v_tot_fal := v_tot_fal + 1;
UPDATE xxhr_secur_pro_upload
SET upload_status = 'E', comments = nvl(v_err_mesg, 'error')
WHERE CURRENT OF cur_sec;
END IF;
v_err_flag := NULL;
END LOOP;
COMMIT;
fnd_file.put_line(fnd_file.log,
'*****************************************************************************************');
fnd_file.put_line(fnd_file.log,
'**************************Security UPLOAD REPORT*******************************');
fnd_file.put_line(fnd_file.log,
'*****************************************************************************************');
fnd_file.put_line(fnd_file.log,
'Total Numbers of Records Read : ' ||
v_tot_cnt);
fnd_file.put_line(fnd_file.log,
'Total Numbers of Records Inserted : ' ||
v_tot_suc);
fnd_file.put_line(fnd_file.log,
'Total Numbers of Records Errored Out : ' ||
v_tot_fal);
fnd_file.put_line(fnd_file.log,
'*****************************************************************************************');
fnd_file.put_line(fnd_file.log, 'ERRORED OUT Profiles ');
FOR cur_rec IN cur_sec_err
LOOP
fnd_file.put_line(fnd_file.log,
'Employee Name : ' || cur_rec.user_name || ': ' ||
cur_rec.comments);
END LOOP;
END fnd_prc;
END XXHR_CONV_FND_USER_PKG;
/
No comments:
Post a Comment
Thanks for your comments submitted.,will review and Post soon! by admin.