You can using the following package to create the IB (Install base) for the sales Order It has missed.

Normally, we enable the Install base option in the “Master Item” form for the Items for which we want to track. If we enable this option, then when we create the sales order with the Item for which Install base option is check then, you would see the IB got created.

CREATE OR REPLACE PACKAGE alloracletech_ib_pkg
IS
PROCEDURE create_install_base ( errbuf OUT VARCHAR2
, retcode OUT NUMBER);
PROCEDURE WRITE (p_type IN VARCHAR2, p_message IN VARCHAR2);
END alloracletech_ib_pkg;
/

CREATE OR REPLACE PACKAGE BODY alloracletech_ib_pkg
IS

PROCEDURE create_install_base ( errbuf OUT VARCHAR2
, retcode OUT NUMBER)
IS
/************************************************************************
Purpose : This procedure creates IB for all the order which are missed. 
*************************************************************************/
l_header_id NUMBER;
l_mtl_txn_id NUMBER;
l_return_status VARCHAR2 (1) := fnd_api.g_ret_sts_success;

CURSOR c_ib
IS
SELECT — oeh.order_number, 
oel1.line_id 
— oeh.creation_date,
— msib1.inventory_item_id, 
— msib1.segment1
FROM oe_order_lines_all oel1,
mtl_system_items_b msib1,
oe_order_headers_all oeh
WHERE oel1.ordered_item = msib1.segment1
AND msib1.comms_nl_trackable_flag = ‘Y’
AND msib1.shippable_item_flag = ‘Y’
AND msib1.organization_id = 22
AND oeh.header_id = oel1.header_id
AND oel1.flow_status_code = ‘CLOSED’
AND oel1.line_category_code = ‘ORDER’
AND oeh.order_type_id = 1008
— AND oel1.line_id IN (5599900, 5742086)
— AND oeh.order_number IN ( )
AND oeh.shipping_method_code IS NOT NULL
AND NOT EXISTS (SELECT 1
FROM csi.csi_item_instances cii
WHERE cii.last_oe_order_line_id = oel1.line_id);
BEGIN
FOR i IN c_ib
LOOP
BEGIN
SELECT transaction_id
INTO l_mtl_txn_id
FROM mtl_material_transactions
WHERE trx_source_line_id = i.line_id 
AND transaction_type_id = 33;

— dbms_output.put_line(i.order_number||’ ‘||i.line_id);
csi_inv_txn_hook_pkg.posttransaction
(p_header_id => l_header_id,
p_transaction_id => l_mtl_txn_id,
x_return_status => l_return_status
);
COMMIT;
EXCEPTION
WHEN NO_DATA_FOUND THEN
WRITE (‘L’, ‘No Transaction ID for the Line ID : ‘ || i.line_id );
WHEN TOO_MANY_ROWS THEN
WRITE (‘L’,’More then one Transaction ID for the Line ID : ‘ || i.line_id );
WHEN OTHERS THEN
WRITE (‘L’,
‘Error in LineID :’ || i.line_id || CHR (10) || SQLCODE || ‘ : ‘ || SQLERRM
);
END;
END LOOP;
END create_install_base;

/************************************************************************/
PROCEDURE WRITE (p_type IN VARCHAR2, p_message IN VARCHAR2)
IS
/************************************************************************
Purpose : This procedure writes to the output file or log file depending
on the parameter p_type passed.
*************************************************************************/
BEGIN
IF p_type = ‘L’
THEN
fnd_file.put_line (fnd_file.LOG, p_message);
ELSIF p_type = ‘O’
THEN
fnd_file.put_line (fnd_file.output, p_message);
END IF;
END WRITE;
END alloracletech_ib_pkg;
/

Use the following to Execute the Procedure. 

begin
alloracletech_ib_pkg.create_install_base;
end;
/

The following query can be used to find out whether Install Base (IB) created or not for the Order line.

select * from csi.csi_item_instances 
where last_oe_order_line_id IN (Your Order Line ID);

Example:-

select * from csi.csi_item_instances 
where last_oe_order_line_id IN (6912858, 6912859, 6912860);
I hope you find the above information help full.

Note:- There are few things which are hard-corded like order_type_id = 1008 etc, these are specific to my instance setup. It may vary for your Instance setup. Change the values accordingly.

Note:- I have tested above script in the 11i Instances.

The following query can be used to display the number in the words.

select ‘Your Number’, (to_char(to_date(‘Your Number’,’j’), ‘jsp’)) from dual;

Example:-

select 211, (to_char(to_date(211,’j’), ‘jsp’)) from dual;
The following query can be used to get the duplicate records from table.

SELECT * FROM ‘Your table name’ WHERE ROWID NOT IN (SELECT MAX(ROWID) FROM ‘Your Table Name’ GROUP BY ‘Your duplicate values field name’);

Example:-

SELECT * FROM emp WHERE ROWID NOT IN (SELECT MAX(ROWID) FROM emp GROUP BY ename);

To eliminate/delete the duplicate rows from the table, you can use the following query.

DELETE ‘Your table name’ WHERE ROWID NOT IN (SELECT MAX(ROWID) FROM ‘Your Table Name’ GROUP BY ‘Your duplicate values field name’);

Example:-

DELETE emp WHERE ROWID NOT IN (SELECT MAX(ROWID) FROM emp GROUP BY
ename);
You can get all the Canceled Requisitions in the PO Module using the following Query.

SELECT
prha.requisition_header_id “requisition_header_id”
,prha.segment1 “Requisition Number”
,prha.preparer_id “preparer_id”
,TRUNC(prha.creation_date) “creation_date”
,prha.description “description”
,prha.note_to_authorizer “note_to_authorizer”
FROM
po_requisition_headers_all prha
,po_action_history pah
WHERE action_code=’CANCEL’
AND pah.object_type_code=’REQUISITION’
AND pah.object_id=prha.requisition_header_id

Requisitions (PO Module) would be 2 types.

1) Purchasing Requisitions (Handled by the PO Module)

2) Internal Requisitions (Handled by the OM Module).

We create the Purchase Orders for the Purchasing Requisitions and Internal Sales Orders will be created for the Internal Requisitions.

Note:- We create Internal Sales Order to transfer the material between the Inventories with-in the Organization.
We can use the following Query to find out all the Internal requisitions are created but not converted to the Internal Sales Orders.

SELECT rqha.segment1 “Requisition Number”
, rqla.line_num “Line Number”
, rqla.requisition_header_id “Requisition Header ID”
, rqla.requisition_line_id “Requisition Line ID”
, rqla.item_id “Inventory item ID”
, rqla.unit_meas_lookup_code “Unit Of Measure”
, rqla.unit_price “Unit Price”
, rqla.quantity “Quantity”
, rqla.quantity_cancelled “Quantity Cancelled”
, rqla.quantity_delivered “Quantity Delivered”
, rqla.cancel_flag “Cancelled”
, rqla.source_type_code “Source Type”
, rqla.source_organization_id “Source Organization ID”
, rqla.destination_organization_id “Destination Organization ID”
, rqha.transferred_to_oe_flag “Transferred to OE Flag”
FROM po_requisition_lines_all rqla
, po_requisition_headers_all rqha
WHERE rqla.requisition_header_id = rqha.requisition_header_id
AND rqla.source_type_code = ‘INVENTORY’
AND rqla.source_organization_id IS NOT NULL
AND NOT EXISTS ( SELECT ‘existing internal order’
FROM oe_order_lines_all line
WHERE line.source_document_line_id =
rqla.requisition_line_id
AND line.source_document_type_id = 10)
ORDER BY rqha.requisition_header_id
, rqla.line_num