Sei sulla pagina 1di 36

Invoice Approval Workflow

An Oracle White Paper February 2005

Invoice Approval Workflow

Introduction...................................................................................... 3 Scope ................................................................................................ 3 Overview ...................................................................................... 3 Pre-requisites ................................................................................ 4 Features......................................................................................... 4 Setup ............................................................................................. 5 HRMS......................................................................................... 5 Sysadmin ................................................................................... 7 Oracle Approvals Management (OAM)................................. 10 Attribute............................................................................... 11 Conditions ........................................................................... 12 Actions................................................................................. 13 Action Group ...................................................................... 15 Rules.................................................................................... 15 Test ...................................................................................... 19 Oracle Payables ...................................................................... 22 Simulation ................................................................................... 23 Troubleshooting ......................................................................... 29 Technical Overview of Invoice Approval Flow.................... 29 Tables Related to Invoice Approval ...................................... 30 Workflow Tables ................................................................ 30 AME Tables ......................................................................... 31 Invoice Approval Program Flow........................................ 31 How to Track the Workflow Process ................................ 33 Conclusion...................................................................................... 35

Invoice Approval Workflow

Page 2

Invoice Approval Workflow

INTRODUCTION

In todays world, business conglomerates and MNCs process huge number of invoices daily. Approving all the invoices by the appropriate authority is a painful process. Payables Invoice Approval Workflow process automate the approval process.
SCOPE

Scope of this white paper is as follows: Setup details involved in o o o Oracle Payables Oracle Approval Management Workflow

A full Cycle explaining the usage of Invoice Approvals This paper will not cover general AME details and Worflow details Trouble shooting of Invoice Approval Workflow
Overview

What do you mean by Invoice Approval Workflow? It is a workflow process that enables you to automate the approval process. It helps in customizing and setting approval methodology based on: o o o Approver Sequence of approval Criteria for approval

In what cases Invoice Approval workflow will not apply? o o o When the Expense Report is imported In the case of Recurring invoices, if approval is not required as per the template For those invoices before this feature is enabled

Invoice Approval Workflow

Page 3

For invoices which are already processed

Pre-requisites

What are the basic requirements to enable the Invoice Approval Workflow? o o Oracle Payables Patchset 11i.AP.I (2266251) and above Oracles Approval Management with following patches (2198768,2220334,2228792,2257526,2271164,2274701)

Features

The approval can be submitted through: o o Invioces > Actions > Initiate Approval Concurrent Program Invoice Approval Workflow

The approval can be done through o o E-mail Workflow notification

If the invoice is rejected, user has three options: o o o Force approve the invoice or Cancel the invoice or Re-submit the invoice

Invoice can be re-submitted only if Approval Status is Required/Not Required/Rejected/Approved using Invoices > Action > Initiate approval only If Require Validation before approval is enabled in Payable Options, then Invoice must be validated before approval If you submit the approval using Invoice approval workflow, then invoice must meet following criteria for selection: o o Should be validated if Require Validation before approval is enabled in Payable Options Approval Status should be o o o Required Other than Initiated or Manually approved

Invoice amount equals distributions total

Invoice Approval Workflow

Page 4

o o

Ready for approval is checked for invoice Requestor field should not be null

Setup

As far as setup is concerned with regard to Invoice Approval Workflow, it involves o o o o o


HRMS

HRMS Sysadmin Oracle Approvals Management (AME) Workflow Payables

In HRMS, you need to create employees and assign supervisors. In our test case, we are going to create the following employees and their supervisors: Employee Name The Clerk The Supervisor The Manager Supervisor Name The Supervisor The Manager The CEO

Invoice Approval Workflow

Page 5

Invoice Approval Workflow

Page 6

Sysadmin

In System Adminstrator Responsibility, you need to create the following users and assign them the following responsibilities: User Name THE CLERK THE SUPERVISOR THE MANAGER THE CEO Responsibilites (minimum responsibilities to be assigned) Payables, Approval Management (OAM), Workflow Payables, Approval Management (OAM), Workflow Payables, Approval Management (OAM), Workflow Payables, Approval Management (OAM), Workflow

Invoice Approval Workflow

Page 7

Following are the screenshots of the above:

Invoice Approval Workflow

Page 8

Invoice Approval Workflow

Page 9

Oracle Approvals Management (OAM)

