Sql Examiner Serial Number
first of all thanks for your time and valuable solutions
Install base: How to update a serial Number which has Inventory Material Transactions
problem description:
Install base > quick search
Here is Installbase record, when I query from quick search
Rec# Item Item Instance Serial Number Status
1 300-7000-01 3000000 1000XXX-0538JQ0003 Return for Adv Exchange
2 300-7000-01 8000000 1000XXX-0538JQ0003- Return for Adv Exchange
3 300-7000-01 5000000 1000XXX-0538JQ0003-A Return for Adv Exchange
looking above data, first and third records are the legitimate serial numbers(correct according to the client specs), second record is not legitimate since it has a dash as suffix, we found there are many illegitimate serial Numbers exists, needs to be updated with the right serial Numbers which I analyzed in excel after pulling data from mtl_material_transactions , oe_order_lines_all , mtl_serial_numbers , mtl_system_items_b
basically these are all RMAs
I need to update the second record as 1094SUZ-0538JQ0003-B as per the guidelines, while updating I need to keep all the existing contracts, Warranty, what ever material transations it has, need to be same.
we have a package updating the serial numbers using IB API (csi_Item_Instance_Pub.update_item_instance) but it is updating only the records which has no serial numbers present for that instance, if there is a serial number already exists it is not working.
user define error msg 'Serial Number 1094SUZ-0538JQ0003- has Inventory Material Transactions. This serial number cannot be used to update an existing Item Instance', but I need to update this anyway!! or am I missing something here, please advice me
below post looks like similar issue, talks about hard update, I have no clue, by doing that the updated serial number will have same transations, contracts, dates....attached to it like the previous serial number
IB UPDATE_ITEM_INSTANCE ERROR - doesn't allow ACTIVE_START_DATE to change
would be great If you guys help me out, really appreciated!!
unfortunately I couldn't find any solutoin in metalink for the existing serial number update
code for updating the serial number using IB API
x_msg_count := 0;
x_msg_data := ';
p_instance_rec.instance_id := rec.child_instance_id;
p_instance_rec.serial_number := rec.child_serial_number;
p_instance_rec.object_version_number := rec.child_object_number;
p_txn_rec.transaction_id := Fnd_Api.g_miss_num;
p_txn_rec.transaction_date := SYSDATE;
p_txn_rec.source_transaction_date := SYSDATE;
p_txn_rec.transaction_type_id := 1;
csi_Item_Instance_Pub.update_item_instance
(
p_api_version => 1.0,
p_commit => Fnd_Api.g_false,
p_init_msg_list => Fnd_Api.g_false,
p_validation_level => 1,
p_instance_rec => p_instance_rec,
p_ext_attrib_values_tbl => p_ext_attrib_values_tbl,
p_party_tbl => p_party_tbl,
p_account_tbl => p_account_tbl,
p_pricing_attrib_tbl => p_pricing_attrib_tbl,
p_org_assignments_tbl => p_org_assignments_tbl,
p_asset_assignment_tbl => p_asset_assignment_tbl,
p_txn_rec => p_txn_rec,
x_instance_id_lst => x_instance_id_lst,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data
);
Thanks
Suri
write query for auto generate serial numbers and when i delete an order from sql so serial numbers should be as 1234567 in serial_number row and i used order id as auto increment
Serial Number In Sql Server Query Linked tinyurl.com/ya79q8tm. SERIAL data type allows you to automatically generate unique integer numbers (IDs, identity, auto-increment, sequence) for a column. Quick Example: - Define a table with SERIAL column (id starts at 1) CREATE TABLE teams ( id SERIAL UNIQUE, name VARCHAR(90) ); - Insert a row, ID will be automatically generated INSERT INTO teams (name) VALUES ('Tottenham Hotspur'); - Retrieve generated ID.
3 Answers
You can write the query in most dialects of sql as:
Here is syntax that works in SQL Server:
FOR MYSQL USERSBased on your reasons for not wanting to use user defined variables as wanting to avoid having 2 queries, one for inializing and one to use it you could use the following: