DECLARE
v_msg_count NUMBER;
v_msg_data VARCHAR2 (2000);
v_return_status VARCHAR2 (1);
V_REQUEST_ID
number;
BEGIN
fnd_global.apps_initialize (user_id => 1234,
resp_id => 113,
resp_appl_id => 222
);
mo_global.init
('AR');
mo_global.set_policy_context ('S', 204);
ar_credit_memo_api_pub.create_request
(
-- standard api parameters
p_api_version
=> 1.0,
p_init_msg_list
=> fnd_api.g_true,
p_commit => fnd_api.g_true,
x_return_status
=> v_return_status,
x_msg_count
=> v_msg_count,
x_msg_data => v_msg_data,
-- credit memo request parameters
p_customer_trx_id => 12345, -- TRX_ID of invoice to be cancelled
p_line_credit_flag => 'N',
p_line_amount
=> -24500,
p_tax_amount
=> 0,
p_cm_reason_code
=> 'CANCELLATION',
p_skip_workflow_flag
=> 'Y',
p_batch_source_name
=> 'Premium_Invoices_Imported',
p_credit_method_installments => NULL,
p_credit_method_rules
=> NULL,
--p_cust_trx_type_id =>
1000,
x_request_id => v_request_id
);
IF v_return_status =
fnd_api.g_ret_sts_unexp_error
OR
v_return_status = fnd_api.g_ret_sts_error
THEN
DBMS_OUTPUT.put_line (v_msg_data);
END IF;
IF v_msg_count
> 1
THEN
v_msg_count
:= 0;
LOOP
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 (v_msg_data);
END LOOP;
END IF;
IF
v_return_status = fnd_api.g_ret_sts_success
THEN
DBMS_OUTPUT.put_line (v_msg_data);
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error in Crea_cm:' || SQLERRM);
END;
No comments:
Post a Comment