In Oracle Approvals Management, You need to create a Rule for the Transaction Type Payables Invoice Approval. In our test case, we will see how to create a Rule in AME for Payables Invoice Approval. We will not be going indepth about Oracle Approvals Management in this white paper. To create a rule in Approval Management, we need to create the following and then attach to the rule: 1. Attribute An attribute is a business variable that has exactly one value for a given transaction. Examples are Invoice Amount, Invoice Lookup Type, Payment terms etc., 2. Condition The IF part of an approval rule is the condition. It may consistis of one or more conditions each of which is either true or false. For a rule to apply to a transaction, all the condition must be true for the transaction. We can create conditions based on the attributes. Ordinary header condtions are based on columns of the Invoice Header i.e, AP_INVOICES_ALL table Example are if the INVOICE_AMOUNT <= 5000 US Dollars Ordinary line item conditions are based on columns found in the invoice distributions i.e, AP_INVOICE_DISTRIBUTIONS_ALL table Examples are DISTRIBUTION_LINE_TYPE_LOOKUP_CODE, DISTRIBUTION_AMOUNT etc., 3. Actions An Action is an instruction to AME to modify a transaction's approval process in some fashion. An approval rule's "then" part (its "consequent") consists of one or more actions. Actions that modify a transaction's approver list are approval actions or simply approvals. Actions that generate a production (a variable-name/value pair) are production actions.

Invoice Approval Workflow

Page 10

Once we create the above for the transaction type Payables Invoice Approval, we need to create a rule and attach the above for the rule. Following are the screenshots of how to create an attribute, condition and approval and then attach all these to a rule.
Attribute

Responsibility: AME Application Administrator N > Approvals > Attributes 1. Change the transaction type to Payables Invoice Approval from the list of values and select the continue button. 2. Scroll to the end of the attributes page and select the Add Attribute button. 3. Select the header attribute button. 4. Select Create New Name button from the Create an Attribute. 5. Enter SUPPLIER INVOICE AMOUNT in the name field and select the continue button. 6. Select an Attribute type of currency. 7. Enter Invoice amount in the description field. 8. Select static usage as no. Attribute usages define how the value is determined at the run time. If it is a static usage, then you can define a constant value for the transaction type. If it is a dynamic usage, then you need to define a SQL query for the transaction type that uses the attribute. In our case, it is a dynamic usage and the following SQL query is used select fnd_number.number_to_canonical(ai.INVOICE_AMOUNT), nvl(ai.Invoice_Currency_Code,asp.Invoice_Currency_Code), nvl(ai.Exchange_Rate_Type,asp.Default_Exchange_Rate_Type) from ap_invoices_all ai, ap_system_parameters_all asp where ai.invoice_id = :transactionId and ai.org_id = asp.org_id 9. Select the Create Attribute button. Note: AME will confirm the creation of the attribute for you. 10. Select the Quit button to return back to the main menu page.

Invoice Approval Workflow

Page 11

Conditions

Responsibility: AME Application Administrator

N > Approvals > Conditions

1. Change the transaction type to Payables Invoice Approval from the list of values and select the continue button. 2. Scroll to the end of the conditions page and select Add a Condition button. 3. Select an ordinary header condition type. 4. Select the continue button. 5. In the attribute field select SUPPLIER INVOICE AMOUNT from the list of values. 6. Select the continue button. 7. Select the Currency code as USD 8. Enter 0 in the lower limit field. 9. Enter 5000 in the upper limit field. 10. Select yes for include lower limit.

Invoice Approval Workflow

Page 12

11. Select yes for include upper limit 12. Select the Create Condition button. 13. AME will confirm the condition being added successfully.

Actions

Responsibility: AME Application Administrator N > Approvals > Approvals Note: that actions are common to all transaction types so you do not need to select the Payables Invoice Approval transaction type. In the actions types page view scroll down to view the absolute job level action type and note that it has 2 required attributes: INCLUDE_ALL_JOB_LEVEL_APPROVERS

Invoice Approval Workflow

Page 13

JOB_LEVEL_NON_DEFAULT_STARTING_POINT_PERSON_ID Verify that these attributes have been defined with the Payables Invoice Approval transaction type. N > Approvals > Attributes 1. Select the Payables Invoice Approval transaction type from the list of values. 2. Select the continue button. 3. Scroll down and check the non-mandatory attributes list to see if the following two attributes appear: INCLUDE_ALL_JOB_LEVEL_APPROVERS JOB_LEVEL_NON_DEFAULT_STARTING_POINT_PERSON_ID 4. Add these attributes if they are missing. 5. Select the Quit button to return back to the main menu page.

