This is a test script given by oracle which I had used in my project before.
1. Login to sql plus.
2. Run the following SQL code to obtain USER_ID, RESPONSIBILITY_ID & RESPONSIBILITY_APPLICATION_ID for a given User / Responsibility.
SELECT user_id, responsibility_id, responsibility_application_id, Â
security_group_id Â
FROM fnd_user_resp_groups Â
WHERE user_id = (SELECT user_id Â
FROM fnd_user Â
WHER user_name = '&user_name')Â Â
AND responsibility_id = (SELECT responsibility_id Â
FROM fnd_responsibility_vl Â
WHERE responsibility_name = '&resp_name');Â
3. Run following API to apply a cash receipt in your functional currency to unapplied cash on another receipt, using a call to the API Ar_receipt_api_pub.apply_open_receipt and passing a minimum number of input parameters.
/*=======================================================================+
|Â Copyright (c) 1993 Oracle Corporation Redwood Shores, California, USA|
|                         All rights reserved.                        |
+=======================================================================+
| DESCRIPTIONÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
|     PL/SQL to run API AR_RECEIPT_API_PUB.apply_open_receipt         |
+=======================================================================*/
set serveroutput on
DECLARE
l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(240);
l_count NUMBER;
l_cash_receipt_id NUMBER;
l_msg_data_out VARCHAR2(240);
l_mesg VARCHAR2(240);
p_count number;
l_amount_applied NUMBER;
l_receipt_number VARCHAR2(30);
l_open_receipt_number  VARCHAR2(30);
l_application_ref_num  VARCHAR2(30);
l_receivable_application_id NUMBER;
l_applied_rec_app_id NUMBER;
l_acctd_amount_applied_from NUMBER;
l_acctd_amount_applied_to VARCHAR2(30);
BEGIN
/*------------------------------------+
| Setting global initialization     |
+------------------------------------*/
FND_GLOBAL.apps_initialize(&user_id,&resp_id,&resp_appl_id);
MO_GLOBAL.init('AR');
/*------------------------------------+
| Setting value to input parameters |
+------------------------------------*/
l_amount_applied :=Â &amount_applied;
l_receipt_number := '&receipt_number';
l_open_receipt_number  := '&open_receipt_number';
/*------------------------------------+
|Â Calling to the APIÂ Â Â Â Â Â |
+------------------------------------*/
AR_RECEIPT_API_PUB.apply_open_receipt
( 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,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_amount_applied => l_amount_applied,
p_receipt_number => l_receipt_number,
p_open_receipt_number => l_open_receipt_number,
x_application_ref_num => l_application_ref_num,
x_receivable_application_id => l_receivable_application_id,
x_applied_rec_app_id => l_applied_rec_app_id,
x_acctd_amount_applied_from => l_acctd_amount_applied_from,
x_acctd_amount_applied_to => l_acctd_amount_applied_to);
/*------------------------------------+
| Error handling             |
+------------------------------------*/
DBMS_OUTPUT.put_line('Return status ' || l_return_status );
DBMS_OUTPUT.put_line('Message count ' || l_msg_count);
DBMS_OUTPUT.put_line('Cash Receipt ID ' || l_cash_receipt_id );
IF l_msg_count = 1 Then
DBMS_OUTPUT.put_line('l_msg_data '||l_msg_data);
ELSIF l_msg_count > 1 Then
LOOP
p_count := p_count+1;
l_msg_data := FND_MSG_PUB.Get(FND_MSG_PUB.G_NEXT,FND_API.G_FALSE);
IF l_msg_data is NULL Then
EXIT;
END IF;
DBMS_OUTPUT.put_line('Message' || p_count ||' ---'||l_msg_data);
END LOOP;
END IF;
COMMIT;
END;
/
I am an Oracle Technical Architect working on Oracle Property Manager.My Expertise includes OA Framework,SOA and OBIEE.
Related Posts:
-
The SQL scripts in this section create and update a note by calling the Create_Noteand Update_Note
496 days ago
-
Here is the sample code with which I created the interaction using the API.This script calls the Cre
496 days ago
relatedArticles
Trackback(0)
