Hi Experts
I am trying to make SPTN to restrict Open DNs with same date to a particular BP.
So if a DN exists dated 25/11/14 to this customer a second DN dated 25/11/14 cannot be added unless first delivery note is closed.
I am having problem getting succesful outcome - please can anyone assist?
If @object_type = '15' and @transaction_type ='A'
BEGIN
If Exists (Select T0.DocEntry from [dbo].ODLN T0 INNER JOIN ODLN T1 ON T1.DocDate=T0.DocDate WHERE T0.DocStatus = 'O'AND T0.CardCode='CDOO001')
BEGIN
SELECT @error = -1, @error_message = 'No same day del to this customer'
END
End
Regards,
Karen