Thursday, April 8, 2010
AR: Unapplication of a Credit Memo through API (ar_cm_api_pub.unapply_on_account)
Below script will be useful to unapply a credit transaction against a invoice.
This script is tested in R12.1.1 instance
SET serveroutput ON;
DECLARE
-- This script has been tested in R12.1.1 instance --
v_return_status VARCHAR2(1);
p_count NUMBER;
v_msg_count NUMBER;
v_msg_data VARCHAR2(2000);
v_cm_unapp_rec AR_CM_API_PUB.CM_UNAPP_REC_TYPE;
v_cm_id NUMBER(15) DEFAULT 1605;
v_inv_id NUMBER(15) DEFAULT 1604;
v_gl_date DATE DEFAULT SYSDATE;
v_context VARCHAR2(2);
FUNCTION set_context( i_user_name IN VARCHAR2
,i_resp_name IN VARCHAR2
,i_org_id IN NUMBER)
RETURN VARCHAR2
IS
BEGIN
NULL;
-- Inorder to reduce the content of the post I moved the implementation part of this function to another post and it is available here
END set_context;
BEGIN
-- Setting the context ----
v_context := set_context('&user','&Responsibility',82);
IF v_context = 'F'
THEN
DBMS_OUTPUT.PUT_LINE('Error while setting the context');
END IF;
DBMS_OUTPUT.PUT_LINE('2');
--- context done ------------
DBMS_OUTPUT.PUT_LINE('Invoking unapplication api');
v_cm_unapp_rec.cm_customer_trx_id :=v_cm_id;
v_cm_unapp_rec.inv_customer_trx_id :=v_inv_id;
v_cm_unapp_rec.reversal_gl_date :=v_gl_date;
/* Invoking credit memo unapplication api */
ar_cm_api_pub.unapply_on_account(
p_api_version => 1.0
,p_init_msg_list => FND_API.G_FALSE
,p_commit => FND_API.G_FALSE
,p_cm_unapp_rec => v_cm_unapp_rec
,x_return_status => v_return_status
,x_msg_count => v_msg_count
,x_msg_data => v_msg_data
);
DBMS_OUTPUT.put_line('Message count ' || v_msg_count);
IF v_msg_count = 1 THEN
DBMS_OUTPUT.put_line('l_msg_data '||v_msg_data);
ELSIF v_msg_count > 1 THEN
p_count := p_count+1;
v_msg_data := FND_MSG_PUB.Get(FND_MSG_PUB.G_NEXT,FND_API.G_FALSE);
IF v_msg_data IS NULL THEN
EXIT;
END IF;
DBMS_OUTPUT.put_line('Message' || p_count ||' ---'||v_msg_data);
END LOOP ;
END IF;
END;
Do you think this Article is useful?
Subscribe to:
Post Comments (Atom)
Disclaimer
The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.
0 Responses to “AR: Unapplication of a Credit Memo through API (ar_cm_api_pub.unapply_on_account)”
Post a Comment