Monday, January 31, 2011
Below script will be useful to unapply on account a receipt using the API AR_RECEIPT_API_PUB.Unapply_on_account
This script is tested in R12.1.1 instance
SCRIPT:
set serveroutput on;
DECLARE
v_return_status VARCHAR2(1);
v_msg_count NUMBER;
v_msg_data VARCHAR2(240);
v_count NUMBER;
v_receipt_number VARCHAR2(240) := 'SHAREORACLEAPPS';
v_reversal_gl_date DATE := SYSDATE;
v_org_id NUMBER := 93;
p_count NUMBER;
v_context VARCHAR2(100);
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
--1. Set applications context if not already set.
v_context := set_context('&user_id','&responsibility',&org_id);
IF v_context = 'F'
THEN
DBMS_OUTPUT.PUT_LINE('Error while setting the context');
END IF;
MO_GLOBAL.init('AR');
AR_RECEIPT_API_PUB.Unapply_on_account
( 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 => v_return_status,
x_msg_count => v_msg_count,
x_msg_data => v_msg_data,
p_receipt_number => v_receipt_number,
p_reversal_gl_date => v_reversal_gl_date,
p_org_id => v_org_id
);
IF v_return_status = 'S' THEN
DBMS_OUTPUT.put_line('Receipt Unapply on account is Sucessful :');
ELSE
DBMS_OUTPUT.put_line('Message count ' || v_msg_count);
IF v_msg_count = 1 THEN
DBMS_OUTPUT.put_line('v_msg_data '||v_msg_data);
ELSIF v_msg_count > 1 THEN
LOOP
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;
/
Monday, January 31, 2011 by Team search · 0
Below script will be useful to create a receipt and apply on account.
This script is tested in R12.1.1 instance
SCRIPT:
set serveroutput on
DECLARE
v_return_status VARCHAR2(1);
v_msg_count NUMBER;
v_msg_data VARCHAR2(240);
v_count NUMBER;
v_cash_receipt_id NUMBER;
v_msg_data_out VARCHAR2(240);
v_mesg VARCHAR2(240);
p_count NUMBER;
v_currency_code VARCHAR2(5);
v_amount NUMBER;
v_receipt_number VARCHAR2(30);
v_receipt_date DATE;
v_gl_date DATE;
v_customer_number VARCHAR2(30);
v_receipt_method_id NUMBER;
v_org_id NUMBER;
v_context VARCHAR2(100);
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
-- Set applications context if not already set.
v_context := set_context('&userid','&responsibility',&org_id);
IF v_context = 'F'
THEN
DBMS_OUTPUT.PUT_LINE('Error while setting the context');
END IF;
MO_GLOBAL.init('AR');
-- Initialising the input parameters
v_currency_code := 'GBP';
v_amount := 100;
v_receipt_number := 'SHAREORACLEAPPS';
v_receipt_date := TRUNC(SYSDATE);
v_gl_date := TRUNC(SYSDATE);
v_customer_number := '5490';
v_receipt_method_id := 2008;
v_org_id := 93;
AR_RECEIPT_API_PUB.Create_Apply_on_acc
( 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 => v_return_status,
x_msg_count => v_msg_count,
x_msg_data => v_msg_data,
p_currency_code => v_currency_code,
p_amount => v_amount,
p_receipt_number => v_receipt_number,
p_receipt_date => v_receipt_date,
p_gl_date => v_gl_date,
p_customer_number => v_customer_number,
p_receipt_method_id => v_receipt_method_id,
p_org_id => v_org_id,
p_cr_id => v_cash_receipt_id
);
IF v_return_status = 'S' THEN
DBMS_OUTPUT.put_line('Receipt Creation and apply on account is Sucessful :'||v_cash_receipt_id);
ELSE
DBMS_OUTPUT.put_line('Message count ' || v_msg_count);
IF v_msg_count = 1 THEN
DBMS_OUTPUT.put_line('v_msg_data '||v_msg_data);
ELSIF v_msg_count > 1 THEN
LOOP
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;
/
by Team search · 0
Subscribe to:
Posts (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.