Business Scenario

- An approval process can be set up for sales, purchasing and inventory documents. In the business scenario shown here, there is a requirement to approve internal purchases and expenses over a certain limit. The purchase requests or purchase orders for these expenses should be approved by the a manager before they can be added.
- Approval processes can be established for a wide range of documents in SAP Business One. You can use an approval procedure whenever the work procedure requires an approval before a user can generate certain documents, for example, purchase requests or purchase orders.
- If the value of the document exceeds the limit, the approval procedure will block the document until it is approved.
- Approval procedures can also be used in the sales process, in outgoing payment processing, in inventory receipt and transfers, and in stock counting.
Basic Approval Workflow

- In the approval process, a user who is subject to an approval procedure is known as the originator. When the originator adds a document that meets predefined approval conditions, the originator is notified and the document is saved as a draft. The document has the status Draft [Pending].
- The originator will not see this draft document when browsing through records, but can access it from the Document Drafts report.
- The draft document must be approved before it can be generated as a document. An internal request is sent to the pre-defined approvers. This request appears in the Messages/Alerts Overview popup window and the approver can drill-down to view the draft document. If the mobile application is integrated, approvals can be done from a mobile phone.
- If the approver rejects the document, an internal message goes back to the originator with a link to the rejected document. The originator can modify the document, and if the approval condition is no longer met, the document can be added to the system as a normal document. If the approval condition is still met, another approval procedure will start.
- If the document is approved at the first approval stage, an approval request is sent to the next approval stage (if applicable). If the document is approved at the final approval stage, an internal message goes back to the originator with a link to the draft document. The originator can now add the document.
- After a document has been approved, it has the status Approved in the title.
Setting Up an Approval Process

Let's see how to set up an approval process.
Activation

You first need to first activate approval process functionality in the system. In the General Settings, choose the BP tab and select the Enable Approval Process checkbox.
Note that this is a system-wide setting - once you have created and activated any approval templates, you cannot disable the approval functionality from here but you can deactivate the individual approval templates.
In this window you can also optionally enable approval process functionality for the DI API. This is of most interest to providers of add-ons. The DI API provides methods to trigger an approval process and save the draft document. You can also use the DI API to approve draft documents.
Three additional checkboxes permit updating documents that have been generated by an approval process, and/or documents that are still in an approval process and waiting for an approval. These will be covered later in this course.
Approval Templates and Stages

To set up an approval process you define approval stages and approval templates:
- Approval stage is a list of named approvers who can approve a document at the same level
- Approval template combines the originators, the documents that require approval, the criteria for approval, and one or more approval levels
The approval stages are separate from the approval template and you can reuse approval stages in other templates.
The approval template allows you to model an entire approval process. You can define multiple approval templates for different sets of users or documents, and with different criteria. Only the document types selected in the approval template will trigger an approval process, and only when added by an originator.
Approval Process Authorizations

To set up an approval process, you need the general authorizations as shown here under the subject Approval Process:
- Approval stages - to define and maintain approval stages
- Approval Templates - to define and maintain approval templates
- Approval Status Report - to view pending approval requests
- Approval Decision report - to view and approve pending approval requests
Setup - Approval Stages

Before you create an approval template you should define the approval stages.
All approvers must first be defined as users in SAP Business One.
It is a good practice to include more than one user in a stage to allow for staff absences and holidays. You can specify a minimum number of approvals required from the pool of approvers.
The approval stage is saved in the system and can later be combined with other approval stages to create a multi-stage approval procedure. When you combine stages, make sure the same user is not defined in multiple stages.
In the slide example, we have defined two approval stages. In the first stage there are two purchasing users who can approve a purchasing document, but we only need an approval from one of them. Similarly in the second stage there are again two approvers but approval is required from only one of them.
The two stages are independent but we can combine them in the correct order in the approval template.
Setup - Approval Templates

