Skip to Content
0

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

Nov 08, 2017 at 06:39 AM

116

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

DIEGO LOTHER Nov 08, 2017 at 01:44 PM
0

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

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0

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

0
Former Member
DIEGO LOTHER

Hi Diego lother,

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

0
Former Member

Hi Diego lother,

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

0