Alert ,essage in Purchase Lines

I pretend alert My user, if he creates a new line in purchase line with the same Item No. that was already inserted in tthe same purchase line? how can I do That?

I Tryed this on Table Purchase Line on No. Validate
IF (“No.” = PurchLine2.“No.”) THEN
MESSAGE(‘There is already one item with the same no. inserted, try another one’);

You need to filter on PurchLine2 with Document type,document no and type and no then if you find the line then show the message…

hope its clear…

Where do I have to Put this mesage

On Tale Insert Triger or in No. - OnValidate()

PurchLine2.SETCURRENTKEY(“Document Type”,“Document No.”,“Line No.”);
PurchLine2.SETFILTER(“Document No.”,“Document No.”);
PurchLine2.SETFILTER(“No.”,“No.”);
IF (“No.” = PurchLine2.“No.”) THEN

MESSAGE(Hello);

Put it in No. Onvalidate

PurchLine2.SETRANGE(“Document Type”,“Document Type”);

PurchLine2.SETRANGE(“Document No.”,“Document No.”);

PurchLine2.SETRANGE(“Type”,“Type”);
PurchLine2.SETRANGE(“No.”,“No.”);

IF Not PurchLine2.ISEMPTY THEN

MESSAGE(Hello);

HI There,

You may change your code in No.-OnValidate trigger as follows:

PurchLine2.SETCURRENTKEY(“Document Type”,“Document No.”,“Line No.”);
PurchLine2.SETFILTER(“Document No.”,“Document No.”);
PurchLine2.SETFILTER(“No.”,“No.”);
IF PurchLine2.COUNT >= 1 THEN
MESSAGE(‘Hello’);