Epicor 9, Data Directive InvcHead ABL Code help

Hi Jose and thanks for your reply!!

I tried to move it of that loop and after the next "end.", and did a new loop on the orderhed there, but then it's not doing anything. Also tried find first on invcreminder, but then it is not releasing anything.. probably because im not looping any more?!

Could you maybe give me an example on how to restruct the code? I am a real beginner with ABL coding and don't know how to use the different syntax that well.. sorry for being so troublesome.

Kind regards
Lisa

--- In vantage@yahoogroups.com, Jose Gomez <jose@...> wrote:
>
> You are already looping through All orders for that customer. But then on
> your last loop you are looking at InvcReminders. That's where your problem
> is, you'll have to move your code out of that loop. Maybe do a Find First
> on IvcReminder and then do your logic in the OrderHed loop
>
>
> *Jose C Gomez*
> *Software Engineer*
> *
> *
> *
> *T: 904.469.1524 mobile
> E: jose@...
> http://www.josecgomez.com
> <http://www.linkedin.com/in/josecgomez> <http://www.facebook.com/josegomez>
> <http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
> <http://www.josecgomez.com/professional-resume/>
> <http://www.josecgomez.com/feed/>
> <http://www.usdoingstuff.com>
>
> *Quis custodiet ipsos custodes?*
>
>
> On Mon, Mar 4, 2013 at 8:39 AM, lisassar <lisa.saren@...> wrote:
>
> > **
> >
> >
> >
> >
> > Hi again everybody,
> >
> > I'm so close to the solution right know, I've put the following code in
> > the Data Directive CashHead, when ttCashHead.posted field has changed from
> > false to true. It works all the way excepts it is not releasing orders
> > which don't have an invoice, how can i modify my code to get it to loop
> > through all the orders for the customer, not just the ones with invoices!
> >
> > Help me pleease, would so much appreciate it.
> >
> > define variable vari AS logical no-undo.
> > vari = false.
> >
> > for each ttCashHead where ttCashHead.Company = Cur-comp no-lock,
> >
> > each InvcHead where InvcHead.Company = ttCashHead.Company, each OrderHed
> > where (InvcHead.Company = OrderHed.Company and InvcHead.OrderNum =
> > OrderHed.OrderNum and InvcHead.CustNum = OrderHed.CustNum ).
> >
> > for each InvcReminder where (InvcHead.Company = InvcReminder.Company) and
> > (InvcHead.InvoiceNum = InvcReminder.InvoiceNum) and (InvcReminder.Sequence
> > > 1) no-lock.
> >
> > if invchead.openinvoice = true
> > then invchead.InvoiceComment = "open invoice exist".
> >
> > else do.
> > vari = yes.
> > end. /* end else do */
> > end. /* end invcreminder */
> >
> > if vari = yes
> > then do:
> > if available OrderHed and OrderHed.OpenOrder = true
> > and OrderHed.CheckBox06 = true then
> > OrderHed.orderheld = false.
> > Orderhed.checkbox06 = false.
> >
> > end. /* end invchead */
> >
> > end. /* end for each tt cashhead */
> >
> > Kind regards
> > Lisa
> >
> >
> > --- In vantage@yahoogroups.com, "lisassar" wrote:
> > >
> > > Hi everybody,
> > >
> > > I'm trying to create a Data Directive on the InvcHead that will release
> > all opens sales orders on hold, when all invoices with reminders for that
> > customer are payed. I can't get my code to work the way I want, could
> > anybody of you please have a look at it (using comments no instead of
> > releasing holds)?
> > >
> > > Right now it isn't giving any messages, but it worked earlier to get the
> > invoice comment populated, then I also had the CashHead table in the code,
> > but I don't know if I really need it?!
> > >
> > > And I can't use the ttInvcHead table in the find loop, is it okey for me
> > to use the database table instead? (invchead).
> > >
> > >
> > > for each ttInvcHead where ttInvcHead.Company = Cur-Comp no-lock,
> > >
> > > each InvcReminder where InvcReminder.Company = ttInvcHead.Company
> > > and InvcReminder.InvoiceNum = ttInvcHead.InvoiceNum
> > > and InvcReminder.Sequence > 1 no-lock,
> > >
> > > each OrderHed where Orderhed.Company = ttInvcHead.Company
> > > and OrderHed.CustNum = ttInvcHead.CustNum no-lock:
> > >
> > > find InvcHead where InvcHead.InvoiceNum = InvcReminder.InvoiceNum
> > no-lock.
> > >
> > > if available InvcHead then Assign InvcHead.InvoiceComment = "Reminder
> > left".
> > >
> > > if not available InvcHead and OrderHed.OpenOrder = true and
> > OrderHed.OrderHeld = true then do:
> > > Assign orderHed.OrderComment = "No available reminders".
> > > end.
> > >
> > >
> > > end.
> > >
> > >
> > > Thankful for all help I can get!
> > >
> > > //Lisa
> > >
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>
Hi everybody,

