AP INVOICE DATE and RECEIPT DATE BPM

This code works in a BPM Method on ApInvoice.Update - PRE-Processing. Only when modifying the line record (after you created the line). It pops the message only when you modify the line.

If you want to pop up this message when creating a new record, it will need to be under InvoiceSelectedLines Method. Unfortunately, that method is not available in Vantage 8.03.409c!! Any alternate way to do it??
Hi all,
I need to show up a message in AP Invoice Entry, when a new receipt is added or updates and if the Invoice date(header) is less than Receipt Date(Line). I tried the following code in APInvoice.update in pre-processing.

define var x as date.
define var y as date.

Find first ttAPInvDtl where ttapinvdtl.PackSlip<>"" and ttapinvdtl.RowMod='A' or ttapinvdtl.RowMod='U' no-error.
if available ttapinvdtl then do:
find first RcvHead WHERE RcvHead.Company = Cur-Comp
and RcvHead.PackSlip = ttAPInvDtl.PackSlip no-lock no-error.
if available RcvHead then do:
assign y = rcvhead.ReceiptDate.


find first APInvHed where APInvHed.Company = ttAPInvDtl.Company
and APInvHed.VendorNum = ttAPInvDtl.VendorNum
and APInvHed.InvoiceNum = ttAPInvDtl.InvoiceNum
no-lock no-error.
if available apinvhed then do:
assign x= apinvhed.InvoiceDate.
if(y>x) then do:

{lib/Publishinfomsg.i &InfoMsg = "'Test'" }.

end.
end.
end.
end.

When I add a new receipt and modify the line, its working. But if i just add a new receipt and save it, its not. Please help.
I cant use method APInvoice.InvoiceSelectedLines, as I am in Vantage 8.03.409c.
Sure no problem! I have the MagicFix function installed on my laptop, the first of it's kind! You make a wish and the MagicFix function takes care of the rest!

More specifics on an issue usually help he process...



Joshua Giese

CTO

920.437.6400 Ext. 337

Site ID: 27450-E905700B2-SQL64

----- Original Message -----

From: sanjay219@...
To: vantage@yahoogroups.com
Sent: Friday, April 19, 2013 9:40:57 AM
Subject: [Vantage] Re: AP INVOICE DATE and RECEIPT DATE BPM



HELP PLEASE!!





[Non-text portions of this message have been removed]
I would try to assign 'x' a value even if apinvhed is not available, that could be the case when you just add a new receipt and save it.
something like:

if available apinvhed then do:
> assign x= apinvhed.InvoiceDate.
else
assign x= ttAPInvHed.InvoiceDate.


--- In vantage@yahoogroups.com, "sanjay219@..." <sanjay219@...> wrote:
>
> Hi all,
> I need to show up a message in AP Invoice Entry, when a new receipt is added or updates and if the Invoice date(header) is less than Receipt Date(Line). I tried the following code in APInvoice.update in pre-processing.
>
> define var x as date.
> define var y as date.
>
> Find first ttAPInvDtl where ttapinvdtl.PackSlip<>"" and ttapinvdtl.RowMod='A' or ttapinvdtl.RowMod='U' no-error.
> if available ttapinvdtl then do:
> find first RcvHead WHERE RcvHead.Company = Cur-Comp
> and RcvHead.PackSlip = ttAPInvDtl.PackSlip no-lock no-error.
> if available RcvHead then do:
> assign y = rcvhead.ReceiptDate.
>
>
> find first APInvHed where APInvHed.Company = ttAPInvDtl.Company
> and APInvHed.VendorNum = ttAPInvDtl.VendorNum
> and APInvHed.InvoiceNum = ttAPInvDtl.InvoiceNum
> no-lock no-error.
> if available apinvhed then do:
> assign x= apinvhed.InvoiceDate.
> if(y>x) then do:
>
> {lib/Publishinfomsg.i &InfoMsg = "'Test'" }.
>
> end.
> end.
> end.
> end.
>
> When I add a new receipt and modify the line, its working. But if i just add a new receipt and save it, its not. Please help.
>
Thanks for the reply,
Unfortunately, it is NOT working either!
define var x as date.
define var y as date.
{lib/Publishinfomsg.i &InfoMsg = "'check'" }.

Find first ttAPInvDtl where ttapinvdtl.PackSlip<>"" and ttapinvdtl.RowMod='A' or ttapinvdtl.RowMod='U' no-error.

if available ttapinvdtl then do:

find first RcvHead WHERE RcvHead.Company = Cur-Comp
and RcvHead.PackSlip = ttAPInvDtl.PackSlip no-lock no-error.

if available RcvHead then do:
assign y = rcvhead.ReceiptDate.



find first APInvHed where APInvHed.Company = ttAPInvDtl.Company
and APInvHed.VendorNum = ttAPInvDtl.VendorNum
and APInvHed.InvoiceNum = ttAPInvDtl.InvoiceNum
no-lock no-error.
if available apinvhed then

assign x= apinvhed.InvoiceDate.
else
assign x= ttapinvhed.InvoiceDate.
if(x<y) then do:

{lib/Publishinfomsg.i &InfoMsg = "'Test'" }.


end.
end.
end.