PROCEDURE XX_CRT_MISC_RECEIPT_P (
P_USER_ID NUMBER,
P_RESP_ID NUMBER,
P_ORG_ID NUMBER,
P_RECEIPT_METHOD_ID NUMBER, --41304
P_MAIN_AMT NUMBER,
P_MAIN_CCID NUMBER,
P_SDF_AMT NUMBER,
P_SDF_CCID NUMBER,
P_ACTIVITY_MAIN VARCHAR2, --'Cargo Handling Charges'
P_RECEIPT_DT DATE,
P_GL_DT DATE,
P_IN_COMMENTS VARCHAR2,
P_OUT_RECEIPT_NUMBER OUT VARCHAR2,
P_cash_receipt_id OUT NUMBER,
P_RETURN_STATUS OUT VARCHAR2,
P_MSG_DATA OUT VARCHAR2)
AS
l_return_status VARCHAR2 (100);
l_msg_count NUMBER;
l_msg_data VARCHAR2 (2000);
l_msg_data2 VARCHAR2 (2000);
p_count NUMBER := 0;
L_RECEIPT_NUMBER VARCHAR2 (2000);
l_cash_receipt_id ar_cash_receipts_all.cash_receipt_id%TYPE;
v_receipt_method_id ar_receipt_methods.receipt_method_id%TYPE;
v_receipt_number ar_cash_receipts_all.receipt_number%TYPE;
l_misc_dist_tbl AR_RECEIPT_API_PUB.misc_dist_tbl_type;
l_attribute_rec AR_RECEIPT_API_PUB.attribute_rec_type;
L_TOTAL_AMT NUMBER;
BEGIN
fnd_global.apps_initialize (P_USER_ID,
P_RESP_ID,
222,
0);
mo_global.init ('AR');
mo_global.set_policy_context ('S', P_ORG_ID);
/* == Pass these PARAMETERS to API == */
v_receipt_method_id := P_RECEIPT_METHOD_ID; --41304;
--Header Attributes
l_attribute_rec.ATTRIBUTE5 := '1';
--Distribution Attributes
l_misc_dist_tbl (1).AMOUNT := P_MAIN_AMT;
l_misc_dist_tbl (1).acctd_amount := P_MAIN_AMT;
--l_misc_dist_tbl(1).PERCENT := 40;
l_misc_dist_tbl (1).CODE_COMBINATION_ID := P_MAIN_CCID; --3393498;/*Pass valid code_combination_id*/
l_misc_dist_tbl (2).AMOUNT := P_SDF_AMT;
l_misc_dist_tbl (2).acctd_amount := P_SDF_AMT;
--l_misc_dist_tbl(2).PERCENT := 40;
l_misc_dist_tbl (2).CODE_COMBINATION_ID := P_SDF_CCID; --3412521;
--l_misc_dist_tbl(3).AMOUNT := 200;
--l_misc_dist_tbl(3).acctd_amount := 200;
--l_misc_dist_tbl(3).PERCENT := 20;
--l_misc_dist_tbl(3).CODE_COMBINATION_ID := 12833;
--l_misc_dist_tbl(3).COMMENTS := 'Test';
L_TOTAL_AMT := NVL (P_MAIN_AMT, 0) + NVL (P_SDF_AMT, 0);
AR_RECEIPT_API_PUB.create_misc (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_FALSE,
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 => 'AED',
p_amount => L_TOTAL_AMT,
p_activity => P_ACTIVITY_MAIN,
p_receipt_number => v_receipt_number,
p_receipt_date => P_RECEIPT_DT,
p_gl_date => P_GL_DT,
p_receipt_method_id => v_receipt_method_id,
p_misc_receipt_id => l_cash_receipt_id,
p_misc_dist_tbl => l_misc_dist_tbl,
p_attribute_record => l_attribute_rec,
P_COMMENTS => P_IN_COMMENTS
);
COMMIT;
DBMS_OUTPUT.put_line ('Passed receipt number: ' || v_receipt_number);
P_OUT_RECEIPT_NUMBER := v_receipt_number;
DBMS_OUTPUT.put_line ('l_cash_receipt_id : ' || l_cash_receipt_id);
P_cash_receipt_id := l_cash_receipt_id;
DBMS_OUTPUT.put_line ('l_return_status : ' || l_return_status);
P_RETURN_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;
l_msg_data2 := l_msg_data || '-' || l_msg_data2;
DBMS_OUTPUT.put_line (
'Message' || p_count || ' ---' || l_msg_data);
END LOOP;
END IF;
P_MSG_DATA := l_msg_data2;
END;
DECLARE
-- Declarations
l_P_USER_ID NUMBER;
l_P_RESP_ID NUMBER;
l_P_ORG_ID NUMBER;
l_P_RECEIPT_METHOD_ID NUMBER;
l_P_MAIN_AMT NUMBER;
l_P_MAIN_CCID NUMBER;
l_P_SDF_AMT NUMBER;
l_P_SDF_CCID NUMBER;
l_P_ACTIVITY_MAIN VARCHAR2 (32767);
l_P_RECEIPT_DT DATE;
l_P_GL_DT DATE;
l_P_OUT_RECEIPT_NUMBER VARCHAR2 (32767);
l_P_CASH_RECEIPT_ID NUMBER;
l_P_RETURN_STATUS VARCHAR2 (32767);
l_P_MSG_DATA VARCHAR2 (32767);
BEGIN
-- Initialization
l_P_USER_ID := 2605;
l_P_RESP_ID := 52470;
l_P_ORG_ID := 2352;
l_P_RECEIPT_METHOD_ID := 41304;
l_P_MAIN_AMT := 4900;
l_P_MAIN_CCID := 3393498;
l_P_SDF_AMT := 100;
l_P_SDF_CCID := 3412521;
l_P_ACTIVITY_MAIN := 'Cargo Handling Charges';
l_P_RECEIPT_DT := TO_DATE ('9/1/2023', 'MM/DD/YYYY');
l_P_GL_DT := TO_DATE ('9/1/2023', 'MM/DD/YYYY');
-- Call
XX_CRT_MISC_RECEIPT_P (
P_USER_ID => l_P_USER_ID,
P_RESP_ID => l_P_RESP_ID,
P_ORG_ID => l_P_ORG_ID,
P_RECEIPT_METHOD_ID => l_P_RECEIPT_METHOD_ID,
P_MAIN_AMT => l_P_MAIN_AMT,
P_MAIN_CCID => l_P_MAIN_CCID,
P_SDF_AMT => l_P_SDF_AMT,
P_SDF_CCID => l_P_SDF_CCID,
P_ACTIVITY_MAIN => l_P_ACTIVITY_MAIN,
P_RECEIPT_DT => l_P_RECEIPT_DT,
P_GL_DT => l_P_GL_DT,
P_IN_COMMENTS => 'TEST FROM PLSQL',
P_OUT_RECEIPT_NUMBER => l_P_OUT_RECEIPT_NUMBER,
P_CASH_RECEIPT_ID => l_P_CASH_RECEIPT_ID,
P_RETURN_STATUS => l_P_RETURN_STATUS,
P_MSG_DATA => l_P_MSG_DATA
);
-- Transaction Control
COMMIT;
-- Output values, do not modify
dbms_output.put_line( l_P_OUT_RECEIPT_NUMBER);
dbms_output.put_line(l_P_CASH_RECEIPT_ID);
dbms_output.put_line( l_P_RETURN_STATUS);
dbms_output.put_line( l_P_MSG_DATA);
END;
No comments:
Post a Comment