./addresp.sh GV3T_ZU_Q9KLSSD1 SEETHA "Requesting Approver"
more ./addresp.sh
APPSPWD=$1
username=$2
respname="$3"
if [[ -z ${username} ]]
then
echo "Enter Username "
read username
fi
if [[ -z ${respname} ]]
then
echo "Enter responsibility like System Administrtor "
read respname
fi
PDBSID=`echo "$ORACLE_SID" | cut -c 1-6`
HOST="`hostname`"
. $ORACLE_HOME/"$PDBSID"_"$HOST".env
sqlplus -s apps/$APPSPWD@$ORACLE_SID << EOF
set serveroutput on
declare
v_userid fnd_user.user_id%type;
v_respid fnd_responsibility_tl.responsibility_id%type;
v_applid fnd_responsibility_tl.application_id%type;
begin
select user_id
into v_userid
from fnd_user
where user_name='${username}';
dbms_output.put_line('userid for $username is ' || v_userid);
select application_id, responsibility_id
into v_applid, v_respid
from fnd_responsibility_tl
where responsibility_name like '${respname}';
dbms_output.put_line('Resp id, Application id for ${respname} are ' || v_respid ||','|| v_applid);
fnd_user_resp_groups_api.Upload_Assignment(v_userid,v_respid,v_applid,0,sysdate,sysdate+90,'Comments');
exception
when others then
dbms_output.put_line(sqlerrm);
end;
/
EOF