Terminate API is used to terminate a contract/line/subline with various
options like suppress credit, full credit or with some override amount.
DECLARE
l_return_status VARCHAR2 (100);
l_date_term DATE;
L_MSG_DATA VARCHAR2 (1000);
l_msg_count NUMBER;
l_msg_index_out NUMBER;
l_user_id NUMBER;
l_resp_id NUMBER;
l_resp_appl_id NUMBER;
BEGIN
BEGIN
SELECT user_id
INTO l_user_id
FROM fnd_user
WHERE user_name = 'XXUSER';
END;
BEGIN
SELECT responsibility_id, application_id
INTO l_resp_id, l_resp_appl_id
FROM fnd_responsibility_tl
WHERE responsibility_name = 'Service Contracts Manager'
and application_id = 515 ; --Service Contracts
END;
fnd_global.apps_initialize (user_id => l_user_id,
resp_id => l_resp_id,
resp_appl_id => l_resp_appl_id
);
okc_context.set_okc_org_context (p_chr_id => 12345678);
oks_terminate_contract_pub.Terminate_Contract(
p_contract_id => 12345678,
p_line_id => NULL,
p_subline_id => NULL,
P_Termination_Date => TO_DATE ('01-SEP-2017'),
p_fullcredit_yn => 'N', --Indicates if full credit has to be given during termination and default value is ‘N’
p_suppress_credit_yn => 'N', --Indicates if credit has to be suppressed during termination and default value is ‘N’
p_term_reason_code => 'BRE',
p_override_amount => NULL,
x_return_status => l_return_status);
DBMS_OUTPUT.put_line ('l_return_status - ' || l_return_status);
IF l_return_status = 'S'
THEN
COMMIT;
END IF;
IF l_return_status <> 'S'
THEN
FOR i IN 1 .. fnd_msg_pub.count_msg
LOOP
fnd_msg_pub.get (p_msg_index => i,
p_encoded => 'T',
p_data => l_msg_data,
p_msg_index_out => l_msg_index_out);
fnd_message.set_encoded (l_msg_data);
l_msg_data := fnd_message.get;
DBMS_OUTPUT.put_line (l_msg_data);
END LOOP;
END IF;
END;
Note:-
P_contract_id --> Contract Header Id
Line Id --> Contract Line Id
P_subline_id --> Contract Subline Id
P_termination_date --> Termination Date
p_fullcredit_yn --> Indicates if full credit has to be given during termination and default value is ‘N’
p_suppress_credit_yn --> Indicates if credit has to be suppressed during termination and default value is ‘N’
p_term_reason_code --> Termination Reason
p_override_amount --> Override Amount
DECLARE
l_return_status VARCHAR2 (100);
l_date_term DATE;
L_MSG_DATA VARCHAR2 (1000);
l_msg_count NUMBER;
l_msg_index_out NUMBER;
l_user_id NUMBER;
l_resp_id NUMBER;
l_resp_appl_id NUMBER;
BEGIN
BEGIN
SELECT user_id
INTO l_user_id
FROM fnd_user
WHERE user_name = 'XXUSER';
END;
BEGIN
SELECT responsibility_id, application_id
INTO l_resp_id, l_resp_appl_id
FROM fnd_responsibility_tl
WHERE responsibility_name = 'Service Contracts Manager'
and application_id = 515 ; --Service Contracts
END;
fnd_global.apps_initialize (user_id => l_user_id,
resp_id => l_resp_id,
resp_appl_id => l_resp_appl_id
);
okc_context.set_okc_org_context (p_chr_id => 12345678);
oks_terminate_contract_pub.Terminate_Contract(
p_contract_id => 12345678,
p_line_id => NULL,
p_subline_id => NULL,
P_Termination_Date => TO_DATE ('01-SEP-2017'),
p_fullcredit_yn => 'N', --Indicates if full credit has to be given during termination and default value is ‘N’
p_suppress_credit_yn => 'N', --Indicates if credit has to be suppressed during termination and default value is ‘N’
p_term_reason_code => 'BRE',
p_override_amount => NULL,
x_return_status => l_return_status);
DBMS_OUTPUT.put_line ('l_return_status - ' || l_return_status);
IF l_return_status = 'S'
THEN
COMMIT;
END IF;
IF l_return_status <> 'S'
THEN
FOR i IN 1 .. fnd_msg_pub.count_msg
LOOP
fnd_msg_pub.get (p_msg_index => i,
p_encoded => 'T',
p_data => l_msg_data,
p_msg_index_out => l_msg_index_out);
fnd_message.set_encoded (l_msg_data);
l_msg_data := fnd_message.get;
DBMS_OUTPUT.put_line (l_msg_data);
END LOOP;
END IF;
END;
Note:-
P_contract_id --> Contract Header Id
Line Id --> Contract Line Id
P_subline_id --> Contract Subline Id
P_termination_date --> Termination Date
p_fullcredit_yn --> Indicates if full credit has to be given during termination and default value is ‘N’
p_suppress_credit_yn --> Indicates if credit has to be suppressed during termination and default value is ‘N’
p_term_reason_code --> Termination Reason
p_override_amount --> Override Amount
No comments:
Post a Comment