I'm trying to create a Data Directive on the InvcHead that will release all opens sales orders on hold, when all invoices with reminders for that customer are payed. I can't get my code to work the way I want, could anybody of you please have a look at it (using comments no instead of releasing holds)?

Right now it isn't giving any messages, but it worked earlier to get the invoice comment populated, then I also had the CashHead table in the code, but I don't know if I really need it?!

And I can't use the ttInvcHead table in the find loop, is it okey for me to use the database table instead? (invchead).


for each ttInvcHead where ttInvcHead.Company = Cur-Comp no-lock,

each InvcReminder where InvcReminder.Company = ttInvcHead.Company
and InvcReminder.InvoiceNum = ttInvcHead.InvoiceNum
and InvcReminder.Sequence > 1 no-lock,

each OrderHed where Orderhed.Company = ttInvcHead.Company
and OrderHed.CustNum = ttInvcHead.CustNum no-lock:

find InvcHead where InvcHead.InvoiceNum = InvcReminder.InvoiceNum no-lock.

if available InvcHead then Assign InvcHead.InvoiceComment = "Reminder left".

if not available InvcHead and OrderHed.OpenOrder = true and OrderHed.OrderHeld = true then do:
Assign orderHed.OrderComment = "No available reminders".
end.


end.


Thankful for all help I can get!

//Lisa
Hi again everybody,

I'm so close to the solution right know, I've put the following code in the Data Directive CashHead, when ttCashHead.posted field has changed from false to true. It works all the way excepts it is not releasing orders which don't have an invoice, how can i modify my code to get it to loop through all the orders for the customer, not just the ones with invoices!

Help me pleease, would so much appreciate it.

define variable vari AS logical no-undo.
vari = false.

for each ttCashHead where ttCashHead.Company = Cur-comp no-lock,

each InvcHead where InvcHead.Company = ttCashHead.Company, each OrderHed where (InvcHead.Company = OrderHed.Company and InvcHead.OrderNum = OrderHed.OrderNum and InvcHead.CustNum = OrderHed.CustNum ).

for each InvcReminder where (InvcHead.Company = InvcReminder.Company) and (InvcHead.InvoiceNum = InvcReminder.InvoiceNum) and (InvcReminder.Sequence > 1) no-lock.

if invchead.openinvoice = true
then invchead.InvoiceComment = "open invoice exist".

else do.
vari = yes.
end. /* end else do */
end. /* end invcreminder */

if vari = yes
then do:
if available OrderHed and OrderHed.OpenOrder = true
and OrderHed.CheckBox06 = true then
OrderHed.orderheld = false.
Orderhed.checkbox06 = false.

end. /* end invchead */

end. /* end for each tt cashhead */


Kind regards
Lisa




--- In vantage@yahoogroups.com, "lisassar" <lisa.saren@...> wrote:
>
> Hi everybody,
>
> I'm trying to create a Data Directive on the InvcHead that will release all opens sales orders on hold, when all invoices with reminders for that customer are payed. I can't get my code to work the way I want, could anybody of you please have a look at it (using comments no instead of releasing holds)?
>
> Right now it isn't giving any messages, but it worked earlier to get the invoice comment populated, then I also had the CashHead table in the code, but I don't know if I really need it?!
>
> And I can't use the ttInvcHead table in the find loop, is it okey for me to use the database table instead? (invchead).
>
>
> for each ttInvcHead where ttInvcHead.Company = Cur-Comp no-lock,
>
> each InvcReminder where InvcReminder.Company = ttInvcHead.Company
> and InvcReminder.InvoiceNum = ttInvcHead.InvoiceNum
> and InvcReminder.Sequence > 1 no-lock,
>
> each OrderHed where Orderhed.Company = ttInvcHead.Company
> and OrderHed.CustNum = ttInvcHead.CustNum no-lock:
>
> find InvcHead where InvcHead.InvoiceNum = InvcReminder.InvoiceNum no-lock.
>
> if available InvcHead then Assign InvcHead.InvoiceComment = "Reminder left".
>
> if not available InvcHead and OrderHed.OpenOrder = true and OrderHed.OrderHeld = true then do:
> Assign orderHed.OrderComment = "No available reminders".
> end.
>
>
> end.
>
>
> Thankful for all help I can get!
>
> //Lisa
>
You are already looping through All orders for that customer. But then on
your last loop you are looking at InvcReminders. That's where your problem
is, you'll have to move your code out of that loop. Maybe do a Find First
on IvcReminder and then do your logic in the OrderHed loop


