PROCEDURE autopost(p_set_of_books_id IN NUMBER,
p_je_batch_id IN NUMBER DEFAULT NULL,
p_je_source_name IN VARCHAR2,
p_je_category_name IN VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2) IS
l_api_name CONSTANT VARCHAR2(100) := 'Autopost';
l_gl_access_set_id NUMBER := fnd_profile.value('GL_ACCESS_SET_ID');
l_request_id NUMBER;
l_count_sel_bat NUMBER;
l_phase VARCHAR2(100);
l_status VARCHAR2(100);
l_dev_phase VARCHAR2(100);
l_dev_status VARCHAR2(100);
l_message VARCHAR2(2000);
BEGIN
x_error_message := NULL;
x_return_status := 'S';
log_msg('Cux_fin_bank_transfer_pub.autopost(+) ');
log_msg('Call procedure gl_autopost_pkg.post_batches -> ');
gl_autopost_pkg.post_batches(x_request_id => l_request_id,
x_count_sel_bat => l_count_sel_bat,
x_access_set_id => l_gl_access_set_id,
x_ledger_id => p_set_of_books_id,
x_je_batch_id => p_je_batch_id,
x_je_source_name => p_je_source_name,
x_je_category_name => p_je_category_name);
COMMIT;
--等待过账
IF fnd_concurrent.wait_for_request(l_request_id,
5, --检查间隔时间
0, --maxwait
l_phase,
l_status,
l_dev_phase,
l_dev_status,
l_message) THEN
IF l_dev_phase = 'COMPLETE' AND l_dev_status = 'NORMAL' THEN
NULL;
ELSE
x_return_status := 'E';
x_error_message := '等待报错';
END IF;
END IF;
log_msg('AutoPost batch argument: ');
log_msg('Ledger_id --->' || p_set_of_books_id);
log_msg('Je_batch_id --->' || p_je_batch_id);
log_msg('Je_source_name --->' || p_je_source_name);
log_msg('Je_category_name --->' || p_je_category_name);
log_msg('X_request_id --->' || l_request_id);
log_msg('X_count_sel_bat --->' || l_count_sel_bat);
EXCEPTION
WHEN fnd_api.g_exc_error THEN
x_return_status := fnd_api.g_ret_sts_error;
x_error_message := '自动过账失败' || l_msg_data;
WHEN fnd_api.g_exc_unexpected_error THEN
x_return_status := fnd_api.g_ret_sts_unexp_error;
x_error_message := '自动过账失败' || l_msg_data;
WHEN OTHERS THEN
x_return_status := fnd_api.g_ret_sts_unexp_error;
x_error_message := g_package_name || '.' || l_api_name ||
' execute error : ' ||
dbms_utility.format_error_stack;
END autopost;
p_je_batch_id IN NUMBER DEFAULT NULL,
p_je_source_name IN VARCHAR2,
p_je_category_name IN VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2) IS
l_api_name CONSTANT VARCHAR2(100) := 'Autopost';
l_gl_access_set_id NUMBER := fnd_profile.value('GL_ACCESS_SET_ID');
l_request_id NUMBER;
l_count_sel_bat NUMBER;
l_phase VARCHAR2(100);
l_status VARCHAR2(100);
l_dev_phase VARCHAR2(100);
l_dev_status VARCHAR2(100);
l_message VARCHAR2(2000);
BEGIN
x_error_message := NULL;
x_return_status := 'S';
log_msg('Cux_fin_bank_transfer_pub.autopost(+) ');
log_msg('Call procedure gl_autopost_pkg.post_batches -> ');
gl_autopost_pkg.post_batches(x_request_id => l_request_id,
x_count_sel_bat => l_count_sel_bat,
x_access_set_id => l_gl_access_set_id,
x_ledger_id => p_set_of_books_id,
x_je_batch_id => p_je_batch_id,
x_je_source_name => p_je_source_name,
x_je_category_name => p_je_category_name);
COMMIT;
--等待过账
IF fnd_concurrent.wait_for_request(l_request_id,
5, --检查间隔时间
0, --maxwait
l_phase,
l_status,
l_dev_phase,
l_dev_status,
l_message) THEN
IF l_dev_phase = 'COMPLETE' AND l_dev_status = 'NORMAL' THEN
NULL;
ELSE
x_return_status := 'E';
x_error_message := '等待报错';
END IF;
END IF;
log_msg('AutoPost batch argument: ');
log_msg('Ledger_id --->' || p_set_of_books_id);
log_msg('Je_batch_id --->' || p_je_batch_id);
log_msg('Je_source_name --->' || p_je_source_name);
log_msg('Je_category_name --->' || p_je_category_name);
log_msg('X_request_id --->' || l_request_id);
log_msg('X_count_sel_bat --->' || l_count_sel_bat);
EXCEPTION
WHEN fnd_api.g_exc_error THEN
x_return_status := fnd_api.g_ret_sts_error;
x_error_message := '自动过账失败' || l_msg_data;
WHEN fnd_api.g_exc_unexpected_error THEN
x_return_status := fnd_api.g_ret_sts_unexp_error;
x_error_message := '自动过账失败' || l_msg_data;
WHEN OTHERS THEN
x_return_status := fnd_api.g_ret_sts_unexp_error;
x_error_message := g_package_name || '.' || l_api_name ||
' execute error : ' ||
dbms_utility.format_error_stack;
END autopost;