- On the Originators tab, select the users who are subject to approval when they create documents. All originators must be first defined as users in SAP Business One.
- Only users specified here are subject to an approval process. A user who is not specified as an originator can add or update a document with no approval.
- Note that the system prevents a user from modifying an approval template if they are selected as an originator in the template. This does not apply to super users.
- Originator cannot disable the approval process in the General Settings, even if they are super users.
- Note: The approval process also applies when an originator generates documents by batch using the document generation wizard. One approval request is sent for each document that needs approval; in other words, each document follows its own approval process.
Documents Tab

- In the Documents tab, you select the document types that require approval when added by an originator. The approval process will apply to every instance of the document type selected here, when created by a user specified on the Originators tab.
- Both sales and purchasing document types can be selected in one template; however, if the conditions on the terms tab or the approvers will be different you should create separate approval templates.
- The system will not allow you to combine sales and purchasing document types with inventory or payment document types in the same template. You will need to create separate templates.
- Note that approval template for an outgoing payment, only applies to manual payment, and will not be activated for outgoing payment created by the payment wizard.
Stages Tab

- In the Stages tab, you include one or more of the predefined stages.
- The sequence that the stages are listed in the template becomes the order for a multi-level approval process.
- You can rearrange the sequence using the up and down arrows.
Terms Tab

In the Terms tab, you set the criteria for the approval:
- The default is Always. The selected document types will always go for approval when created by the originator.
- You can choose a predefined term. The predefined terms available in the template vary according the document types selected, but they cover common situations, such as a discount or total that exceeds a set value. In this example, we have specified the condition that the document total is over 500.
- Depending on the selected document for approval, different conditions are displayed.
- You can choose to add your own conditions using a user query. This allows you to model more complex approval conditions.
Note that the predefined terms for discount and total operate only on the header level of the document, not at the row level.
Using Predefined Terms

- When using a predefined term, you can select an operator such as "greater than" or "equal", and enter a value for comparison.
- You can also select "In range" or "Not in range" as the ratio, and enter two values for the range, from low to high, separated by a hyphen.
- You can select more than one predefined term. In this case an approval process will be triggered if just one of the predefined terms is met. In the example shown here, that means if the total amount of the document is greater than 500, or the quantity is between 5 and 200.
Activating an Approval Template

The Active checkbox in the approval template is set by default. You can deselect this checkbox if you want to set up the approval process now and activate it at a later time. You can deactivate an approval process at any time by deselecting the checkbox, as long as you are not the originator, although you should make sure there are no current documents pending approval.
The Active when Updating Documents Not Generated by Approval Process checkbox is also checked by default. This covers the condition whereby an originator updates a document that was not originally generated upon approval. This could be because it was created by another user not specified as an originator, or because it did not meet the approval criteria when the originator first added it.
If you set this checkbox a new draft is created and an approval process will be triggered if the update causes the document to meet the approval criteria. For example: the originator creates and saves a sales quotation normally, with no discount. Later the originator updates the sales quotation to add discount and this requires an approval.
If an approval request was sent for updates to an existing document, the following operations will not be possible until the approval process ends or is canceled:
- Updating the document
- Closing the document
- Canceling the document
- Creating new documents based on the document
For example, you cannot copy a sales order to an A/R invoice, create an inventory transfer request or an item transfer (inventory transfer) based on a sales order, or generate a pick list based on a sales order.
If any updates are required, apply them to the draft awaiting approval.
Managing the Approval Process

Let's see the flow and status of a document during an approval process.
Document Status During Approval Process

- The originator receives a popup window when they add a document that triggers an approval process. In this window the originator can optionally enter remarks for the approvers.
- The document is saved with status [Draft Pending] and a request for approval is sent to each of the approvers.
- The approvers are notified in the Messages/Alerts Overview popup window. From this window they can open the approval request, drill-down to view the draft document, and either approve or reject the document.
- If the document is approved the status becomes [Draft Approved] until the originator adds the document, when the status becomes [Approved].
- If the document is rejected the status is [Draft Rejected]. The originator can access and update the draft.
Monitoring an Approval Process

- During an approval process, the originator can monitor their approval requests using the Approval Status Report.
- Approvers can use the Approval Decision Report to see all documents that require their approval. From this report they can approve or reject multiple documents.
Canceling an Approval Process

