Skip to Content
0
Nov 22, 2012 at 08:30 AM

Validation At Row level

98 Views

Dear All,

I have created batch named udf on detail level of marketing document.

In GRPO, i have to check duplicate batch No. (Means Batch no should be unique)

My Code:

IF @object_type='20' AND @transaction_type='A'

BEGIN

DECLARE @BATCH_NO AS VARCHAR(100)

SET @BATCH_NO=(SELECT ISNULL(U_BATCH,'') FROM PDN1 WHERE U_BATCH IN (SELECT U_BATCH FROM OPDN T0 INNER JOIN PDN1 T1 ON T0.DocEntry=T1.DocEntry WHERE T0.DocEntry=@list_of_cols_val_tab_del))

IF @BATCH_NO<>''

BEGIN

Select @error = 10, @error_message = 'Batch no cannot be duplicate!!!'

END

END