比如有一个外围支持系统,用户需要在外围系统登录之后点个link就可以登录到Oracle ERP系统中,那么我们需要先把外围系统的用户创建在Oracle ERP中,并且分配职责给他。
DECLARE
a BOOLEAN;
BEGIN
-------------------------------------------------------------
--Change password
-------------------------------------------------------------
/*
a := apps.fnd_user_pkg.changepassword('SIMON','oracle');
IF NOT a THEN
--RAISE_APPLICATION_ERROR(-20002, 'Password not updated');
dbms_output.put_line('Password not updated');
ELSE
dbms_output.put_line('***Password updated');
COMMIT;
END IF;
*/
-------------------------------------------------------------
--Create User
-------------------------------------------------------------
fnd_user_pkg.CreateUser('SIMON',
'SEED',
'PW$234567'
);
-------------------------------------------------------------
--Add Resp
--select * from fnd_responsibility fr where fr.responsibility_id =
--select * from fnd_responsibility_tl frt where upper(frt.responsibility_name) like '%%'
--select * from fnd_application fa where fa.application_id =
--select * from fnd_security_groups fs
-------------------------------------------------------------
fnd_user_pkg.AddResp ('SIMON',
'SYSADMIN',
'SYSTEM_ADMINISTRATOR',
'STANDARD',
'Test API',
sysdate,
null
);
Commit;
End;
使用下面代码可以在Link中直接登录Oracle ERP系统:
<html>
<head>
<title>iSupport Login</title>
</head>
<body nLoad="document.Login.submit()">
<form. action="http://host:port/OA_HTML/jtfavald.jsp"
method="post" name="Login" id="Login">
<input type="hidden" name="username" value="$UserName$">
<input type="hidden" name="password" value="$Password$">
</form>
</body>
</html>
最近想删除系统中的一些无效用户,但系统好像不支持直接删除用户的功能,所以查看Fnd_User_Pkg这个的原代码,发现有一个过程可以删除用户但必须先将用户的有效日期改成FND_API.G_MISS_DATE的值,否则它就会报错,然后查看FND_API.G_MISS_DATE的值是等于2012-01-01的
fnd_user set start_date=to_date('20120101','yyyymmdd'),end_date=to_date('20120101','yyyymmdd')
where user_name = upper('SUNNLY');
commit;
Begin
Fnd_User_Pkg.Removependinguser('SUNNLY');
End;
commit;
BEGIN
IF NOT FND_PROGRAM.program_in_group(
program_short_name => 'XX_DETAIL_SALE_COST_PKG',
program_application => 'XX',
request_group => 'XX_GL_REQUEST_GROUP',
group_application => 'XX') THEN
Fnd_Program.Add_to_group(
program_short_name => 'XX_DETAIL_SALE_COST_PKG',
program_application => 'XX',
request_group => 'XX_GL_REQUEST_GROUP',
group_application => 'XX');
commit;
dbms_output.put_line('Program XX_DETAIL_SALE_COST_PKG added to Group XX_GL_REQUEST_GROUP');
ELSE
dbms_output.put_line('Program XX_DETAIL_SALE_COST_PKG already in Group XX_GL_REQUEST_GROUP');
END IF;
END;