--收款注销 Tony环境实现 20190703
DECLARE
l_org_id NUMBER;
x_return_status VARCHAR2(60);
x_msg_count NUMBER;
g_pkg_name VARCHAR2(60) := 'cux_test_scripts';
g_api_type VARCHAR2(60) := 'cux_test_scripts';
x_msg_data VARCHAR2(32676);
l_api_name CONSTANT VARCHAR2(30) := 'act_app_prc';
l_api_version CONSTANT NUMBER := 1.0;
l_receivable_application_id NUMBER;
l_attribute_rec ar_receipt_api_pub.attribute_rec_type;
l_global_att_rec ar_receipt_api_pub.global_attribute_rec_type;
l_application_ref_type ar_receivable_applications.application_ref_type%TYPE;
l_application_ref_id ar_receivable_applications.application_ref_id%TYPE;
l_application_ref_num ar_receivable_applications.application_ref_num%TYPE;
l_secondary_application_ref_id ar_receivable_applications.secondary_application_ref_id%TYPE;
/* CURSOR receipts_cur IS
SELECT cr.cash_receipt_id,
cr.currency_code,
cux_ar_sd_daily_report_utl.get_cash_unapp_amount(cr.cash_receipt_id) cash_unapp_amount,
cr.org_id,
cr.pay_from_customer customer_id,
cr.customer_site_use_id
FROM ar_cash_receipts cr;*/
l_amount NUMBER;
l_app_amount NUMBER;
l_cash_sum NUMBER;
BEGIN
fnd_msg_pub.initialize;
l_org_id := 82;
mo_global.set_policy_context(p_access_mode => 'S', p_org_id => l_org_id);
fnd_global.apps_initialize(user_id => 1110,
resp_id => 50597,
resp_appl_id => 20003);
mo_global.set_policy_context(p_access_mode => 'S', p_org_id => l_org_id);
l_amount := 1;
l_app_amount := 1;
ar_receipt_api_pub.activity_application(p_api_version => 1.0,
p_commit => fnd_api.g_false,
p_validation_level => fnd_api.g_valid_level_full,
p_cash_receipt_id => 1025, --注销收款的收款id
p_amount_applied => l_app_amount,
p_applied_payment_schedule_id => -3,
p_receivables_trx_id => 1004,--AR_RECEIVABLES_TRX_ALL 表的主键
p_apply_date => SYSDATE,
p_apply_gl_date => SYSDATE,
p_application_ref_type => l_application_ref_type,
p_application_ref_id => l_application_ref_id,
p_application_ref_num => l_application_ref_num,
p_secondary_application_ref_id => l_secondary_application_ref_id,
p_attribute_rec => l_attribute_rec,
p_global_attribute_rec => l_global_att_rec,
p_receivable_application_id => l_receivable_application_id,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data);
dbms_output.put_line('x_return_status:' || x_return_status);
dbms_output.put_line('l_receivable_application_id:' ||
l_receivable_application_id);
IF (x_return_status <> 'S') THEN
RAISE fnd_api.g_exc_error;
END IF;
EXCEPTION
WHEN fnd_api.g_exc_error THEN
dbms_output.put_line('g_exc_errorx:');
dbms_output.put_line('FND_MSG_BUG:' || fnd_msg_pub.get_detail(1, 'F'));
WHEN OTHERS THEN
dbms_output.put_line('others_exception:');
dbms_output.put_line('FND_MSG_BUG:' || fnd_msg_pub.get_detail(1, 'F'));
END;