DECLARE
CURSOR c1
IS
SELECT batch_id, SYSDATE - 1 actual_cmplt_date,
SYSDATE - 1 batch_close_date
FROM gme_batch_header
WHERE batch_status = 3;
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;
l_exception_material_tbl gme_common_pvt.exceptions_tab;
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;
l_batch_header_rec.batch_close_date := r1.batch_close_date;
gme_api_pub.close_batch
(p_api_version => 2.0,
p_validation_level => apps.gme_common_pvt.g_max_errors,
p_init_msg_list => apps.fnd_api.g_true,
p_commit => apps.fnd_api.g_false,
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,
x_batch_header_rec => x_batch_header_rec,
p_org_code => NULL
);
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