Below script is used to create a miscellaneous cash receipt using the API AR_RECEIPT_API_PUB.CREATE_MISC in R12 oracle apps.
TEST INSTANCE: R12.1.1
SCRIPT:
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_receipt_number VARCHAR (100) DEFAULT 'SHAREORACLEAPPS';
v_context VARCHAR2 (10);
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
DBMS_OUTPUT.put_line ('1');
--1. Set applications context if not already set.
v_context := set_context ('&username', '&resp_name', '&org_id');
IF v_context = 'F'
THEN
DBMS_OUTPUT.put_line ('Error while setting the context');
END IF;
DBMS_OUTPUT.put_line ('2');
mo_global.init ('AR');
BEGIN
ar_receipt_api_pub.create_misc
(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_currency_code => 'USD',
p_amount => 500,
p_receipt_date => SYSDATE,
p_gl_date => SYSDATE,
p_receipt_method_id => 8002,
p_activity => 'Miscellaneous Cash',
p_misc_receipt_id => l_cash_receipt_id,
p_receipt_number => l_receipt_number
);
DBMS_OUTPUT.put_line ('Message count ' || l_msg_count);
DBMS_OUTPUT.put_line ('Cash Receipt ID ' || l_cash_receipt_id);
DBMS_OUTPUT.put_line ('Status ' || l_return_status);
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;
END;
END;
Queries Used:
SELECT *
FROM ar_receivables_trx_all
WHERE NAME = 'Miscellaneous Cash';
SELECT *
FROM ar_receipt_methods
WHERE receipt_class_id = 8002;
SELECT *
FROM ar_cash_receipts_all
WHERE cash_receipt_id = '1991';
No comments:
Post a Comment