AME includes a set of seeded action types, many of which enable you to ascend commonly used organizational hierarchies. If none of the seeded action types meets your organization's requirements, you need a custom action type. An AME user with administrative privileges must use the actions tab to define a new action type. (this is not the scope of this paper and hence not

Invoice Approval Workflow

Page 14

disucussed here). For our test case, we will use the seeded action type absoulute job level).
Action Group

Action Group is out of the scope of this material. If you want to know more about Action Group, then please refer Implementing Oracle Approvals Management, Release 11i10.
Rules

Creating rules and rule usages is the main step in the AME implementation process. Rarely will an organizations business rules match any rules that are seeded with a transaction type. Instead, you must translate the business rules you documented into AME rules yourself. Rule associate one or more conditions with an approval in an ifthen statement. Before you can create rules, you must create conditions for the rules to use. You may need to create (or have a system administrator create) some custom attributes and/or approvals. You may also need to create some approval groups. Thus, while creating rules is your ultimate goal, it is also the last thing you do when you set up AME. How to creat a Rule:

N > Approvals > Approvals


1. Press on Rule tab 2. Click on the Add Rule and Usage tab 3. Give the name of the Rule in the Description. Rule Key will be automatically displayed. 4. Give appropriate Start and End date for the rule and then press continue button 5. Select the appropriate Action Types (in our case chains of authority based on absolute job level action type is selected) and press continue. The action type will change according to the Rule Type selected. 6. Select the appropriate absoulute job level actions and press continue 7. Select the appropriate Subordinate item class and press continue 8. Select the appropriate Header Attributes. In our case SUPPLIER_INVOICE_AMOUNT is selected and press continue 9. Select the appropriate condition and press continue. 10. This will create the rule

Invoice Approval Workflow

Page 15

Creation of Rule Step 1

Creation of Rule Step 2

Invoice Approval Workflow

Page 16

Creation of Rule Step 3

Creation of Rule Step4

Invoice Approval Workflow

Page 17

Creation of Rule Step 5

Creation of Rule Step 6

Invoice Approval Workflow

Page 18

Creation of Rule Step 7

Test

Approval Management allows users to test the approval process independent of the Invoice Approval Workflow. This will help determine where the problem is occurring, either in OAM or the Invoice Approval Workflow. How to test a rule in OAM: N > Approvals > Approvals 1. Go to Test Tab 2. Select a Test Type a. to test a real transactions approval process, you need to give the item key which will be the invoice_id. In this case check the View a real transactions approval process check box b. to test the rule created in OAM in order to check the approval process, you can select create a test transaction 3. Select the transaction requestor type 4. Search for the person and select the person

Invoice Approval Workflow

Page 19

5. Enter the transaction attribute values 6. Press View approval process button to view the approval process 7. Press View approver list to view the list of approvers

Testing a Rule Step 1

Testing a Rule Step 2

Invoice Approval Workflow

Page 20

Testing a Rule Step 3

Invoice Approval Workflow

Page 21

Oracle Payables

N > Payables > Setup > Options > Payables Options 1. Check the Use Invoice Approval Workflow check box. 2. Check the Allow Force Approval vheck box, if you want to force approve the invoice in which case the approval process will be bypassed. 3. Check the Require Validation before Approval check box if you want to validate the invoice before it is picked up by the approval process

Invoice Approval Workflow

Page 22

Simulation

1. Go to Oracle Payables 2. Enter a Standard Invoice with Requestor name populated

3. Validate the invoice

Invoice Approval Workflow

Page 23

4. Intitiate the invoce by checking the Intitate Approval Checkbox in the Action window

5. Check the approval field and view the Invoice Approval History (Tools > View Invoice Approval Hisotry)

Invoice Approval Workflow

Page 24

6. Run the Workflow Listener for Agent name WF_DEFFERED in Sysadmin

Invoice Approval Workflow

Page 25

7. Check on the status of the approval process in Payables in View Invoice Approval History form by querrying the invoice.

8. Login in to corresponding User Name in whose name the action is pending (Login as Supervisor) 9. Selection the Notification from the worklist 10. Check the Notification details and approve

Invoice Approval Workflow

Page 26

11. Check the invoice Approval Status after the Supervisors approval.

Invoice Approval Workflow

Page 27

12. Similarly you need to login as next approver (manager) and repeat the process and following will be the invoice approval status after managers approval

13. Invoice Approval status after the final approver (CEO)

Invoice Approval Workflow

Page 28

Troubleshooting
Technical Overview of Invoice Approval Flow

Initiate Approval calls: ap_wfapproval_pkg.i aw_raise_events

On running the Wf Agent Listener: Event subscriptions are executed

