cancel
Showing results for 
Search instead for 
Did you mean: 

How to block a duplicate serial number in Serial number management- update screen ?

former_member440545
Participant
0 Kudos

Hi Experts,

I already created one serial number for Item1 in Goods receipt ,now again I update the Item2 with Item1 serial number in serial number management screen. this time I need to block the Updation. It only allows the serial number which was not in osrn table

I need to block the duplicate serial in Serial Number Management Screen.

Actaully I wrote a Sptransaction already, But it is Not working

My Sptransaction here..

--Serial Number management Screen

IF @object_type In ('10000045') AND @transaction_type IN('A','U')

BEGIN

IF EXISTS (SELECT T0.INTRSERIAL FROM OSRI T0 INNER JOIN OSRN T1 ON T0.INTRSERIAL= T1.DISTNUMBER AND T0.SYSSERIAL=T1.SYSNUMBER WHERE T0.BaseType In('59','202') AND T1.ABSENTRY=@list_of_cols_val_tab_del )

BEGIN

SET @error = 10

SET @error_message =N'Serial Number Exists'

END

END

The above query is not working.please help me to solve this issue

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member185682
Active Contributor
0 Kudos

Hi Manikandan,

By default in my SAP Business One is not allowed to repeat serial numbers, maybe this could be set up, but I unknown.

Maybe this validation could help you:

IF @object_type In ('10000045') AND @transaction_type IN('A','U')
BEGIN
	IF (SELECT COUNT(DistNumber) FROM OSRN WHERE DistNumber = (SELECT DistNumber  FROM OSRN WHERE AbsEntry = @list_of_cols_val_tab_del) AND ItemCode = (SELECT ItemCode  FROM OSRN WHERE AbsEntry = @list_of_cols_val_tab_del)) > 1
	BEGIN
		SET @error = 10
		SET @error_message =N'Serial Number Exists'
	END
END

Hope it helps.

Kind Regards,

Diego Lother

former_member440545
Participant
0 Kudos

Hi Diego lother,

Thanks for the reply, I tried it But the above transaction query is not working.

When I update the Serial number for the selected item in Serial Number Management -update Screen, it allows the existing Serial Numbers for the updations

Note:Serial Number Management Update Screen. it allows the existing serial numbers for another Item But, i need to block the existing serial numbers

former_member185682
Active Contributor
0 Kudos

Hi Manikandan,

Now I got your situation, I understood before that item2 is a new piece of the same product of item1. But with your last comment I realized that you want avoid that diferents product (itemcodes) have the same serial number.

Then try this:

IF @object_type In ('10000045') AND @transaction_type IN('A','U')
BEGIN
	IF (SELECT COUNT(DistNumber) FROM OSRN WHERE DistNumber = (SELECT DistNumber  FROM OSRN WHERE AbsEntry = @list_of_cols_val_tab_del)) > 1
	BEGIN
		SET @error = 10
		SET @error_message =N'Serial Number Exists'
	END
END

Hope it helps.

Kind Regards,

Diego Lother

former_member440545
Participant
0 Kudos

Hi Diego lother,

Thank you for your reply.I will try this one and update You soon.

former_member440545
Participant
0 Kudos

Hi Diego lother,

This Query is also not working.It also accepts the Duplicate Serial For different items In Serial Number Management Update Screen