Tuesday 18 September 2012

Advanced Collections APIS Scripts

--------------------------
Create Dispute
---------------------------
DECLARE
i_dispute_rec_tbl IN disputes_rec_tbl_type
BEGIN
FOR proc_dispute IN i_dispute_rec_tbl.FIRST .. i_dispute_rec_tbl.LAST
LOOP
BEGIN
IF i_dispute_rec_tbl (proc_dispute).status = 'S'
THEN
l_disp_header_rec.cust_trx_id :=i_dispute_rec_tbl (proc_dispute).trx_id;
l_disp_header_rec.line_credit_flag := 'N';
l_disp_header_rec.line_amt := i_dispute_rec_tbl (proc_dispute).line_amt;
l_disp_header_rec.tax_amt := i_dispute_rec_tbl (proc_dispute).tax_amt;
l_disp_header_rec.freight_amt := 0;
l_disp_header_rec.cm_reason_code :=i_dispute_rec_tbl (proc_dispute).dispute_code;
l_disp_header_rec.comments :=i_dispute_rec_tbl (proc_dispute).comments;
l_disp_header_rec.delinquency_id := i_dispute_rec_tbl (proc_dispute).delinquency_id;
l_disp_header_rec.dispute_section := 'TOTAL';
iex_dispute_pub.create_dispute
(p_api_version => 1.0,
p_init_msg_list => 'T',
p_commit => 'F',
p_disp_header_rec => l_disp_header_rec,
p_disp_line_tbl => l_disp_line_tbl,
x_request_id => o_request_id,
x_return_status => o_return_status,
x_msg_count => o_msg_count,
x_msg_data => o_msg_data
);
END LOOP;
END;

---------
Promise

---------

DECLARE
i_promise_rec_tbl IN promise_rec_tbl_type
BEGIN
FOR proc_promise IN
i_promise_rec_tbl.FIRST .. i_promise_rec_tbl.LAST
LOOP
BEGIN
IF i_promise_rec_tbl (proc_promise).status = 'S'
THEN
l_promise_rec.promise_amount :=i_promise_rec_tbl (proc_promise).promise_amount;
l_promise_rec.currency_code := i_promise_rec_tbl (proc_promise).inv_curr_code;
l_promise_rec.promise_date := SYSDATE + 7;
l_promise_rec.promise_target := 'INVOICES';
l_promise_rec.cust_account_id :=i_promise_rec_tbl (proc_promise).cust_acct_id;
l_promise_rec.delinquency_id :=i_promise_rec_tbl (proc_promise).delinquency_id;
l_promise_rec.taken_by_resource_id := i_resource_id;
---l_promise_rec.promise_payment_method :='CC';
l_promise_rec.note :=i_promise_rec_tbl (proc_promise).notes;
l_promise_rec.promised_by_party_org_id :=i_promise_rec_tbl (proc_promise).party_id;
iex_promises_pub.insert_promise
(p_api_version => 1.0,
p_init_msg_list => 'T',
p_commit => 'F',
p_validation_level => fnd_api.g_valid_level_full,
x_return_status => o_return_status,
x_msg_count => o_msg_count,
x_msg_data => o_msg_data,
p_promise_rec => l_promise_rec,
x_proresp_rec => o_proresp_rec
);
END LOOP;
END;

--------------------
Task
--------------------

DECLARE
i_tasks_rec_tbl IN tasks_rec_result_tbl_type
BEGIN
FOR proc_task IN i_tasks_rec_tbl.FIRST .. i_tasks_rec_tbl.LAST
LOOP
BEGIN
IF i_tasks_rec_tbl (proc_task).status = 'S'
THEN
jtf_tasks_pub.create_task
(p_api_version => 1.0,
p_init_msg_list => 'T',
p_commit => 'F',
p_task_name => 'Callback',
p_task_type_name => 'Callback',
p_task_type_id => 3,
p_description => i_tasks_rec_tbl(proc_task).task_description,
p_task_status_name => 'Open',
p_task_status_id => 10,
p_task_priority_name => 'Medium',
p_task_priority_id => 3,
p_owner_type_name => 'Employee Resource',
p_owner_type_code => 'RS_EMPLOYEE',
p_owner_id => i_tasks_rec_tbl(proc_task).resource_id,
p_customer_id => i_tasks_rec_tbl(proc_task).party_id,
p_assigned_by_name => fnd_global.user_name,
p_assigned_by_id => fnd_global.user_id,
p_planned_start_date => SYSDATE,
p_scheduled_start_date => SYSDATE,
p_source_object_type_code => 'IEX_ACCOUNT',
p_source_object_id => i_tasks_rec_tbl(proc_task).site_use_id,
p_source_object_name => i_tasks_rec_tbl(proc_task).account_number,
x_return_status => o_return_status,
x_msg_count => o_msg_count,
x_msg_data => o_msg_data,
x_task_id => o_task_id
);
END LOOP;
END;

