Friday, August 5, 2016

Web ADI integrator "ORA-06508: PL/SQL: could not find program unit being called"

In custom Web ADI integrator, when code changes are made to the API, then loading of rows fail with the following error: ORA-06508: PL/SQL: could not find program unit being called

Solution:

To implement the solution, please execute the following steps:

1. Run the following sql to clear the shared pool:
SQL>alter system flush shared_pool;

2. Bounce the Apache server:

cd $ADMIN_SCRIPTS_HOME 
1. adapcctl.sh stop
2. adapcctl.sh start
3. adoafmctl.sh stop
4. adoafmctl.sh start
5. adoacorectl.sh stop
           6. adoacorectl.sh start 
3. Retest the issue.

Monday, August 1, 2016

"Cross currency rate is null." while calling AR_RECEIPT_API_PUB.CREATE AND APPLY API

Solution:

This error occurs when Receipt currency is different from Invoice Currency. You have to specify p_trans_to_receipt_rate parameter while calling  AR_RECEIPT_API_PUB.CREATE AND APPLY.

sample:

DECLARE

    --local Variables
    g_loc                       NUMBER :=0;
    g_msg                       VARCHAR2(500);
    l_error_description         VARCHAR2 (2000) := NULL;
    g_sysdate                   DATE  := SYSDATE;
    l_ar_receipt_succ_count     NUMBER:= 0;
    l_ar_receipt_err_count      NUMBER:= 0;
    l_ar_receipt_tot_count      NUMBER:= 0;
    l_msg_index_num             NUMBER:= 1;
    l_msg_count                 NUMBER;
    l_data_txt                  VARCHAR2(1000);
    l_msg_data                  VARCHAR2(1000);
    l_apl_return_status         VARCHAR2 (1);
    l_apl_msg_count             NUMBER;
    l_apl_msg_data              VARCHAR2 (240);
    l_org_id                    NUMBER := FND_PROFILE.VALUE('ORG_ID') ;
    l_gl_date_count             NUMBER;
    l_functional_currency fnd_currencies.currency_code%TYPE;
    l_conv_type gl_daily_conversion_types.conversion_type%TYPE;
    l_conv_rate gl_daily_rates.conversion_rate%TYPE;
    l_cust_account_id hz_cust_accounts.cust_account_id%TYPE;
    l_receipt_id ar_cash_receipts_all.cash_receipt_id%TYPE;
    l_return_status             VARCHAR2(10);
    l_cust_bank_acct_id         NUMBER;

   
BEGIN
 

    l_msg_count           := 0;
    l_data_txt            := NULL;
    l_msg_index_num       := NULL;
    l_gl_date_count       := 0;
    l_functional_currency := NULL;
    l_conv_type           := NULL;
    l_conv_rate           := NULL;
    l_receipt_id          := NULL;
    l_return_status       := NULL;
    l_msg_data            := NULL;
 

   
   FND_GLOBAL.APPS_INITIALIZE(0, 50259, 222);
   MO_GLOBAL.SET_POLICY_CONTEXT('S',l_org_id);
   
    dbms_output.put_line('before calling api ');

    -- Call Api to create receipt
 
         AR_RECEIPT_API_PUB.create_and_apply
                                   ( p_api_version => 1.0,
                                   p_init_msg_list => FND_API.G_TRUE,
                                   p_commit => FND_API.G_TRUE,
                                   p_validation_level => FND_API.G_VALID_LEVEL_FULL,
                                   p_currency_code     => 'USD',
                                   x_return_status => l_return_status,
                                   x_msg_count => l_msg_count,
                                   x_msg_data => l_msg_data,
                                   p_amount => 100,
                                   p_receipt_number => '123767589',
                                   p_receipt_date =>  sysdate-2,
                                   p_gl_date => sysdate-2,
                                   p_customer_number => 9399,
                                   p_receipt_method_id => 21011,
                                   p_trx_number => 'P18_00004',
                                   p_cr_id => l_receipt_id ,
                                   p_org_id => 93,
                                   p_location          => 'RUSK8' ,
                                   p_show_closed_invoices => 'Y' ,
                                   p_exchange_rate_type => 1000,
                                   p_exchange_rate     => null,
                                   p_exchange_rate_date => to_date('01/04/2016','dd/mm/yyyy'),
                                   p_amount_applied => 100,
                                  p_trans_to_receipt_rate=>0.5
);
                                   
                                   
   
    dbms_output.put_line('called api ');
    IF (l_return_status = 'S') THEN
        dbms_output.put_line('Calling Api AR_RECEIPT_API_PUB.CREATE_CASH success -- >' ||l_return_status ||' Receipt Id > '||l_receipt_id);
 

    ELSE
        dbms_output.put_line('Error in Calling Receipt API:');
       
        FOR i IN 1 .. l_msg_count
        LOOP
            FND_MSG_PUB.GET(p_msg_index => i, p_encoded => 'F', p_data => l_data_txt, p_msg_index_out => l_msg_index_num );        
            l_error_description := SUBSTR(l_error_description||l_data_txt,1,400);
            DBMS_OUTPUT.put_line( l_error_description);
        END LOOP;
       
       
    END IF;

COMMIT;

EXCEPTION
    WHEN OTHERS THEN
        dbms_output.put_line('Error in procedure '||SQLERRM);
END ;
/