*Jose C Gomez*
*Software Engineer*
*
*
*
*T: 904.469.1524 mobile
E: jose@...
http://www.josecgomez.com
<http://www.linkedin.com/in/josecgomez> <http://www.facebook.com/josegomez>
<http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
<http://www.josecgomez.com/professional-resume/>
<http://www.josecgomez.com/feed/>
<http://www.usdoingstuff.com>

*Quis custodiet ipsos custodes?*


On Mon, Mar 4, 2013 at 8:39 AM, lisassar <lisa.saren@...> wrote:

> **
>
>
>
>
> Hi again everybody,
>
> I'm so close to the solution right know, I've put the following code in
> the Data Directive CashHead, when ttCashHead.posted field has changed from
> false to true. It works all the way excepts it is not releasing orders
> which don't have an invoice, how can i modify my code to get it to loop
> through all the orders for the customer, not just the ones with invoices!
>
> Help me pleease, would so much appreciate it.
>
> define variable vari AS logical no-undo.
> vari = false.
>
> for each ttCashHead where ttCashHead.Company = Cur-comp no-lock,
>
> each InvcHead where InvcHead.Company = ttCashHead.Company, each OrderHed
> where (InvcHead.Company = OrderHed.Company and InvcHead.OrderNum =
> OrderHed.OrderNum and InvcHead.CustNum = OrderHed.CustNum ).
>
> for each InvcReminder where (InvcHead.Company = InvcReminder.Company) and
> (InvcHead.InvoiceNum = InvcReminder.InvoiceNum) and (InvcReminder.Sequence
> > 1) no-lock.
>
> if invchead.openinvoice = true
> then invchead.InvoiceComment = "open invoice exist".
>
> else do.
> vari = yes.
> end. /* end else do */
> end. /* end invcreminder */
>
> if vari = yes
> then do:
> if available OrderHed and OrderHed.OpenOrder = true
> and OrderHed.CheckBox06 = true then
> OrderHed.orderheld = false.
> Orderhed.checkbox06 = false.
>
> end. /* end invchead */
>
> end. /* end for each tt cashhead */
>
> Kind regards
> Lisa
>
>
> --- In vantage@yahoogroups.com, "lisassar" wrote:
> >
> > Hi everybody,
> >
> > I'm trying to create a Data Directive on the InvcHead that will release
> all opens sales orders on hold, when all invoices with reminders for that
> customer are payed. I can't get my code to work the way I want, could
> anybody of you please have a look at it (using comments no instead of
> releasing holds)?
> >
> > Right now it isn't giving any messages, but it worked earlier to get the
> invoice comment populated, then I also had the CashHead table in the code,
> but I don't know if I really need it?!
> >
> > And I can't use the ttInvcHead table in the find loop, is it okey for me
> to use the database table instead? (invchead).
> >
> >
> > for each ttInvcHead where ttInvcHead.Company = Cur-Comp no-lock,
> >
> > each InvcReminder where InvcReminder.Company = ttInvcHead.Company
> > and InvcReminder.InvoiceNum = ttInvcHead.InvoiceNum
> > and InvcReminder.Sequence > 1 no-lock,
> >
> > each OrderHed where Orderhed.Company = ttInvcHead.Company
> > and OrderHed.CustNum = ttInvcHead.CustNum no-lock:
> >
> > find InvcHead where InvcHead.InvoiceNum = InvcReminder.InvoiceNum
> no-lock.
> >
> > if available InvcHead then Assign InvcHead.InvoiceComment = "Reminder
> left".
> >
> > if not available InvcHead and OrderHed.OpenOrder = true and
> OrderHed.OrderHeld = true then do:
> > Assign orderHed.OrderComment = "No available reminders".
> > end.
> >
> >
> > end.
> >
> >
> > Thankful for all help I can get!
> >
> > //Lisa
> >
>
>
>


[Non-text portions of this message have been removed]
Hi Jose and thanks for your reply!!

I tried to move it of that loop and after the next "end.", and did a new loop on the orderhed there, but then it's not doing anything. Also tried find first on invcreminder, but then it is not releasing anything.. probably because im not looping any more?!

Could you maybe give me an example on how to restruct the code? I am a real beginner with ABL coding and don't know how to use the different syntax that well.. sorry for being so troublesome.