APINV_IA Node get approvers: using AME_APIs in ap_wfapproval_pkg.get _approvers

ap_wfapproval_pkg.ia w_raise_events calls: Wf_event.raise

Event subscriptions Triggers: APINV workflow Process

APINV_SN Node: send notifications and gets the feedback

APINV_UAH Node: Updates the history

Wf_event.raise puts data in: wf_deferred table (Queue)

APINV_MPO Node check PO Match ap_wfapproval_pkg

APINV_UAH1 Node: Updates the history

Approval Process ends (No More Approvers)

Approval Process ends (If matched)

Approval Process ends (If Rejected)

Invoice Approval Workflow

Page 29

Tables Related to Invoice Approval Workflow Tables

Table Name WF_EVENTS, WE_EVENTS_SUBSCRIPTIONS WF_DEFERRED

Usage Consists complete list of events and events subscriptions along with licensing details Stores details of the events that requires to be submitted to workflow If the Workflow Agent Listener errors, then a record is logged in this table

WF_ERROR

Query to access WF_DEFERRED and WF_ERROR table details Select w.user_data.event_name EVENT_NAME,w.user_data.event_key EVENT_key, w.* from WF_DEFERRED w where w.user_data.event_name like 'oracle.apps.ap.event.invoice.approval and w.user_data.event_key like '57936_1'; Note : 1. These tables consists data-type Object. 2. Above queries will work on 8.1.5+ Sql*Plus version. 3. Can replace WF_DEFERRED with WF_ERROR

WF_ITEM_TYPES_TL WF_ITEM_ATTRIBUTES_TL WF_ACTIVITIES_TL, WF_PROCESS_ACTIVITIES WF_ITEMS

Consists complete list of workflow item types Consists attributes defined for a workflow item type Consists activities defined for a workflow item type Consists item type and item key. One record exists for every invoice submitted for approval Consists attribute values used during approval workflow Consists item key activity status

WF_ITEM_ATTRIBUTE_VALUES WF_ITEM_ACTIVITY_STATUSES

Invoice Approval Workflow

Page 30

WF_NOTIFICATIONS

Consists notification details

Query to get notification details select NOTIFICATION_ID, MESSAGE_TYPE, substr(subject,1,30), STATUS, substr(RECIPIENT_ROLE,1,20) from wf_notifications where message_name = 'APINV_MRA and RECIPIENT_ROLE = 'THECEO' Note: In where clause we can use notification_id from the WF_ITEM_ACTIVITY_STATUSES.Notification_id WF_USERS, WF_ROLES, WF_USER_ROLES
AME Tables

Used to identify the notification users notification preferences

AME_TRANSACTION_TYPES_V AME_ATTRIBUTES, AME_CONDITIONS, AME_ACTIONS, AME_ACTION_TYPES, AME_APPROVAL_GROUPS AME_RULES, AME_CONDITION_USAGES, AME_ATTRIBUTE_USAGES, AME_RULE_USAGES, AME_ACTION_TYPE_USAGES AME_APPROVAL_HISTORY

Consists AME transaction types lists Consists details of AME attributes, condistions and approval lists

Consists rules and usage of attributes, conditions and approval list in the rules

Stores transaction id of the approval process and the peron id who approved the transactions

Query to retrieve details from approval history select * from AME_APPROVALS_HISTORY where TRANSACTION_ID = '57936 (transaction_id = invoice_id)
Invoice Approval Program Flow

On initiating the invoice approval process from APXINWKB (invoice work bench form) program unit inv_sum_actions_wfapprove.do_wfapproval is called. inv_sum_actions_wfapprove.do_wfapproval calls ap_wfapproval_pkg.iaw_raise_event

Invoice Approval Workflow

Page 31

ap_wfapproval_pkg.iaw_raise_event calls wf_event.raise. This enqueues the event in appropriate queue (e., WF_Deferred queue) after checking the license and enabled flag Web agent listener (FNDWFLST) with WF_deferred as parameter executes PL/SQL function wf_event.listen_concurrent. This executes the event subscriptions after checking the license and enabled flag Subscription execution can be (defined in action section) o o Rule function execution (PL/SQL program) Or Starting a Work flow process (APINV) .

