Search This Blog

Thursday, March 16, 2023

Oracle Apps R12 AR Deposit API

 declare


l_return_status VARCHAR2(1);

l_msg_count NUMBER;

l_msg_data VARCHAR2(240);

l_new_trx_number ra_customer_trx.trx_number%type;

l_new_customer_trx_id ra_customer_trx.customer_trx_id%type;

l_new_customer_trx_line_id ra_customer_trx_lines.customer_trx_line_id%type;

l_new_rowid VARCHAR2(240);

l_new_status VARCHAR2(240);


begin


/*------------------------------+

| Setting global initialization |

+-------------------------------*/

FND_GLOBAL.apps_initialize(2605, 52695, 222);

MO_GLOBAL.init('AR');



ar_deposit_api_pub.CREATE_DEPOSIT(

  p_api_version => 1.0,

  p_init_msg_list => FND_API.G_TRUE,

  p_deposit_date => trunc(sysdate),

  p_currency_code => 'AED',

  p_amount => 200,

  p_term_id => 5,

  p_cust_trx_type_id => 9507,

  p_bill_to_customer_id =>  9745106,

  p_description => 'Generic Commitment',

  p_batch_source_id => -1,

  p_class => 'DEP',

  p_start_date_commitment => sysdate,

  p_commit => FND_API.G_TRUE,

  X_new_trx_number =>l_new_trx_number,

  X_new_customer_trx_id =>l_new_customer_trx_id,

  X_new_customer_trx_line_id =>l_new_customer_trx_line_id,

  X_new_rowid =>l_new_rowid,

  x_return_status => l_return_status,

  x_msg_count => l_msg_count,

  x_msg_data => l_msg_data ) ;


FND_MSG_PUB.count_and_get (

   p_encoded => FND_API.g_false,

   p_count => l_msg_count,

   p_data => l_msg_data );


dbms_output.put_line('Return Status ==> '||l_return_status);

dbms_output.put_line('Deposit customer_trx_id ==> '||l_new_customer_trx_id);

dbms_output.put_line('l_msg_count ==> '||l_msg_count);


-- display messages from the message stack

FOR I IN 1..L_MSG_COUNT LOOP

    DBMS_OUTPUT.PUT_LINE(SUBSTR(FND_MSG_PUB.GET(P_MSG_INDEX => I, P_ENCODED => 'F'), 1, 254));

END LOOP;


END;



Error: Deposit Creation Failed The customer location site number is invalid.

Solution: Add 

(R) Receivable Manager (M) Setup - Print - Remit-to Addresses - Section "Receipts From"

1.. Go to the "Receipts From" section of the form.

2. Put the cursor in the Country field and click on the LOV.

3. Select the value "Default value"

4. Put cursor in the State field and click on LOV.

5. Select the value "Default value"

6. Save.

"Default value" comes up in the LOV of Country and state, then retest