Wednesday, May 23, 2012

AP invoice sweep program by OU


-->
Despite many requests, Oracle still not enabled period closing in modules (particularly AR/AP) by operating unint, it is only can be achieved by standard functionality if OU's assigned to different set of books. If you OU's assigned to the same SOB, period can be closed only at once for all OU's which is quite inconvinient.
AP invoice sweep program and report about period exceptions in ap behave the same way. In this post I'l show you how to tweak system to enable AP invoice sweep program and report about period exceptions in ap work by particular OU.
Both mentioned programs uses ap_org_attributes_gt temporary table to store OU's being processed. I decided to impose policy on this table to restrict access current user to specific OU.
I defined two custom profile option's assigned to current user (only at user level!) one  XXAP_ENABLED_OU links current user to particular OU and another one XXAP_SUPER_USER if assigned an has Y value allows current user to access all OU's preserving standard functionality, just in case.

 create or replace function policy_ap_org_attributes_gt (p_schema varchar2, p_object varchar2)
return varchar2 is
begin
  if fnd_profile.VALUE_SPECIFIC('XXAP_SUPER_USER')='Y' then
    return '1=1';
  else 
    return 'ORG_ID = fnd_profile.VALUE_SPECIFIC(''XXAP_ENABLED_OU'')';
  end if; 
end;

then eneble policy

Begin
DBMS_RLS.ADD_POLICY (
   object_schema => 'AP',
   object_name    => 'ap_org_attributes_gt',
   policy_name    => 'xx_ap_org_attributes_gt',
   policy_function    => 'policy_ap_org_attributes_gt',
   statement_types => 'select, insert, update, delete',
   update_check    => false
);
End;

thats all about, benefit :)

No comments:

Post a Comment