--以下代码于20180117在Tony环境成功实现
declare
-- Local variables here
x_owner varchar2(30);
cursor cur_resp is
select t.user_name, 'GT_付款申请查询' RESP_NAME
from Fnd_user t ---需要修改
where not exists (
select 1
from FND_USER_RESP_GROUPS_DIRECT fug,
fnd_responsibility_tl frt,
fnd_user fu
where frt.LANGUAGE = 'ZHS'
AND FUG.RESPONSIBILITY_ID = FRT.RESPONSIBILITY_ID
AND FU.USER_ID = FUG.user_id
AND FU.USER_NAME = T.USER_NAME
AND FRT.RESPONSIBILITY_NAME = 'GT_付款申请查询')
AND T.USER_ID in
(select fu.user_id
from Fnd_user fu
where fu.employee_id in
(select he.employee_id
from hr_employees he
where he.last_name in
(select he.last_name
from CUX.HYF_TEST_ALL hta--这里存储用户的名字,必须与ERP的员工名字保持一致
join HR_EMPLOYEES he
on he.last_name = hta.my_char)))
---需要修改
;
x_rowid varchar2(100);
x_resp_id number;
x_resp_appl_id number;
X_USER_ID number;
begin
-- Test statements here
for rec in cur_resp loop
select fu.USER_ID
into X_USER_ID
from fnd_user fu
where fu.USER_NAME = rec.user_name;
select fr.RESPONSIBILITY_ID, FR.APPLICATION_ID
into x_resp_id, x_resp_appl_id
from Fnd_Responsibility_Tl FR
where fr.LANGUAGE = 'ZHS'
and fr.RESPONSIBILITY_NAME = rec.resp_name;
fnd_user_resp_groups_api.Insert_Assignment(user_id => X_USER_ID, ---Insert_Assignment 替换为 Update_Assignment 是否合适
responsibility_id => x_resp_id,
responsibility_application_id => x_resp_appl_id,
start_date => to_date('2017-11-08',
'yyyy-mm-dd'),
end_date => null,
description => null);
commit;
dbms_output.put_line(cur_resp%rowcount||rec.user_name || ',Assignment Success!');
end loop;
exception
when others then
dbms_output.put_line('ERROR:' || SQLERRM);
end;
EBS开发_批量给用户分配职责
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013711561/article/details/79089701
猜你喜欢
转载自blog.csdn.net/u013711561/article/details/79089701
今日推荐
周排行