Uploaded by Abhijeet Suryakar

data fix 3 32728060351 1

advertisement
SET serveroutput ON;
spool spool.lst;
DECLARE
l_file_name VARCHAR2(1000);
l_utl_dir VARCHAR2(4000);
l_db_name VARCHAR2(60);
l_sys_date TIMESTAMP;
l_script VARCHAR2(30) := '3-32728060351';
l_item_key VARCHAR2(30);
l_lin_id := 3804880;
BEGIN
l_item_key := To_Char(l_lin_id);
-- Setup debugging
oe_debug_pub.debug_on;
oe_debug_pub.initialize;
oe_debug_pub.setdebuglevel(5);
l_file_name := oe_debug_pub.set_debug_mode('FILE');
Dbms_Output.put_line('Debug log is located at: ' || Oe_debug_pub.g_dir || '/' ||Oe_debug_pub.g_file);
oe_debug_pub.ADD('Running script: ' || l_script);
SELECT name INTO l_db_name
FROM V$DATABASE;
oe_debug_pub.ADD('Running for databse: ' || l_db_name);
SELECT SYSDATE INTO l_sys_date
FROM dual;
oe_debug_pub.ADD('Execution time is: ' || l_sys_date);
select number_value
into l_user_id
from wf_item_attribute_values
where item_type = 'OEOL'
and item_key = l_item_key and name = 'USER_ID';
select number_value
into l_resp_id
from wf_item_attribute_values
where item_type = 'OEOL'
and item_key = l_item_key and name = 'RESPONSIBILITY_ID';
select number_value
into l_resp_appl_id
from wf_item_attribute_values
where item_type = 'OEOL'
and item_key = l_item_key and name = 'APPLICATION_ID';
update oe_order_lines_all
set flow_status_code = 'CANCELLED'
, cancelled_flag = 'Y'
, ordered_quantity = 0
, ordered_quantity2 = decode(ordered_quantity2,NULL,NULL,0) , schedule_ship_date = NULL
, schedule_arrival_date = NULL
, schedule_status_code = NULL
, shipping_quantity = NULL
, shipping_quantity2 = decode(shipping_quantity2,NULL,NULL,0)
, shipped_quantity = NULL --This has been added as part of Bug#24511667
, shipped_quantity2 = decode(shipped_quantity2,NULL,NULL,0)
, actual_shipment_date = NULL
, fulfilled_flag = NULL
, fulfilled_quantity = NULL
, fulfilled_quantity2 = decode(fulfilled_quantity2,NULL,NULL,0)
, actual_fulfillment_date = NULL
, cancelled_quantity = ordered_quantity + nvl(cancelled_quantity,0)
, cancelled_quantity2 = Decode(ordered_quantity2, NULL, NULL, ordered_quantity2 + nvl(cancelled_quantity2, 0))
, visible_demand_flag = NULL
, last_updated_by = -6156992
, last_update_date = sysdate
where line_id = l_lin_id
AND open_flag = 'N';
Dbms_Output.Put_Line('Successfully updated line');
oe_debug_pub.ADD('closing workflow : '||l_lin_id);
oe_debug_pub.ADD('Processing for line_id: ' || l_item_key );
fnd_global.apps_initialize(l_user_id, l_resp_id, l_resp_appl_id);
wf_engine.handleerror( OE_Globals.G_WFI_LIN
, l_item_key
, 'CLOSE_LINE'
, 'RETRY'
, 'CANCEL'
);
-- Finishing script with success
oe_debug_pub.ADD('Script succesfully executed.');
oe_debug_pub.debug_off;
EXCEPTION
WHEN Others THEN
Dbms_Output.Put_Line('Error : '|| sqlerrm);
oe_debug_pub.add('Error : '||sqlerrm);
ROLLBACK;
END;
/
Download