DECLARE
CURSOR c1
IS
SELECT batch_id, actual_cmplt_date, batch_close_date
FROM gme_batch_header
WHERE batch_status = 4;
l_batch_header_rec gme_batch_header%ROWTYPE;
x_batch_header_rec gme_batch_header%ROWTYPE;
x_message_count NUMBER := 0;
x_message_list VARCHAR2 (4000) := NULL;
x_return_status VARCHAR2 (1) := 'U';
l_msg_index_out NUMBER := 0;
mtl_line_exc EXCEPTION;
BEGIN
FOR r1 IN c1
LOOP
fnd_global.apps_initialize (user_id => 1114,
resp_id => 23326,
resp_appl_id => 552
);
l_batch_header_rec.batch_id := r1.batch_id;
gme_api_pub.reopen_batch (p_commit => 'TRUE',
x_message_count => x_message_count,
x_message_list => x_message_list,
x_return_status => x_return_status,
p_batch_header_rec => l_batch_header_rec,
p_org_code => NULL,
x_batch_header_rec => x_batch_header_rec
);
COMMIT;
DBMS_OUTPUT.put_line (x_return_status);
IF x_return_status = fnd_api.g_ret_sts_success
THEN
COMMIT;
ELSE
IF x_message_count = 1
THEN
RAISE mtl_line_exc;
ELSE
FOR j IN 1 .. x_message_count
LOOP
fnd_msg_pub.get (p_msg_index => j,
p_encoded => 'F',
p_data => x_message_list,
p_msg_index_out => l_msg_index_out
);
RAISE mtl_line_exc;
DBMS_OUTPUT.put_line (x_message_list);
END LOOP;
END IF;
END IF;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (x_return_status);
DBMS_OUTPUT.put_line (x_message_list);
END;
No comments:
Post a Comment