Monday, November 17, 2014

PA_INTERFACE_UTILS_PUB.SET_GLOBAL_INFO is getting failed with Org Context Issue for single org

If the below API is unable to set the org context where MOAC is not enabled.

  PA_INTERFACE_UTILS_PUB.SET_GLOBAL_INFO( P_API_VERSION_NUMBER => 1.0
                                      , P_RESPONSIBILITY_ID =>
                                      , P_USER_ID =>
                                      , P_OPERATING_UNIT_ID =>
                                      , P_MSG_COUNT => v_msg_count
                                      , P_MSG_DATA => v_msg_data
                                      , p_return_status => v_return_status);

We can use the below APIs to set the org context where MOAC is not enabled.



declare
l_msg_count number;
l_msg_data varchar2(1000);
l_return_status varchar2(10);
l_org_id number;
begin

PA_MOAC_UTILS.SET_POLICY_CONTEXT('S',); 

PA_MOAC_UTILS.MO_INIT_SET_CONTEXT(p_org_id          =>l_org_id
                             , p_product_code   =>'PA'
                             , p_msg_count       =>l_msg_count
                             , p_msg_data      =>l_msg_data
                             , p_return_status  =>l_return_status);
end;

Wednesday, July 9, 2014

SQL query to check which user locked the table

SELECT objects.owner,
       objects.object_name,
       objects.object_type,
       user1.user_name         locking_fnd_user_name,
       login.start_time        locking_fnd_user_login_time,
       vs.module,
       vs.machine,
       vs.osuser,
       vlocked.oracle_username,
       vs.sid,
       vp.pid,
       vp.spid                 os_process,
       vs.serial#,
       vs.status,
       vs.saddr,
       vs.audsid,
       vs.process
  FROM fnd_logins      login,
       fnd_user        user1,
       v$locked_object vlocked,
       v$process       vp,
       v$session       vs,
       dba_objects     objects
 WHERE vs.sid = vlocked.session_id
   AND vlocked.object_id = objects.object_id
   AND vs.paddr = vp.addr
   AND vp.spid = login.process_spid(+)
   AND vp.pid = login.pid(+)
   AND login.user_id = user1.user_id(+)
--change the table name below
   AND objects.object_name LIKE '%' || upper('AP_INVOICES_ALL') || '%'
   AND nvl(vs.status,
           'XX') != 'KILLED';

Monday, June 16, 2014

Query to fetch DFF field details

select a.APPLICATION_TABLE_NAME,b.* from FND_DESCRIPTIVE_FLEXS_VL a,FND_DESCR_FLEX_COL_USAGE_VL b
where a.descriptive_flexfield_name=b.descriptive_flexfield_name
and a.descriptive_flexfield_name='GMS_INSTALLMENTS_DESC_FLEX'

Friday, May 2, 2014

SQL Query to fetch file version of standard package files

select distinct af.app_short_name
, af.filename
, afv.version
, afv.creation_date
from ad_file_versions afv, ad_files af
where afv.file_id = af.file_id
and upper(af.filename) like  
order by 4 desc 

Tuesday, April 29, 2014

API to cancel an AP invoice in R12

Declare
v_boolean               BOOLEAN;
v_error_code            VARCHAR2(100);
v_debug_info            VARCHAR2(1000);
begin
v_boolean :=AP_CANCEL_PKG.IS_INVOICE_CANCELLABLE(
                P_invoice_id       => p_inv_id,
                P_error_code       => v_error_code,
                P_debug_info       => v_debug_info,
                P_calling_sequence => NULL);
IF v_boolean=TRUE
THEN
DBMS_OUTPUT.put_line ('Invoice '||p_inv_id|| ' is cancellable' );
ELSE
DBMS_OUTPUT.put_line ('Invoice '||p_inv_id|| ' is not cancellable :'|| v_error_code );
END IF;
End;



To cancel an AP invoice if cancellable.

Declare
v_boolean               BOOLEAN;
v_message_name          VARCHAR2(1000);
v_invoice_amount        NUMBER;
v_base_amount           NUMBER;
v_temp_cancelled_amount NUMBER;
v_cancelled_by          VARCHAR2(1000);
v_cancelled_amount      NUMBER;
v_cancelled_date        DATE;
v_last_update_date      DATE;
v_orig_prepay_amt       NUMBER;
v_pay_cur_inv_amt       NUMBER;
v_token                 VARCHAR2(100);
begin
v_boolean := AP_CANCEL_PKG.AP_CANCEL_SINGLE_INVOICE
            (p_invoice_id                 => P_xx_invoice_id,
             p_last_updated_by            => P_xx_last_updated_by,
             p_last_update_login          => P_xx_last_update_login,
             p_accounting_date            => P_xx_accounting_date,
             p_message_name               => v_message_name,
             p_invoice_amount             => v_invoice_amount,
             p_base_amount                => v_base_amount,
             p_temp_cancelled_amount      => v_temp_cancelled_amount,
             p_cancelled_by               => v_cancelled_by,
             p_cancelled_amount           => v_cancelled_amount,
             p_cancelled_date             => v_cancelled_date,
             p_last_update_date           => v_last_update_date,
             p_original_prepayment_amount => v_orig_prepay_amt,
             p_pay_curr_invoice_amount    => v_pay_cur_inv_amt,
             P_Token                      => v_token,
             p_calling_sequence           => NULL
             );

IF v_boolean
THEN
DBMS_OUTPUT.put_line ('Successfully Cancelled the Invoice' );
COMMIT;
ELSE
DBMS_OUTPUT.put_line ('Failed to Cancel the Invoice' );
ROLLBACK;
END;



Friday, April 25, 2014

FND Debug Log metalink notes


Wednesday, April 16, 2014

HRMS APIs with hard coded syntax

Click to add to FavoritesHardcoded HRMS API Examples (Doc ID 1505063.1)