This discussion is archived
2 Replies Latest reply: Oct 1, 2012 6:39 AM by user11973451 RSS

Complete Batch and create material exception lots api's ??

user11973451 Newbie
Currently Being Moderated
We created Batch and make reservation for all items and we want to make the material exceptions lots and batch complete with apis
i found api for batch complete
declare
l_status VARCHAR2(10);
l_return_status VARCHAR2(1):= fnd_api.g_ret_sts_success;
l_count NUMBER ;
l_record_count NUMBER(10):= 0;
l_loop_cnt NUMBER(10):= 0;
l_dummy_cnt NUMBER(10):= 0;
l_data VARCHAR2(2000);
l_msg_index_out NUMBER;
l_in_batch_header_rec gme_batch_header%ROWTYPE;
l_batch_header_rec gme_batch_header%ROWTYPE;
l_exception_material_tbl gme_common_pvt.exceptions_tab;
x number;
BEGIN
fnd_global.apps_initialize(user_id=> 2078,
resp_id=> 23326,
resp_appl_id=> 553 );
l_in_batch_header_rec.batch_type:= 0;
l_in_batch_header_rec.batch_id:='184397';
l_in_batch_header_rec.update_inventory_ind:='Y';
l_in_batch_header_rec.actual_start_date:= SYSDATE;



gme_api_pub.complete_batch(p_api_version=> 2.0
,p_validation_level=>gme_common_pvt.g_max_errors
,p_init_msg_list=> fnd_api.g_false
,p_commit=> fnd_api.g_false
,x_message_count=>l_count
,x_message_list=>l_data
,x_return_status=>l_status
,p_batch_header_rec=>l_in_batch_header_rec
,p_org_code=> 'ECO'
,p_ignore_exception=> fnd_api.g_false
,p_validate_flexfields=> fnd_api.g_false
,x_batch_header_rec=>l_batch_header_rec
,x_exception_material_tbl=>l_exception_material_tbl);
commit;
DBMS_OUTPUT.put_line ('status: '|| l_status ||' msg Count '|| l_count);
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'status: '|| l_status ||' msg Count '|| l_count);
IF l_status= 'S' THEN
COMMIT;
ELSE
IF l_count= 1 THEN
DBMS_OUTPUT.put_line ('Error:'|| l_data);
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'Error:'|| l_data);
ELSE
DBMS_OUTPUT.put_line ( 'status: ' || l_status||' Error Count '|| l_count );
FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'status: ' || l_status||' Error Count '|| l_count );

FOR i IN 1 .. 5 LOOP
fnd_msg_pub.get (p_msg_index=>i, p_data=>l_data, p_encoded=> fnd_api.g_false,
p_msg_index_out=>l_msg_index_out );
DBMS_OUTPUT.put_line ('Error: '||SUBSTR (l_data, 1, 255));
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'Error: '||SUBSTR (l_data, 1, 255)); END LOOP;
END IF;
END IF;
exception when others then null;
end ;

it gives me
Error:Batch has Material Exceptions.
Thank you

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points