Thursday, April 8, 2010
AR: Reversal of Receipt through API (ar_receipt_api_pub.REVERSE)
Below script will be useful to reverse a receipt.
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_cash_receipt_id NUMBER DEFAULT 1345;
v_gl_date DATE DEFAULT SYSDATE;
v_reversal_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 Receipt reversal api');
/* Invoking Receipt Reverse API */
ar_receipt_api_pub.REVERSE(
p_api_version => 1.0
,p_init_msg_list => FND_API.G_FALSE
,p_commit => FND_API.G_FALSE
,p_validation_level => FND_API.G_VALID_LEVEL_FULL
,x_return_status => v_return_status
,x_msg_count => v_msg_count
,x_msg_data => v_msg_data
,p_cash_receipt_id => v_cash_receipt_id
,p_receipt_number => NULL
,p_reversal_category_code => 'REV'
,p_reversal_category_name => NULL
,p_reversal_gl_date => v_gl_date
,p_reversal_date => v_reversal_date
,p_reversal_reason_code => 'WRONG INVOICE'
,p_reversal_reason_name => NULL
,p_reversal_comments => NULL
,p_called_from => NULL
,p_cancel_claims_flag => 'Y'
,p_org_id => 82
);
IF v_return_status = 'S' THEN
DBMS_OUTPUT.put_line('Receipt Reversal is Sucessful');
ELSE
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 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.
2 Responses to “AR: Reversal of Receipt through API (ar_receipt_api_pub.REVERSE)”
January 3, 2021 at 9:50 AM
Completed with error
March 14, 2022 at 1:52 AM
Thank you! it worked perfectly
Post a Comment