purchase order validation

Hi all!!! i want a validation in my purchase order that if it gets a value in Purchase price of the specific item then it should not be changed in the direct unit cost, other wise it should allow to enter a value in the PO line. i have written the below written code on the onvalidate of direct unit cost:-

IF CurrFieldNo = FIELDNO("Direct Unit Cost") THEN BEGIN

IF("Document Type"="Document Type"::Order) AND (xRec."Direct Unit Cost" <> "Direct Unit Cost")

THEN ERROR('Direct unit cost cannot be changed.'); END;


please help to add the code for checking the price in purchase price table.