Vous êtes sur la page 1sur 3

DECLARE l_user_id l_resp_id l_appl_id l_header_rec_in l_line_tbl_in l_action_request_tbl_in l_header_rec_out l_line_tbl_out l_header_val_rec_out l_header_adj_tbl_out l_header_adj_val_tbl_out l_header_price_att_tbl_out l_header_adj_att_tbl_out l_header_adj_assoc_tbl_out

l_header_scredit_tbl_out l_header_scredit_val_tbl_out l_line_val_tbl_out l_line_adj_tbl_out l_line_adj_val_tbl_out l_line_price_att_tbl_out l_line_adj_att_tbl_out l_line_adj_assoc_tbl_out l_line_scredit_tbl_out l_line_scredit_val_tbl_out l_lot_serial_tbl_out l_lot_serial_val_tbl_out l_action_request_tbl_out l_chr_program_unit_name l_ret_status l_msg_count l_msg_data l_api_version CURSOR c_so_details IS

NUMBER; NUMBER; NUMBER; oe_order_pub.header_rec_type; oe_order_pub.line_tbl_type; oe_order_pub.request_tbl_type; oe_order_pub.header_rec_type; oe_order_pub.line_tbl_type; oe_order_pub.header_val_rec_type; oe_order_pub.header_adj_tbl_type; oe_order_pub.header_adj_val_tbl_type; oe_order_pub.header_price_att_tbl_type; oe_order_pub.header_adj_att_tbl_type; oe_order_pub.header_adj_assoc_tbl_type; oe_order_pub.header_scredit_tbl_type; oe_order_pub.header_scredit_val_tbl_type; oe_order_pub.line_val_tbl_type; oe_order_pub.line_adj_tbl_type; oe_order_pub.line_adj_val_tbl_type; oe_order_pub.line_price_att_tbl_type; oe_order_pub.line_adj_att_tbl_type; oe_order_pub.line_adj_assoc_tbl_type; oe_order_pub.line_scredit_tbl_type; oe_order_pub.line_scredit_val_tbl_type; oe_order_pub.lot_serial_tbl_type; oe_order_pub.lot_serial_val_tbl_type; oe_order_pub.request_tbl_type; VARCHAR2 (100); VARCHAR2 (1000) := NULL; NUMBER := 0; VARCHAR2 (2000); NUMBER := 1.0;

SELECT oh.order_number, ol.line_number, ol.shipment_number, ol.header_id, ol.line_id, ol.flow_status_code,OL.ORDERED_QUANTITY,OL.CANCELLED_FLAG,OH.ORG_ID FROM --xx_cancel_so_temp a, oe_order_headers_all oh, oe_order_lines_all ol, mtl_system_items msi, mtl_parameters mp --wsh_delivery_details wsh WHERE 1 =1 --a.so_number = oh.order_number --AND a.item_num = msi.segment1 --AND a.org_code = mp.organization_code --AND a.line_num = ol.line_number || '.' || ol.shipment_number AND mp.organization_id = msi.organization_id AND ol.header_id = oh.header_id AND ol.inventory_item_id = msi.inventory_item_id --AND wsh.source_line_id(+) = ol.line_id --AND wsh.source_header_id = oh.header_id and mp.organization_id = oh.ship_from_org_id and order_number in('131200329', '131100447', '131100438') --AND wsh.released_status NOT IN ('Y','C','L','I')

AND ol.flow_status_code IN ('AWAITING_SHIPPING','ENTERED') AND oh.flow_status_code IN ('BOOKED', 'ENTERED') AND NVL(OL.CANCELLED_FLAG,'N')='N' ; BEGIN SELECT INTO FROM WHERE SELECT INTO FROM WHERE user_id l_user_id fnd_user user_name = 'APL_SCM'; responsibility_id, application_id l_resp_id, l_appl_id fnd_responsibility_vl responsibility_name like 'ALP OM SuperUser';

fnd_global.apps_initialize (l_user_id, l_resp_id, l_appl_id); mo_global.set_policy_context('S',101); FOR i IN c_so_details LOOP l_line_tbl_in (1) := oe_order_pub.g_miss_line_rec; l_line_tbl_in (1).line_id := i.line_id; l_line_tbl_in (1).ordered_quantity := 0; l_line_tbl_in (1).change_reason := '1'; --Administrative Reason l_line_tbl_in (1).change_comments := 'Cancel Order Line for Go-Live'; l_line_tbl_in (1).operation := oe_globals.g_opr_update; oe_msg_pub.delete_msg; oe_order_pub.process_order (p_api_version_number p_init_msg_list p_return_values p_action_commit p_line_tbl x_header_rec x_header_val_rec x_header_adj_tbl x_header_adj_val_tbl x_header_price_att_tbl x_header_adj_att_tbl x_header_adj_assoc_tbl x_header_scredit_tbl x_header_scredit_val_tbl t, x_line_tbl x_line_val_tbl x_line_adj_tbl x_line_adj_val_tbl x_line_price_att_tbl x_line_adj_att_tbl x_line_adj_assoc_tbl x_line_scredit_tbl x_line_scredit_val_tbl x_lot_serial_tbl x_lot_serial_val_tbl x_action_request_tbl x_return_status x_msg_count x_msg_data ); => => => => => => => => => => => => => => => l_line_tbl_out, l_line_val_tbl_out, l_line_adj_tbl_out, l_line_adj_val_tbl_out, l_line_price_att_tbl_out, l_line_adj_att_tbl_out, l_line_adj_assoc_tbl_out, l_line_scredit_tbl_out, l_line_scredit_val_tbl_out, l_lot_serial_tbl_out, l_lot_serial_val_tbl_out, l_action_request_tbl_out, l_ret_status, l_msg_count, l_msg_data => => => => => => => => => => => => => => l_api_version, fnd_api.g_false, fnd_api.g_false, fnd_api.g_false, l_line_tbl_in, l_header_rec_out, l_header_val_rec_out, l_header_adj_tbl_out, l_header_adj_val_tbl_out, l_header_price_att_tbl_out, l_header_adj_att_tbl_out, l_header_adj_assoc_tbl_out, l_header_scredit_tbl_out, l_header_scredit_val_tbl_ou

l_msg_data := NULL; IF l_ret_status <> 'S' THEN FOR iindx IN 1 .. l_msg_count LOOP l_msg_data := l_msg_data || ' ' || oe_msg_pub.get (iindx); END LOOP; DBMS_OUTPUT.put_line ( 'Sales Order => '|| i.order_number); DBMS_OUTPUT.put_line ( 'Line ID=> ' || i.line_id || ' Line Cancelation Fa iled'); DBMS_OUTPUT.put_line ('Return Status: ' || l_ret_status); DBMS_OUTPUT.put_line ('Error Message: ' || l_msg_data); ELSE DBMS_OUTPUT.put_line ( 'Sales Order => '|| i.order_number); DBMS_OUTPUT.put_line ( 'Line ID=> ' || i.line_id || ' Line Cancelled Succ essfully'); DBMS_OUTPUT.put_line ('Return Status: ' || l_ret_status); DBMS_OUTPUT.put_line ('Error Message: ' || l_msg_data); END IF;

END LOOP; END;

Vous aimerez peut-être aussi