If, for example, a document error is noticed after the document was sent for approval, the approval process can be cancelled.
The Approval Status Report permits an originator (or an approver) to request a cancelation of a current approval process. Select the row for the document and right-click then choose Cancel from the context menu. You can also cancel the approval process by choosing the Data > Cancel menu.
After this, the document cannot be added to the system and cannot be updated.
You can restore a canceled approval process the same way. Restoring an approval procedure cannot applied to documents that originally created without approvals, and were updated at a later point.
Summary of Document Statuses

This slide shows a summary of the document statuses that can be set during an approval process.
Document Numbering and Draft Keys

When a draft document is saved pending approval, it is assigned a document number. This is simply a draft document number and the actual document number is assigned only when the draft is approved and saved by the originator.
Since there can be a time lag before the document is approved, and the originator can work on other documents, the actual document number will often differ from the draft document number. For example, a sales order is assigned draft key 727 and sent for approval. The originator then creates sales orders 727 which do not require approval. When the first sales order is approved and the originator saves it, it will be assigned the next available number in series, for example, 728.
Document Updates During Approval Process

- A document that has been approved by an approval process has the status Draft [Approved]. When the originator adds this document to the system, the status will change to [Approved]. An originator can update this approved document if the checkbox 'Enable Updating the Document Generated/Updated by Approval Process' is set in the General Settings. If the updated document still meets the approval criteria a new approval process will be started.
- A document that is pending approval has the status Draft [Pending]. An originator can make changes to this draft document, even when it is pending approval, if the checkbox 'Enable Originator to Update the Document Draft in Pending/Approved Status' is set in the General Settings. If the updated document still meets the approval criteria a new approval process will be started and the current approval process will be cancelled. If the updated document no longer meets the approval criteria (for example changing the discount % from 15 - 13%) the document can be added as a normal document, without the status [Approved].
- The checkbox Enable Authorizer to Update Document Draft in Pending Status will allow the authorizer to update the draft, while in pending status. In this case, no matter if the terms of the approval is met or not, the draft remains in pending status, waiting for approval.
Note: If the checkboxes are NOT set, the originator can change certain fields in the draft document, including: Document remarks, Journal entry remarks, Opening and Closing remarks (in right-click menu), attachments and UI elements.
Multiple Approvers in a Stage

- When you specify multiple approvers at the same stage, they have equal authorization level.
- You need to consider the effect of multiple approvers at the same stage.
- In this example, the minimum required number of approvers is 1.
- One of the approvers approves the document. Later on, another approver rejects the same document.
- But this rejection has no effect if it happens after the first approval. Since only one approval is required, the document is approved and can be added to the system.

- In the second scenario, one of the approvers rejects the document. The document is held as pending until the other approvers respond.
- If all the approvers reject the document, the originator is alerted that the document has been rejected.
- But if another approver approves the document, and the minimum number of required approvers is reached, then the document is approved and the originator can add the document to the system.
Print Preferences

- When a document is in an approval process, you can prevent it from being exported, printed, emailed or faxed. These preferences are set on a per document basis in the Print Preferences window (Per Document tab).
- The user will get an error message when they attempt to perform a function if the checkbox is set.
- Note that the checkboxes are not checked by default.
Using Queries in Approval Processes

You can define your own approval criteria using saved user queries.
Using Queries as Terms

- You can add saved user queries to the terms for an approval process. The queries are added at the bottom of the approval templates form and can be used instead of the predefined terms, or together with predefined terms. This allows you to develop customized approval scenarios with much more granular conditions.
- For example, if we want an approval process to apply to item type purchase orders over 500 and to service type purchase orders over 250, we can write a query to check for both conditions. The predefined terms do not apply at this level of granularity as they do not distinguish between the type of document.
Combining Predefined Terms and Queries

