Thursday 27 February 2014

Add Responsibility from backend.

DECLARE

p_user_name VARCHAR2 (50) := <Username>;
p_resp_name VARCHAR2 (50) := <Responsibility Name>;
v_user_id NUMBER (10) := 0;
v_responsibility_id NUMBER (10) := 0;
v_application_id NUMBER (10) := 0;

BEGIN

BEGIN
SELECT user_id
INTO v_user_id
FROM fnd_user
WHERE UPPER (user_name) = UPPER (p_user_name);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DBMS_OUTPUT.put_line ('User not found');
RAISE;
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error finding User.');
RAISE;
END;

BEGIN
SELECT application_id, responsibility_id
INTO v_application_id, v_responsibility_id
FROM fnd_responsibility_vl
WHERE UPPER (responsibility_name) = UPPER (p_resp_name);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DBMS_OUTPUT.put_line ('Responsibility not found.');
RAISE;
WHEN TOO_MANY_ROWS
THEN
DBMS_OUTPUT.put_line
('More than one responsibility found with this name.');
RAISE;
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error finding responsibility.');
RAISE;
END;

BEGIN

DBMS_OUTPUT.put_line ('Initializing The Application');

fnd_global.apps_initialize (user_id => v_user_id,
resp_id => v_responsibility_id,
resp_appl_id => v_application_id
);

DBMS_OUTPUT.put_line
('Calling FND_USER_RESP_GROUPS_API API To Insert/Update Resp');

fnd_user_resp_groups_api.update_assignment
(user_id => v_user_id,
responsibility_id => v_responsibility_id,
responsibility_application_id => v_application_id,
security_group_id => 0,
start_date => SYSDATE,
end_date => NULL,
description => NULL
);

DBMS_OUTPUT.put_line
('The End Date has been removed from responsibility');
COMMIT;

EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error calling the API');
RAISE;
END;
END;
/




SET SERVEROUTPUT ON
set veri off
set echo off
set head off
set feed off
declare
v_user_name varchar2(30):=upper('SYSADMIN');
v_resp varchar2(30):='Direct US Service Contracts Manager';
v_resp_key varchar2(30);
v_app_short_name varchar2(50);
begin
  select
    r.responsibility_key ,
    a.application_short_name
  into v_resp_key,v_app_short_name
  from fnd_responsibility_vl r,
    fnd_application_vl a
  where
    r.application_id =a.application_id
    and upper(r.responsibility_name) = upper(v_resp);

  fnd_user_pkg.AddResp (
  username => v_user_name,
  resp_app => v_app_short_name,
  resp_key => v_resp_key,
  security_group => 'STANDARD',
  description => null,
  start_date => sysdate,
  end_date => null
  );
  commit;
  DBMS_OUTPUT.put_line ('Responsibility:'||v_resp||' '||'is added to the User:'||v_user_name);
EXCEPTION
when others then
  DBMS_OUTPUT.put_line ('Unable to add the responsibility due to'||SQLCODE||' '||SUBSTR(SQLERRM, 1, 100));
  rollback;
end;
/

Monday 17 February 2014

My first Abstract accepted in IBM event.















Emerging Technologies – In Memory Database Implementation.
Author – Akash Pramanik
Abstract Topic – Simplifying data life cycle using Automatic Data Optimization (Heat Map)

An in memory heat map tracks access to segments and blocks
ü      Data is periodically written to disk
ü      Information is accessible by views or stored procedures

Database Administrators can attach policies to tables to compress or tier data based on access to data
ü      Tables or Partitions can be moved between compression levels whilst data is still being accessed.
Let us assume Database Administrators apply policies like:
1.      Compress Partitions with row compression if they haven’t been modified in 30 days.
2.      Compress Partitions with columnar compression if they haven’t been modified in 180 days.
A heat map tracks the activity of segments and blocks.


Reduce storage footprint by applying policies to tables. Finally providing a to the storage requirements.

Benefits – Can solve the memory problem to a large extent. Save dollars by reducing server space requirement. Shall soon replace third party archiving solutions.