Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 08, 2017 at 01:44 PM

    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

    Add comment
    10|10000 characters needed characters exceeded