100% found this document useful (1 vote)
255 views2 pages

Incomplete An Invoice

This document contains PL/SQL code that sets the application context, locks a transaction, calls an API to set a transaction to incomplete, and handles the response. It locks a transaction with ID 347006177, calls an API to set it incomplete, and either commits, rolls back, or handles exceptions based on the return status and messages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
255 views2 pages

Incomplete An Invoice

This document contains PL/SQL code that sets the application context, locks a transaction, calls an API to set a transaction to incomplete, and handles the response. It locks a transaction with ID 347006177, calls an API to set it incomplete, and either commits, rolls back, or handles exceptions based on the return status and messages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

SET SERVEROUTPUT ON SIZE 100000;

DECLARE
l_customer_trx_id NUMBER := 347006177;
o_return_status VARCHAR2 (1);
o_msg_count NUMBER;
o_msg_data VARCHAR2 (2000);
l_err_msg VARCHAR2 (1000);
l_msg_index_out NUMBER;
v_user NUMBER := 0;
v_res VARCHAR2 (4000) := NULL;
v_app VARCHAR2 (4000) := NULL;
BEGIN

----------------------------------------------------------------------
---- Setting the org context for the particular session
apps.mo_global.set_policy_context ('S', 128);

SELECT application_id, responsibility_id


INTO v_app, v_res
FROM fnd_responsibility_tl
WHERE responsibility_id = 50542;

---- Setting the oracle applications context for the particular session
apps.fnd_global.apps_initialize (v_user, v_res, v_app);
----------------------------------------------------------------------

arp_trx_util.lock_transaction(l_customer_trx_id);

ar_transaction_grp.incomplete_transaction (p_api_version => 1.0


,p_init_msg_list => fnd_api.g_false
,p_commit => fnd_api.g_true
,p_customer_trx_id => l_customer_trx_id
,x_return_status => o_return_status
,x_msg_count => o_msg_count
,x_msg_data => o_msg_data);

dbms_output.put_line ('********************************');

IF o_return_status = fnd_api.g_ret_sts_error
OR o_return_status = fnd_api.g_ret_sts_unexp_error THEN
dbms_output.put_line ('O_RETURN_STATUS = ' || o_return_status);
dbms_output.put_line ('O_MSG_COUNT = ' || o_msg_count);

IF o_msg_count > 0 THEN


FOR v_index IN 1 .. o_msg_count
LOOP
fnd_msg_pub.get (p_msg_index => v_index
,p_encoded => 'F'
,p_data => o_msg_data
,p_msg_index_out => l_msg_index_out);
o_msg_data := substr (o_msg_data, 1, 3950);
END LOOP;

dbms_output.put_line ('O_MSG_DATA = ' || o_msg_data);


END IF;
rollback;
ELSE
dbms_output.put_line ('Customer Trx id: ' || l_customer_trx_id);
dbms_output.put_line ('Return Status: ' || o_return_status);
dbms_output.put_line ('AR Transaction has been setted to incomplete successfully');
commit;
END IF;

dbms_output.put_line ('********************************');
EXCEPTION
WHEN OTHERS THEN
l_err_msg := substr (sqlerrm, 0, 1000);
dbms_output.put_line ('***************************');
dbms_output.put_line ('There is an exception has been raised from API with the
following error message: ' || l_err_msg);
dbms_output.put_line ('***************************');
END;
/

You might also like