Tuesday, 11 February 2014

Check Duplicate PO in Sales Order using BPM in Epicor



Open the Method Directives application (in the standard Epicor menu — Main Menu >> System Management >> Business Process Management >> Setup >> Method Directives).

01-Method Directives

Click the “Method Code” button to open the search window, and search for the Method Name starting at “Update” and the Business Object “SalesOrder.”  Select the “Update” method.

02-Method Search

From the menu or toolbar, select File >> New >> New Pre-Processing.

03-New Pre-Processing

Give your directive the name “Check for Duplicate PO,” and check the “Enabled” and “Prevent Endless Loops” check boxes.

04-New Method

Click the “Conditions” button and then the “Add Line” button.

05-New Condition

Under “User Text” select “number of rows in the designed query…”.

06-Designed Query

Click the “designed query” hyperlink and then give the query a name — “DupPO”, type in the query “for each ttOrderHed no-lock  ,  each OrderHed no-lock  where (OrderHed.CustNum = ttOrderHed.CustNum and OrderHed.PONum = ttOrderHed.PONum and OrderHed.OrderNum <> ttOrderHed.OrderNum )” and then click “OK.”

07-DupPO query

Leave the “is not less than 1″ portion of the condition as is, and click “OK.”

08-Completed Condition

Click the “Actions” button and then the “Add Line” button.

09-Add Action

Select the “show informational message based on the designed template” option.

10-New Action

Click the “designed” hyperlink, and enter the name, severity, and message text.

11-Informational Message

If you want to show the PO number the user entered, click “Insert” and enter the name “PONum”, select the proper table “ttOrderHed”, check all the boxes, and check the “PONum” field name.  Click OK.

12-Select Table Fields

As soon as you save your work, the Method Directive will be called anytime and anywhere the SalesOrder.Update method is called.

13-Informational Message

2 comments:

  1. Has anyone tried to use this for Epicor 10? I could use this, if it worked but the conditions is where I am getting stuck.

    ReplyDelete
  2. Great solution!
    The step-by-step approach to checking for duplicate purchase orders in sales orders using ABL code is incredibly useful. It's a common issue, and your method offers a clear and efficient way to manage it within the system. Thanks for sharing such valuable insights!

    epicforcetech

    ReplyDelete