Close and Reopen batch order

This post I will show how to close and reopen the batch with an API.

This batch order is win completed status.

Sem título

Execute this below command:

DECLARE
l_api_version NUMBER := 2.0;
l_validation_level NUMBER default GME_COMMON_PVT.g_max_errors;
l_message_count NUMBER;
l_message_list VARCHAR2(500);
l_return_status VARCHAR2(1);
p_org_code VARCHAR2(10);
p_batch_no VARCHAR2(10); 
p_batch_rec gme_batch_header%ROWTYPE;
x_batch_rec gme_batch_header%ROWTYPE;
xitem VARCHAR2(16);
BEGIN

FND_GLOBAL.apps_initialize(user_id => 1139,
resp_id => 23326,
resp_appl_id => 553 );

p_batch_rec.batch_no := '40';

GME_API_PUB.close_batch ( p_api_version => l_api_version,
p_validation_level => l_validation_level,
p_init_msg_list => FND_API.g_true,
p_commit => FND_API.g_true,
x_message_count => l_message_count,
x_message_list => l_message_list,
x_return_status => l_return_status,
p_batch_header_rec => p_batch_rec,
p_org_code => '013',
x_batch_header_rec => x_batch_rec);

IF l_return_status = 'S' THEN 
dbms_output.put_line( 'Release step succeeded');
COMMIT;
ELSE
dbms_output.put_line( 'release_step: status='|| l_return_status||', message='||l_message_list);
ROLLBACK;
END IF;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line('Error '||TO_CHAR(SQLCODE)||': '||SQLERRM);
RAISE;

END;

It will close.

Sem título

And execute this below command.

DECLARE
l_api_version NUMBER := 2.0;
l_validation_level NUMBER default GME_COMMON_PVT.g_max_errors;
l_message_count NUMBER;
l_message_list VARCHAR2(500);
l_return_status VARCHAR2(1);
p_org_code VARCHAR2(10);
p_batch_no VARCHAR2(10); 
p_batch_rec gme_batch_header%ROWTYPE;
x_batch_rec gme_batch_header%ROWTYPE;
xitem VARCHAR2(16);
BEGIN

FND_GLOBAL.apps_initialize(user_id => 1139,
resp_id => 23326,
resp_appl_id => 553 );

p_batch_rec.batch_no := '40';

GME_API_PUB.reopen_batch ( p_api_version => l_api_version,
p_validation_level => l_validation_level,
p_init_msg_list => FND_API.g_true,
p_commit => FND_API.g_true,
x_message_count => l_message_count,
x_message_list => l_message_list,
x_return_status => l_return_status,
p_batch_header_rec => p_batch_rec,
p_org_code => '013',
p_reopen_steps => FND_API.g_false,
x_batch_header_rec => x_batch_rec);

IF l_return_status = 'S' THEN 
dbms_output.put_line( 'Release step succeeded');
COMMIT;
ELSE
dbms_output.put_line( 'release_step: status='|| l_return_status||', message='||l_message_list);
ROLLBACK;
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error '||TO_CHAR(SQLCODE)||': '||SQLERRM);
RAISE;

END;

It will be reopen.

Sem título

Deixe uma resposta

Powered by WordPress.com. Tema: Baskerville 2 por Anders Noren

Acima ↑

%d blogueiros gostam disto: