on 06-30-2015 6:33 AM
Hi expert,
how can i manage duplicate inventory in sbo.?
For e.g. there is one item like Demo item.
Thenafter i add new item which is same name.
How can it alert me same item name will be already exits.?
Plzz. Help me asap.
Thanks,
Nikunj
Hi Nikunj,
try the below code. this will help you.
If @object_type = '4' and @transaction_type in ( 'A','U')
BEGIN
declare @ItmG int
declare @name char(100)
Select @name=I.ItemName,
@ItmG=I.ItmsGrpCod
From OITM I
Where I.ItemCode=@list_of_cols_val_tab_del
If exists (Select I.ItemName From OITM I
Where I.ItemCode!=@list_of_cols_val_tab_del
and I.ItmsGrpCod=@ItmG
and I.ItemName=@name )
Select @error =12,
@error_message = 'Duplicate Item Name!'
END
This code will allow you to stop from entering the duplicate item number in the same itemgroup.
Let me know if you need more information.
Thanks and regards,
Ravi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try This
If @object_type = '4' and @transaction_type in ('A', 'U')
BEGIN
if exists
(
Select I.ItemName From OITM i
Where I.ItemCode=@list_of_cols_val_tab_del and itemname IN ( SELECT Itemname FROM oitm )
)
Select @error =12,
@error_message = 'Not Authorised'
END
rgds
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try This
If @object_type = '4' and @transaction_type in ( 'A','U')
BEGIN
declare @name char(100)
Select @name=I.ItemName
From OITM I
Where I.ItemCode=@list_of_cols_val_tab_del
If exists (Select I.ItemName From OITM I
Where I.ItemCode!=@list_of_cols_val_tab_del
and I.ItemName=@name )
Select @error =12,
@error_message = 'Duplicate Item Name!'
end
Hi Nikunj,
You can add a validation through Transaction notification in SQL.
Thanks & regards
Unnikrishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I write below query in transaction notification but it will generate error.
select @error, @error_message
F @transaction_type IN ('A', 'U') AND
(@Object_type = '4')
begin
if exists (SELECT T0.[ItemName] FROM OITM T0 WHERE T0.[ItemCode] = T0.[ItemCode])
begin
select @Error = 10, @error_message = 'Item Name already exists...'
end
end
end
Hi Nikunj,
Please try below TN Query
If @object_type = '4' and @transaction_type in ( 'A','U')
BEGIN
If exists (Select I.ItemName From OITM I
Where I.ItemCode!=@list_of_cols_val_tab_del
and I.ItemName=
(Select ii.ItemName From OITM ii
Where ii.ItemCode=@list_of_cols_val_tab_del) )
begin
select @error =12
select @error_message = 'Duplicate Item Name!!'
end
END
Thanks
Unnikrishnan
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.