Beruflich Dokumente
Kultur Dokumente
Cause
The cause of the issue is invalid / incorrect data in CSI_ITEM_INSTANCES
The data should reflect the instance quantity available to transact as it was done in inventory.
The current quantity for the item is not correct so IB cannot process the transaction as it would
drive the quantity negative.
The following SQL identified the invalid / incorrect data:
select mmt.subinventory_code, mmt.transfer_subinventory, mmt.transaction_date,
mmt.transaction_id, mmt.transaction_quantity , cte.
error_text, ct.transaction_date , ct.source_transaction_date
,ciih.instance_id, cii.quantity, cii.active_end_date,
cii.inv_subinventory_name
, cii.serial_number, cii.instance_usage_code
from apps.csi_txn_errors cte, apps.mtl_material_transactions mmt, apps.
csi_transactions ct, apps.csi_item_instances_h ciih
, apps.csi_item_instances cii
where mmt.inventory_item_id = &&inventory_item_id
and (mmt.subinventory_code = '&&subinventory' or mmt.transfer_subinventory =
'&&subinventory')
and cte.inv_material_transaction_id(+) = mmt.transaction_id
and ct.inv_material_transaction_id(+) = mmt.transaction_id
and ciih.transaction_id(+) = ct.transaction_id
and cii.instance_id(+) = ciih.instance_id
order by 2
If according to the output of that query, there should be a quantity > 0 in Install Base for the item
in the sub-inventory used for the debrief, but the quantity in IB does not exist then IB is out of
synch.
The output of this query shows what IB should have available for that sub-inventory:
select instance_id, active_end_date, quantity, serial_number
from csi_item_instances
where inventory_item_id = &&inventory_item_id
and inv_subinventory_name = '&&subinventory'
The Error Correction Program in Synch mode should synchronize IB with the inventory on-hand
quantities and take care of this. But it only does that under certain restrictions (e.g. no pending
transaction errors for the item). So in case the debrief needs to go through quickly, the below
solution provides a way to create an instance in IB to make the instance available.
Solution
To implement the solution, please execute the following steps::
1. Ensure that you have taken a backup of your system before applying the recommended
solution.
2. Run the following script (in a TEST environment first):
Note that the parameters being passed (mainly for x_instance_rec) may need to be modified to be
appropriate for the item to be processed. E.g. a value for serialnumber, lot_number or locator
(inv_locator_id) may need to be passed. Currently the script is passing NULL for these two.
P_COMMIT
VARCHAR2(5);
P2_COMMIT
VARCHAR2(5);
P_VALIDATION_LEVEL NUMBER;
P_INIT_MSG_LST
VARCHAR2(500);
V_INSTANCE_PARTY_ID
NUMBER;
V_IP_ACCOUNT_ID
NUMBER;
X_RELATIONSHIP_TBL CSI_DATASTRUCTURES_PUB.II_RELATIONSHIP_tbl;
V_RELATIONSHIP_ID
NUMBER;
V_SUCCESS
VARCHAR2(1) := 'T';
x2_return_status VARCHAR2(100);
x2_msg_count
NUMBER;
x2_msg_data
VARCHAR2(2000);
P2_VALIDATION_LEVEL NUMBER;
P2_INIT_MSG_LST
VARCHAR2(500);
l_material_transaction_id
NUMBER;
l_stage
VARCHAR2(100);
l_error
EXCEPTION;
l_transaction_error_id
NUMBER;
l_transaction_id
NUMBER;
l_error_pending
EXCEPTION;
l_trx_processed
EXCEPTION;
begin
-- ********** FOR The Instance
*****************************************************
SELECT CSI_ITEM_INSTANCES_S.NEXTVAL
INTO
V_INSTANCE_ID
FROM
sys.dual;
X_INSTANCE_REC.INSTANCE_ID
:= V_INSTANCE_ID;
X_INSTANCE_REC.INSTANCE_NUMBER := V_INSTANCE_ID;
l_stage := 'get mtl transaction data';
X_INSTANCE_REC.INVENTORY_ITEM_ID := &inventory_item_id
X_instance_rec.INV_SUBINVENTORY_NAME := '&subinventory_name';
X_INSTANCE_REC.INV_ORGANIZATION_ID = &inventory_org_id;
X_INSTANCE_REC.ACTIVE_START_DATE := to_date('01-JAN-2008','DD-MON-RRRR');
X_INSTANCE_REC.QUANTITY := &debrief_quantity;
X_INSTANCE_REC.UNIT_OF_MEASURE := '&debrief_uom';
IF X_INSTANCE_REC.QUANTITY <= 0 THEN
RAISE l_error;
END IF;
l_stage := 'get master org';
select master_organization_id
into
X_INSTANCE_REC.INV_MASTER_ORGANIZATION_ID
from MTL_PARAMETERS_VIEW
where organization_id = X_INSTANCE_REC.INV_ORGANIZATION_ID;
l_stage := 'get default status id';
select instance_status_id
into X_INSTANCE_REC.INSTANCE_STATUS_ID
from csi_instance_statuses
where name = fnd_profile.value('CSI_DEFAULT_INSTANCE_STATUS');
l_stage := 'set misc. values';
X_INSTANCE_REC.SERIAL_NUMBER
:= null; --not serialized
X_INSTANCE_REC.MFG_SERIAL_NUMBER_FLAG := 'N';
X_INSTANCE_REC.INSTANCE_USAGE_CODE
:= 'IN_INVENTORY';
X_INSTANCE_REC.ACCOUNTING_CLASS_CODE := 'INV';
X_INSTANCE_REC.CUSTOMER_VIEW_FLAG := 'N';
X_INSTANCE_REC.MERCHANT_VIEW_FLAG := NULL;
X_INSTANCE_REC.SELLABLE_FLAG
:= NULL;
X_INSTANCE_REC.LOCATION_TYPE_CODE := 'INVENTORY';
X_INSTANCE_REC.INV_LOCATOR_ID
:= null; -- in case of no locator
control
X_INSTANCE_REC.LOT_NUMBER
:= null; -- in case of no revision control
X_INSTANCE_REC.INSTALL_DATE
:= null;
X_INSTANCE_REC.CREATION_COMPLETE_FLAG := 'Y';
X_INSTANCE_REC.VERSION_LABEL
:= 'AS_CREATED';
X_INSTANCE_REC.LAST_OE_PO_NUMBER := null;
X_INSTANCE_REC.OBJECT_VERSION_NUMBER := 1;
l_stage := 'get location id';
select location_id
into X_INSTANCE_REC.LOCATION_ID
from hr_organization_units
where organization_id = X_instance_rec.INV_ORGANIZATION_ID;
-- ************* FOR PARTIES *************************************************
l_stage := 'set owner party data';
SELECT CSI_I_PARTIES_S.NEXTVAL
INTO
V_INSTANCE_PARTY_ID
FROM
sys.dual;
X_PARTY_TBL(1).INSTANCE_PARTY_ID := V_INSTANCE_PARTY_ID;
X_PARTY_TBL(1).INSTANCE_ID
:= V_INSTANCE_ID;
X_PARTY_TBL(1).PARTY_SOURCE_TABLE := 'HZ_PARTIES';
X_PARTY_TBL(1).RELATIONSHIP_TYPE_CODE := 'OWNER';
X_PARTY_TBL(1).CONTACT_FLAG
:= 'N';
X_PARTY_TBL(1).ACTIVE_START_DATE := X_INSTANCE_REC.ACTIVE_START_DATE;
X_PARTY_TBL(1).OBJECT_VERSION_NUMBER := 1;
l_stage := 'get internal party';
select internal_party_id
into X_PARTY_TBL(1).PARTY_ID
from csi_install_parameters;
X_TXN_REC.TRANSACTION_DATE
:= X_INSTANCE_REC.ACTIVE_START_DATE;
X_TXN_REC.SOURCE_TRANSACTION_DATE := X_INSTANCE_REC.ACTIVE_START_DATE;
X_TXN_REC.TRANSACTION_TYPE_ID
:=1;
X_TXN_REC.OBJECT_VERSION_NUMBER
:=1;
X_TXN_REC.ATTRIBUTE15
:='created by script from note 845551.1';