Skip to Content
0
Former Member
Jul 02, 2011 at 05:47 PM

Block AP Invoice less than PO date ( Udf )

17 Views

Hi All,

I am trying to Make an SP based on the UDF which is there in the AP invoice named as PODate. I want to block the AP invoice if AP Invoice Posting Date or AP Invoice Document Date is less than the Date of the this UDF. This UDF Captures the PO date basically and I want to Block all AP Invoice whose Posting Date is less than the PO Date.

I tried the below SP but could be sucessful.

---AP Invoice vs PO Date
if @transaction_type = 'A' and @object_type ='18'
 begin
 if exists(select T0.docnum from dbo.OPCH T0 where T0.docentry = @list_of_cols_val_tab_del
 and T0.docdate > T0.U_PODATE
BEGIN
 SET @error = 17
 SET @error_message = N'AP Invoice Date less than the PO Date'
 end
 end

Kindly advise.

Regards,

venky