Script to close old open orders (V8.03)

Calvin,


I'm facing the same problem as we move towards E10. I was thinking of a different approach and it uses the BO calls as suggested by Tom.


The customization method would work, but I think you could also use an updateable dashboard. It's more manual effort marking each order to be processed, but it's less code in the long run. I believe that closing the order via the UI will also mark each line/release as closed as well, so you really only need to focus on Orderhed for the update.


My plan was to try this in a test db to make sure, but maybe it'll work for you as well.


mike

We have about 1500 old orders that are marked as open, that we'd like to close.  Instead of opening each one up and selecting Actions->Order->Close Order, I'd like to automate it.


I was thinking of creating a BPM that triggers on something unique, checks to make sure I'm the user, and then does the voodoo to close the orders matching my criteria.  


My question is... 


Can I just set the OrderRel.OpenRelease, OrderDtl.OpenLine, OrderHed.OpenOrder, fields to 0 (like the following pseudo code)?


for each OrderHed WHERE OrderHed.OrderDate < 12/31/2014 AND OrderHed.OpenOrder = 1:

  for each OrderDtl WHERE OrderDtl.OrderNum = OrderHed.OrderNum AND OrderDtl.OpenLine = 1:

    for each OrderRel WHERE OrderRel.OrderNum = OrderDtl.OrderNum AND OrderRel.OrderLine = OrderDtl.OrderLine AND OrderRel.OpenRelease = 1:

      OrderRel.OpenRelease = 0.

    end.

    OrderDtl.OpenLine = 0.

  end.

OrderHed.OpenOrder = 0.

end.


Or does the "Close Order" function from the menubar do other stuff behind the scenes?  


If so, is there a way to call that function within BPM?


Thanks in advance,


Calvin

Typically for stuff like this,

Â

I would suggest a customization on a different form (such as ABC Codes or Data Tag Maintenance or UD01 Setup),

Â

And instead of manually setting each field to 0, you’ll be safer to get in the habit of making direct BO calls.

Â

Essentially: Connect to the SO adapter, create a criteria search to grab them all, and loop through that list, calling the BO Method to close the sales order. If you’re not sure which method you need to call, you can do a trace to see what method the application uses when you close an order.

Â

Tom Mueller

Â

Â

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Monday, February 29, 2016 8:42 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Script to close old open orders (V8.03)

Â




We have about 1500 old orders that are marked as open, that we'd like to close. Instead of opening each one up and selecting Actions->Order->Close Order, I'd like to automate it.

Â

I was thinking of creating a BPM that triggers on something unique, checks to make sure I'm the user, and then does the voodoo to close the orders matching my criteria. Â

Â

My question is...Â

Â

Can I just set the OrderRel.OpenRelease, OrderDtl.OpenLine, OrderHed.OpenOrder, fields to 0 (like the following pseudo code)?

Â

for each OrderHed WHERE OrderHed.OrderDate < 12/31/2014 AND OrderHed.OpenOrder = 1:

  for each OrderDtl WHERE OrderDtl.OrderNum = OrderHed.OrderNum AND OrderDtl.OpenLine = 1:

   for each OrderRel WHERE OrderRel.OrderNum = OrderDtl.OrderNum AND OrderRel.OrderLine = OrderDtl.OrderLine AND OrderRel.OpenRelease = 1:

   OrderRel.OpenRelease = 0.

  end.

  OrderDtl.OpenLine = 0.

 end.

OrderHed.OpenOrder = 0.

end.

Â

Or does the "Close Order" function from the menubar do other stuff behind the scenes? Â

Â

If so, is there a way to call that function within BPM?

Â

Thanks in advance,

Â

Calvin