DECLARE -- values: bom_rtg_pub.g_miss_operation_tbl; values: bom_rtg_pub.g_miss_rtg_header_rec; l_rtg_revision_tblbom_rtg_pub.rtg_rev
DECLARE -- API input variables l_operation_tbl bom_rtg_pub.operation_tbl_type: = running; l_rtg_header_rec restart: = running; l_rtg_revision_tbl bom_rtg_pub.rtg_rev
Incluincludeclare
-- API input variablesRochelle operation_tbl Protocol: = protocol; Rochelle rtg_header_rec Protocol: = protocol; Rochelle op_resource_tbl Protocol: = protocol; Rochelle sub_resource_tbl Protocol: = protocol;
-- API output variablesX_rtg_header_rec bom_rtg_pub.rtg_header_rec_type;
-- Routing header recordX_rtg_revision_tbl bom_rtg_pub.rtg_revision_tbl_type;
-- Routing revisionsX_operation_tbl bom_rtg_pub.operation_tbl_type;
-- Routing operationsX_op_resource_tbl bom_rtg_pub.op_resource_tbl_type;
-- Oepration resourcesX_sub_resource_tbl bom_rtg_pub.sub_resource_tbl_type;
-- Sub operation resourcesX_op_network_tbl bom_rtg_pub.op_network_tbl_type;
-- Operation networksX_message_list error_handler.error_tbl_type;
-- Other API variablesRochelle return_status VARCHAR2 (1): = NULL; Rochelle msg_count NUMBER: = 0; Rochelle cnt number: = 1;
-- WHO columnsRochelle user_id NUMBER: =-1; Rochelle resp_id NUMBER: =-1; Rochelle application_id NUMBER: =-1; Rochelle row_cnt NUMBER: = 1; Rochelle user_name VARCHAR2 (30): = 'hand-gh ';
BEGIN
-- Get the user_idSELECT user_id INTO l_user_id FROM fnd_user WHERE user_name = l_user_name;
-- Get the application_id and responsibility_idRochelle application_id: = 702; Rochelle resp_id: = 50723;
-- Initialize applications information
/* Fnd_global.apps_initialize (l_user_id, l_resp_id, l_application_id); -- Mfg/Mfg & Dist Mgr/INV
Dbms_output.put_line ('initialized applications context: '| l_user_id | ''|
Rochelle resp_id | ''| l_application_id );*/
-- Create the routing headerL_rtg_header_rec.assembly_item_name: = 'test01'; l_rtg_header_rec.organization_code: = '000000'; l_rtg_header_rec.alternate_routing_code: = NULL;
-- L_rtg_header_rec.completion_subinventory: = 'fgi'; -- 200-ITRRochelle rtg_header_rec.transaction_type: = 'update ';
-- Create the routing operations
-- Operation 1
/* L_operation_tbl (l_cnt). assembly_item_name: = 'test01 ';
Rochelle operation_tbl (l_cnt). organization_code: = '20140901 ';
L_operation_tbl (l_cnt). alternate_routing_code: = NULL;
Rochelle operation_tbl (l_cnt). department_code: = 'thcj ';
Rochelle operation_tbl (l_cnt). operation_sequence_number: = '20 ';
Rochelle operation_tbl (l_cnt). operation_type: = 1;
Rochelle operation_tbl (l_cnt). start_effective_date: = SYSDATE;
Rochelle operation_tbl (l_cnt). standard_operation_code: = 'th ';
-- L_operation_tbl (l_cnt). yield: = 0.87;
Rochelle operation_tbl (l_cnt). transaction_type: = 'update ';
Rochelle operation_tbl (l_cnt). reference_flag: = 2;
Rochelle operation_tbl (l_cnt). attribute1: = 'y ';*/
--Rochelle op_resource_tbl (l_cnt ). assembly_item_name: = 'test01'; l_op_resource_tbl (l_cnt ). organization_code: = '000000'; l_op_resource_tbl (l_cnt ). alternate_routing_code: = NULL; l_op_resource_tbl (l_cnt ). operation_sequence_number: = '20'; l_op_resource_tbl (l_cnt ). usage_rate_or_amount: = 3; l_op_resource_tbl (l_cnt ). transaction_type: = 'update'; l_op_resource_tbl (l_cnt ). resource_sequence_number: = '10'; l_op_resource_tbl (l_cnt ). op_start_1_tive_date: = to_date ('2017/29 18:58:26 ', 'yyyy-MM-DD hh24: mi: ss ');
-- Actually the issue again was hour ti1_date, for Resource update I was supplying hour ti1_date l_op_resource_tbl (j). op_start_1_tive_date which was not exact match as in Application.
-- Picked up correct into tietong date and it worked fine.
-- L_op_resource_tbl (l_cnt). resource_code: = 'thl ';
/* -- Operation 2
L_cnt: = l_cnt + 1;
Rochelle operation_tbl (l_cnt). assembly_item_name: = 'lcy _ test_item01 ';
Rochelle operation_tbl (l_cnt). organization_code: = 'm1 ';
L_operation_tbl (l_cnt). alternate_routing_code: = NULL;
Rochelle operation_tbl (l_cnt). operation_sequence_number: = '20 ';
Rochelle operation_tbl (l_cnt). operation_type: = 1;
Rochelle operation_tbl (l_cnt). start_effective_date: = SYSDATE; -- to_date ('16-JUL-2010 19:30:39 ', 'dd-MON-YY HH24: MI: ss'); -- shocould match timestamp for UPDATE
Rochelle operation_tbl (l_cnt). standard_operation_code: = 'sfpk ';
Rochelle operation_tbl (l_cnt). yield: = 1.0;
Rochelle operation_tbl (l_cnt). transaction_type: = 'create ';*/
-- Initialize error stack for logging errorsError_handler.initialize;
-- Call API to create/update routingDbms_output.put_line ('====================================== ========================= '); dbms_output.put_line ('calling Bom_Rtg_Pub.Process_Rtg API ');
Bom_rtg_pub.process_rtg (p_bo_identifier => 'rtg', p_api_version_number => '1. 0 ', priority => TRUE, p_rtg_header_rec => priority, priority => priority, p_operation_tbl => l_operation_tbl, priority => priority, priority => priority, p_op_network_tbl => l_op_network_tbl, rows => x_rtg_header_rec, rows => rows, x_operation_tbl => x_operation_tbl, rows => rows, x_return_status => l_return_status, x_msg_count => l_msg_count, p_debug => 'n', p_output_dir => '/usr/tmp/', p_debug_filename => 'rtg _ bo_debug.log ');
Dbms_output.put_line ('====================================== ========================= '); dbms_output.put_line ('Return Status: '| l_return_status );
IF (l_return_status <> condition) THEN dbms_output.put_line ('x _ msg_count: '| l_msg_count); THEN (x_message_list => x_message_list); dbms_output.put_line ('error Count Message: '| x_message_list.count); FOR I IN 1 .. x_message_list.count LOOP dbms_output.put_line (to_char (I) | ':' | x_message_list (I ). entity_index | ':' | x_message_list (I ). table_name); dbms_output.put_line (to_char (I) | ':' | x_message_list (I ). message_text); end loop; end if; dbms_output.put_line ('====================================== ========================= ');
Exception when others then dbms_output.put_line ('exception Occured: '); dbms_output.put_line (SQLCODE |': '| SQLERRM ); dbms_output.put_line ('====================================== ========================= '); RAISE; END;