-----------------------
Notes

-----------------------

DECLARE
i_notes_rec_tbl IN notes_rec_tbl_type
BEGIN
FOR proc_note IN i_notes_rec_tbl.FIRST .. i_notes_rec_tbl.LAST
LOOP
BEGIN
IF i_notes_rec_tbl (proc_note).trx_type = 'SR'
THEN
l_context_type := 'IEX_PAYMENT';
l_count := 1;
l_jtf_note_contexts_tab (l_count).note_context_type :=l_context_type;
l_jtf_note_contexts_tab (l_count).note_context_type_id :=i_notes_rec_tbl (proc_note).source_object_id;
l_jtf_note_contexts_tab (l_count).last_update_date := SYSDATE;
l_jtf_note_contexts_tab (l_count).creation_date := SYSDATE;
l_jtf_note_contexts_tab (l_count).last_updated_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).created_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).last_update_login :=
fnd_profile.VALUE ('LOGIN_ID');
l_count := 2;
l_jtf_note_contexts_tab (l_count).note_context_type :=
'IEX_ACCOUNT';
l_jtf_note_contexts_tab (l_count).note_context_type_id :=
i_notes_rec_tbl (proc_note).acct_id;
l_jtf_note_contexts_tab (l_count).last_update_date :=
SYSDATE;
l_jtf_note_contexts_tab (l_count).creation_date :=
SYSDATE;
l_jtf_note_contexts_tab (l_count).last_updated_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).created_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).last_update_login :=
fnd_profile.VALUE ('LOGIN_ID');
l_count := 3;
l_jtf_note_contexts_tab (l_count).note_context_type :=
'IEX_BILLTO';
l_jtf_note_contexts_tab (l_count).note_context_type_id :=
i_notes_rec_tbl (proc_note).site_id;
l_jtf_note_contexts_tab (l_count).last_update_date :=
SYSDATE;
l_jtf_note_contexts_tab (l_count).creation_date :=
SYSDATE;
l_jtf_note_contexts_tab (l_count).last_updated_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).created_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).last_update_login :=
fnd_profile.VALUE ('LOGIN_ID');
ELSE
l_context_type := 'IEX_INVOICES';
l_count := 1;
l_jtf_note_contexts_tab (l_count).note_context_type :=
l_context_type;
l_jtf_note_contexts_tab (l_count).note_context_type_id :=
i_notes_rec_tbl (proc_note).source_object_id;
l_jtf_note_contexts_tab (l_count).last_update_date :=
SYSDATE;
l_jtf_note_contexts_tab (l_count).creation_date :=
SYSDATE;
l_jtf_note_contexts_tab (l_count).last_updated_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).created_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).last_update_login :=
fnd_profile.VALUE ('LOGIN_ID');
l_count := 2;
l_jtf_note_contexts_tab (l_count).note_context_type :=
'IEX_ACCOUNT';
l_jtf_note_contexts_tab (l_count).note_context_type_id :=
i_notes_rec_tbl (proc_note).acct_id;
l_jtf_note_contexts_tab (l_count).last_update_date :=
SYSDATE;
l_jtf_note_contexts_tab (l_count).creation_date :=
SYSDATE;
l_jtf_note_contexts_tab (l_count).last_updated_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).created_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).last_update_login :=
fnd_profile.VALUE ('LOGIN_ID');
l_count := 3;
l_jtf_note_contexts_tab (l_count).note_context_type :=
'IEX_BILLTO';
l_jtf_note_contexts_tab (l_count).note_context_type_id :=
i_notes_rec_tbl (proc_note).site_id;
l_jtf_note_contexts_tab (l_count).last_update_date :=
SYSDATE;
l_jtf_note_contexts_tab (l_count).creation_date :=
SYSDATE;
l_jtf_note_contexts_tab (l_count).last_updated_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).created_by :=
fnd_profile.VALUE ('USER_ID');
l_jtf_note_contexts_tab (l_count).last_update_login :=
fnd_profile.VALUE ('LOGIN_ID');
END IF;
jtf_notes_pub.create_note
(p_api_version => 1.0,
p_init_msg_list => 'T',
p_commit => 'F',
x_return_status => o_return_status,
x_msg_count => o_msg_count,
x_msg_data => o_msg_data,
p_org_id => i_org_id,
p_source_object_id => i_notes_rec_tbl
(proc_note).source_object_id,
p_source_object_code => l_context_type,
p_notes => i_notes_rec_tbl
(proc_note).notes,
x_jtf_note_id => o_jtf_note_id,
p_note_type => 'ASF_CALLBACK',
p_jtf_note_contexts_tab => l_jtf_note_contexts_tab
);
END LOOP;
END;

No comments:

Post a Comment