SET SERVEROUTPUT ON;
DECLARE
v_msg_data VARCHAR2 (4000);
p_header_id OE_ORDER_HEADERS_ALL.HEADER_ID%TYPE := 40750464;
p_line_id OE_ORDER_LINES_ALL.LINE_ID%TYPE := 48876396;
l_cnt NUMBER (10) := 0;
p_user_id FND_USER.USER_ID%TYPE := 66982; --127903; --66982;
p_resp_id FND_RESPONSIBILITY.RESPONSIBILITY_ID%TYPE := 52434; --52434; --50609; --52434;
p_resp_appl_id FND_RESPONSIBILITY.APPLICATION_ID%TYPE := 660;
p_org_id oe_order_lines_all.ORG_ID%TYPE := 149;
p_hold_id OE_HOLD_DEFINITIONS.hold_id%TYPE := 3026; --:= getHoldId;
p_error_msg VARCHAR2 (1000);
p_status VARCHAR2 (1);
l_act_status BOOLEAN := FALSE;
l_order_tbl OE_HOLDS_PVT.order_tbl_type;
l_return_status VARCHAR2 (100);
l_msg_data VARCHAR2 (4000);
l_msg_count NUMBER;
X_DEBUG_FILE VARCHAR2 (1000);
l_msg_index_out NUMBER (10);
BEGIN
DBMS_OUTPUT.enable (10000);
/* Setting the org context for the particular session */
DBMS_OUTPUT.PUT_LINE (
'MO_GLOBAL.get_current_org_id:-1' || MO_GLOBAL.get_current_org_id);
fnd_global.apps_initialize (user_id => p_user_id,
resp_id => p_resp_id,
resp_appl_id => p_resp_appl_id);
DBMS_OUTPUT.PUT_LINE (
'MO_GLOBAL.get_current_org_id:-2' || MO_GLOBAL.get_current_org_id);
mo_global.init ('ONT');
DBMS_OUTPUT.PUT_LINE (
'MO_GLOBAL.get_current_org_id:-3' || MO_GLOBAL.get_current_org_id);
mo_global.set_policy_context ('S', p_org_id);
DBMS_OUTPUT.PUT_LINE (
'MO_GLOBAL.get_current_org_id:-4' || MO_GLOBAL.get_current_org_id);
--oe_debug_pub.setdebuglevel (5);
oe_msg_pub.initialize;
DBMS_OUTPUT.PUT_LINE (
'MO_GLOBAL.get_current_org_id:-5' || MO_GLOBAL.get_current_org_id);
l_order_tbl (1).header_id := p_header_id;
l_order_tbl (1).line_id := p_line_id;
OE_Holds_PUB.Release_Holds (
p_api_version => 1.0,
p_order_tbl => l_order_tbl,
p_hold_id => p_hold_id,
p_release_reason_code => 'VALID_REASON_CODE',
p_release_comment => 'Released by anonymous block',
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data);
-- Check the return status
IF l_return_status = FND_API.G_RET_STS_SUCCESS
THEN
p_status := 'S';
COMMIT;
DBMS_OUTPUT.PUT_LINE ('successfully completed');
ELSE
DBMS_OUTPUT.PUT_LINE ('failure:' || l_msg_count);
DBMS_OUTPUT.PUT_LINE ('failure:' || l_return_status);
IF (fnd_msg_pub.count_msg > 0)
THEN
FOR i IN 1 .. fnd_msg_pub.count_msg
LOOP
fnd_msg_pub.get (p_msg_index => i,
p_encoded => 'F',
p_data => L_msg_data,
p_msg_index_out => L_msg_count);
DBMS_OUTPUT.PUT_LINE ('API ERROR: ' || L_msg_data);
END LOOP;
DBMS_OUTPUT.put_line ( -- x_jtf_note_id
L_msg_count || '--' || L_msg_data);
END IF;
ROLLBACK;
END IF;
--DBMS_OUTPUT.PUT_LINE ('err1:' || l_msg_data);
EXCEPTION
WHEN OTHERS
THEN
--p_error_msg:=SUBSTR (SQLERRM, 1, 300);
DBMS_OUTPUT.PUT_LINE ('err2:' || SQLERRM);
END;
No comments:
Post a Comment