The below script is used to create SO reservations
DECLARE
p_rsv
inv_reservation_global.mtl_reservation_rec_type;
p_dummy_sn
inv_reservation_global.serial_number_tbl_type;
x_msg_count
NUMBER;
x_msg_data
VARCHAR2 (240);
x_rsv_id
NUMBER;
x_dummy_sn
inv_reservation_global.serial_number_tbl_type;
x_status
VARCHAR2 (1);
x_qty
NUMBER;
BEGIN
-- fnd_global.APPS_Initialize(28270,53073,660);
DBMS_APPLICATION_INFO.set_client_info
(5283);
--p_user_id, p_resp_id, p_resp_appl_id
--p_rsv.reservation_id := NULL; -- cannot know
p_rsv.requirement_date := SYSDATE + 2;
p_rsv.organization_id := 5343; --mtl_parameters.organization id
p_rsv.inventory_item_id :=
949729;
--mtl_system_items.Inventory_item_id;
p_rsv.demand_source_type_id := inv_reservation_global.g_source_type_oe;
-- which is 2
p_rsv.demand_source_name := NULL;
p_rsv.demand_source_header_id :=
1334166;
--mtl_sales_orders.sales_order_id
p_rsv.demand_source_line_id :=
4912468; --
oe_order_lines.line_id
p_rsv.primary_uom_code := 'EA';
p_rsv.primary_uom_id := NULL;
p_rsv.reservation_uom_code := 'EA';
p_rsv.reservation_uom_id := NULL;
p_rsv.reservation_quantity := 10;
p_rsv.primary_reservation_quantity := 10;
p_rsv.supply_source_type_id := inv_reservation_global.g_source_type_inv;
inv_reservation_pub.create_reservation (p_api_version_number => 1.0,
x_return_status => x_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_rsv_rec => p_rsv,
p_serial_number => p_dummy_sn,
x_serial_number => x_dummy_sn,
x_quantity_reserved => x_qty,
x_reservation_id => x_rsv_id
);
DBMS_OUTPUT.put_line ('Return
status = ' ||
x_status);
DBMS_OUTPUT.put_line ('msg
count = ' || TO_CHAR (x_msg_count));
DBMS_OUTPUT.put_line ('msg
data = ' ||
x_msg_data);
DBMS_OUTPUT.put_line ('Quantity
reserved = ' || TO_CHAR (x_qty));
DBMS_OUTPUT.put_line ('Reservation
id = ' || TO_CHAR (x_rsv_id));
IF
x_msg_count >= 1
THEN
FOR i IN 1 .. x_msg_count
LOOP
DBMS_OUTPUT.put_line
( i
|| '.
'
|| SUBSTR
(fnd_msg_pub.get (p_encoded => fnd_api.g_false),
1,
255
)
);
fnd_file.put_line
(fnd_file.LOG,
i
|| '.
'
|| SUBSTR
(fnd_msg_pub.get (p_encoded => fnd_api.g_false),
1,
255
)
);
END LOOP;
END IF;
COMMIT;
END;
/
Similarly we have update_reservations, relieve_reservations, delete_reservations API to respectively update, relieve or delete reservations.
No comments:
Post a Comment