APINV (AP Invoice), workflow process start at event activity receive and control is passed to Node APINV_MPO (Check if Matched to PO) APINV_MPO (Check if Matched to PO) is function activity. Checks the invoice match to PO using PL/SQL function AP_WFAPPROVAL_PKG.iaw_po_check If the Match is No then the control is passed to Node APINV_IA (Identify Approver). APINV_IA (Identify Approver) is Function activity. PL/SQL function AP_WFAPPROVAL_PKG.get_approvers is executed. AP_WFAPPROVAL_PKG.get_approvers in turn calls AME_API and gets approver. It also assign value for Item attribute Role_Name If AP_WFAPPROVAL_PKG.get_approvers returns Yes then the control is passed to Node APINV_SN (Send Notifications) APINV_SN (Send Notifications) is Process Activity. So this process is triggered and starts at function activity Start and control is passed to Node APINV_AR (Approval request) APINV_AR (Approval request) is Notification Activity. This sends the notification to performer defined. (i.e role_name. Should exists in wf_users). Row is inserted in wf_notifications table. Once the performer approves the invoice PL/SQL function AP_WFAPPROVAL_PKG.notification_handler is executed After this the APINV_SN (Send Notifications) ends with Approved status. So, control is passed to parent Process onto the Node APINV_UAH (Update Approval History) . APINV_UAH (Update Approval History) is Function activity and PL/SQL function AP_WFAPPROVAL_PKG.update_history is

Invoice Approval Workflow

Page 32

executed and control is passed back to Node APINV_IA (Identify Approver) Cycle of APINV_IA (Identify Approver) ---> APINV_SN (Send Notifications) ---> APINV_AR (Approval request) ---> APINV_UAH (Update Approval History) ends once APINV_IA (Identify Approver) returns No. Important packages involved: : AP_WFAPPROVAL_PKG : AME_API, AME_API2, AME_UTLI : WF_EVENT, WF_ENGINE, WF_DIRECTORY etc., Event Wf_item_type WFT file name Other details: : oracle.apps.ap.event.invoice.approval : APINV : apfiawie.wft (APInvoice)

AP AME WF

AME Transaction type : APINV

How to Track the Workflow Process

Event Queue Summary


o

WF_DEFERRED Queue (when approval is initiated a request with the invoice id is placed in this queue)

After an invoice is initiated, it will be viewable via the Event Queue Summary window through the System Administrator Responsibility. N > Syadmin > Workflow > Event Queue Summary 1. Check the agent name WF_DEFERRED and press torch icon in View detail column 2. Find the Event in WF_DEFERRED Queue Find Process to attribute values and error details Once the Workflow Agent Listener has completed, you can view this status of this invoice_id. N > Sysadmin > Workflow > Find Processes 1. Enter criteria to Find Process 2. Check the Process Status (Item Key will be invoice_id followed by underscore 1. Ex: 22403_1). Flag indicates that

Invoice Approval Workflow

Page 33

the process is completed successfully. Red traffic light indicates that the process did not completed successfully Find Notifications page Once the notification process has completed, you can view the status of the notification if the invoice. N > Sysadmin > Workflow > Find Notifications If you know the notification_id, you can query the notification otherwise, you can query the notification of the particular owner or type or status. Test tab to check the Approval details in AME Once you know the invoice_id for which the approval process is initiated, you can check the approval status for the invoice_id in AME. N > Approvals > Test tab 1. Check View a real transaction approval process and press continue 2. Provide the invoice_id value in the field Transaction ID and press Fetch attribute values 3. Press View approval process button to view the approval process 4. Press View approver list to view the list of approvers Admin tab to check the Approval Exception Log in AME Exception logs of the approval process can be viewed in AME to know the details of the exception N > Approvals > Admin tab You need to choose the activity View a transactions type exception log and press continue to view the details of the exception Wfstatus.sql This script is used to get the details of the Item Key (invoice_id) and its attribute values. How to run this script 1. Go to $FND_TOP/sql 2. Connect to SQLPLUS as apps 3. Run the following command

Invoice Approval Workflow

Page 34

@wfstatus <Item Type> <Item Key> Ex: @wfstatus APINV 57936_1 APINV is the item type and 57936_1 is the item key (invoice_id)

CONCLUSION

In todays complex business sceanario, Invoice Approval Workflow will help in great extent in automating the Invoice Approval Process which will save time and cost to the company and will help in business growth.

Invoice Approval Workflow

Page 35

White Paper Title January 2005 Author: Sundaram Sriram Contributing Authors: Tumu Krishna Ashok Srinivasan Oracle Corporation World Headquarters 500 Oracle Parkway Redwood Shores, CA 94065 U.S.A. Worldwide Inquiries: Phone: +1.650.506.7000 Fax: +1.650.506.7200 www.oracle.com Copyright 2003, Oracle. All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Potrebbero piacerti anche