- When predefined terms are combined with a query in an approval template, the approval process will start if just one of the conditions is met. In other words, the conditions are evaluated using OR logic.
- For example, if we combine the predefined term "Deviation from Budget" with the query previously mentioned for item and service type purchase orders, then the approval process will trigger if the document puts the budget over 500 or if one of the query conditions is met.
Query Syntax for Approval Procedures

- When you write a query to be used in an approval process, the query must reference the current document in the active window. The active window is the one the originator is working in as the document has not yet been saved to the database.
- To refer to a field in the active window, you must include a $ sign in front of the field and surround the field with square brackets.
- The query can also refer to fields from records in the database, for example, to select a field from the current document's business partner master data. In this case the $ sign is not needed for these fields as they are picked up from the database.
- The query must also use the SELECT DISTINCT 'TRUE' clause, so that the result is a TRUE statement if there are results from the query. A TRUE statement will trigger an approval process; a FALSE statement will not.
- The query can only reference fields in the document header, not at the row level. Row level fields require a stored procedure in the database.
- In the query shown here there are two conditions, and a $ sign is used with the DocType and DocTotal fields in the active purchase order document. The sample query is shown for SAP HANA syntax.
Queries for Multiple Document Types

If you use a query in an approval template with multiple document types selected, then the query must be able to work with the multiple document types (for example, all sales and purchase documents).
- If you use the table and field name syntax, the query includes the table name so can only be used with a single document type.
- If you use the item number and column syntax, the query does not include the table name and can be used with multiple document types of a similar structure, for example, all sales and purchasing documents.
- To use the item number syntax, add a second $ sign in front of the item number, within the brackets, to indicate that the item syntax is used. The column number is always 0 in approval procedure queries, since the query can only refer to fields in the header of a document.
- When using the item number and column syntax, the field is fetched as a string so if you need the result in a different format you need to specify the format after the column number. The formats are:
- 0 - which is the default string format
- Number - which returns the result as a numeric that you can use in calculation or comparison operators.
- Currency - which returns the currency symbol from a field that holds both the amount and the currency symbol, such as the DocTotal.
- Date - which should only be used if the field is a date field. The date is returned in a format for use in calculation or comparison operators.
Active Window Query Examples

- When you reference a field in the active window, you can use either the table and field name or the item and column number syntax. To see the item and column number, and the table and field name, for a field in a document or form, use System Information.
- In the example on the left, the query can only be run on a purchase order in the active window since the purchase order table name OPOR is included in the query.
- The query on the right can be used in an approval template where multiple marketing documents are selected. The query works because the document type field is always item number 3 and the document total is always item number 29 in all marketing documents. The column number is always 0 for header fields. In the slide example, the result is compared to 250. Since the DocTotal field in the active window includes the currency symbol, specifying .number after the column number will extract just the amount for the comparison operation.
- For more information on System Information and the query syntax, see the Queries topic in this unit.
Testing a Query for Approval Procedures

- It is a good practice to test a new query before you include it in the approval template.
- To test a query that refers to the active window, create a document that meets the approval conditions. Keep this document in the active window and run the query from the Tools menu. The query should return a true result.
Summary
- Approval processes can be established for various sales, purchasing, inventory and payment documents
- To set up an approval process, first enable the functionality in the General Settings, then define approval stages and approval templates. All originators and approvers must be SAP Business One users
- To create a multi-level approval procedure, combine multiple predefined stages in the approval template.
- In the approval template you can set conditions for an approval process:
- If you choose "always", an approval will be launched for every document type selected in the template.
- You can select a predefined condition, and/or add your own user query containing the conditions.
- Safeguards are in place to prevent documents from being updated after approval or while pending approval. There are checkboxes in the General Settings to permit these updates. In the approval template there is a checkbox to trigger an approval process when an originator updates a document that did not go through an approval process originally
- An approval process can be cancelled by an originator or approver
- When you write a query for an approval template, you reference the current document in the active window (it has not yet been saved to the database) and the query must select a true response. To reference fields in the active window, include a $ sign in front of the square brackets. If the query needs to work with multiple document types with the same structure, use the item and column number syntax and include an additional $ sign within the square brackets.