Kind regards
Lisa

--- In vantage@yahoogroups.com, Jose Gomez <jose@...> wrote:
>
> You are already looping through All orders for that customer. But then on
> your last loop you are looking at InvcReminders. That's where your problem
> is, you'll have to move your code out of that loop. Maybe do a Find First
> on IvcReminder and then do your logic in the OrderHed loop
>
>
> *Jose C Gomez*
> *Software Engineer*
> *
> *
> *
> *T: 904.469.1524 mobile
> E: jose@...
> http://www.josecgomez.com
> <http://www.linkedin.com/in/josecgomez> <http://www.facebook.com/josegomez>
> <http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
> <http://www.josecgomez.com/professional-resume/>
> <http://www.josecgomez.com/feed/>
> <http://www.usdoingstuff.com>
>
> *Quis custodiet ipsos custodes?*
>
>
> On Mon, Mar 4, 2013 at 8:39 AM, lisassar <lisa.saren@...> wrote:
>
> > **
> >
> >
> >
> >
> > Hi again everybody,
> >
> > I'm so close to the solution right know, I've put the following code in
> > the Data Directive CashHead, when ttCashHead.posted field has changed from
> > false to true. It works all the way excepts it is not releasing orders
> > which don't have an invoice, how can i modify my code to get it to loop
> > through all the orders for the customer, not just the ones with invoices!
> >
> > Help me pleease, would so much appreciate it.
> >
> > define variable vari AS logical no-undo.
> > vari = false.
> >
> > for each ttCashHead where ttCashHead.Company = Cur-comp no-lock,
> >
> > each InvcHead where InvcHead.Company = ttCashHead.Company, each OrderHed
> > where (InvcHead.Company = OrderHed.Company and InvcHead.OrderNum =
> > OrderHed.OrderNum and InvcHead.CustNum = OrderHed.CustNum ).
> >
> > for each InvcReminder where (InvcHead.Company = InvcReminder.Company) and
> > (InvcHead.InvoiceNum = InvcReminder.InvoiceNum) and (InvcReminder.Sequence
> > > 1) no-lock.
> >
> > if invchead.openinvoice = true
> > then invchead.InvoiceComment = "open invoice exist".
> >
> > else do.
> > vari = yes.
> > end. /* end else do */
> > end. /* end invcreminder */
> >
> > if vari = yes
> > then do:
> > if available OrderHed and OrderHed.OpenOrder = true
> > and OrderHed.CheckBox06 = true then
> > OrderHed.orderheld = false.
> > Orderhed.checkbox06 = false.
> >
> > end. /* end invchead */
> >
> > end. /* end for each tt cashhead */
> >
> > Kind regards
> > Lisa
> >
> >
> > --- In vantage@yahoogroups.com, "lisassar" wrote:
> > >
> > > Hi everybody,
> > >
> > > I'm trying to create a Data Directive on the InvcHead that will release
> > all opens sales orders on hold, when all invoices with reminders for that
> > customer are payed. I can't get my code to work the way I want, could
> > anybody of you please have a look at it (using comments no instead of
> > releasing holds)?
> > >
> > > Right now it isn't giving any messages, but it worked earlier to get the
> > invoice comment populated, then I also had the CashHead table in the code,
> > but I don't know if I really need it?!
> > >
> > > And I can't use the ttInvcHead table in the find loop, is it okey for me
> > to use the database table instead? (invchead).
> > >
> > >
> > > for each ttInvcHead where ttInvcHead.Company = Cur-Comp no-lock,
> > >
> > > each InvcReminder where InvcReminder.Company = ttInvcHead.Company
> > > and InvcReminder.InvoiceNum = ttInvcHead.InvoiceNum
> > > and InvcReminder.Sequence > 1 no-lock,
> > >
> > > each OrderHed where Orderhed.Company = ttInvcHead.Company
> > > and OrderHed.CustNum = ttInvcHead.CustNum no-lock:
> > >
> > > find InvcHead where InvcHead.InvoiceNum = InvcReminder.InvoiceNum
> > no-lock.
> > >
> > > if available InvcHead then Assign InvcHead.InvoiceComment = "Reminder
> > left".
> > >
> > > if not available InvcHead and OrderHed.OpenOrder = true and
> > OrderHed.OrderHeld = true then do:
> > > Assign orderHed.OrderComment = "No available reminders".
> > > end.
> > >
> > >
> > > end.
> > >
> > >
> > > Thankful for all help I can get!
> > >
> > > //Lisa
> > >
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>