Descriptive Flexfields in the Enter Receipts Window
You can define descriptive flexfields to record additional information in the Enter Receipts window in Oracle Web Employees. For example, you can define custom fields that appear for every expense item an employee enters in the Enter Receipts page. The values your employees enter in these additional fields you define are stored in the numbered ATTRIBUTE columns of the AP_EXPENSE_REPORT_LINES table. You can choose to import these ATTRIBUTE values into the AP_INVOICE_DISTRIBUTIONS table when you submit the Payables Invoice Import program. You can then use this information for custom reports or custom programs.
You can also define context-sensitive fields that appear only when the employee selects a particular expense type. For example, the employee is entering a receipt. When the employee enters Airfare as the expense type, custom fields appear for airline name, ticket number, and class of travel. When the employee enters Mileage as the expense type, custom fields appear for distance and the mileage rate. Note that context-sensitive fields can be based only on expense type.
Calculate Amount Button
In addition to storing additional information, for a given expense type you can add a Calculate Amount button to the set of custom fields you define through a descriptive flexfield definition. If you add your own custom calculation PL/SQL code in the apwdfcfb.pls file, then when your employees enter values in the custom fields and choose the Calculate Amount button, Web Employees will call your custom PL/SQL code. Web Employees will then perform calculations on the values that employees entered in the custom fields, and populate the Receipt Total field in the Enter Receipts window. For example, you can customize your Enter Receipts window so that during receipt entry when your employees enter Mileage as the expense type, a custom Distance field appears. The employee enters a value for this field and then chooses the Calculate Amount button. Your PL/SQL code will multiply the Distance value by mileage rate you have defined in either your custom PL/SQL code or in the descriptive flexfield default field, and automatically enter the result in the Receipt Total field.
If the reimbursement currency is different from the receipt currency, you can customize the PL/SQL code to populate the Receipt Total instead of the Total Amount. The Enter Receipts window will then calculate the receipt total in the reimbursement currency and enter that value in the Total Amount field.
You add a Calculate Amount button to the Enter Receipts window by enabling the Calculate Amount option for an expense item in the Expense Report Templates window in Payables.
Customizing Flexfield Routines
Web Employees provides four routines that can be customized to achieve the desired flexfield behavior. The four routines are included in the $AP_TOP/admin/sql/apwdfcfb.pls file. Web Employees provides a "hook" to each of these routines. You can edit them to provide custom, default values and poplist values, or to provide custom calculation and validation logic. They are:
- CUSTOMPOPULATEPOPLIST. Customize this procedure to generate custom poplist values. Instead of using the value set values you define in the Segment Values window for value sets with independent validation, you can provide a subset of those values in the poplist. For segments with the table validation type, poplist values must be provided in this procedure since the values will not be generated automatically from the SQL statement in the value set definition.
- CUSTOMPOPULATEDEFAULT. Customize this procedure to generate custom default values based on information provided by the user instead of using the single default you define in the Default Value field in the Segments window. You can customize this procedure to provide defaults for custom fields based on information in the Start Report page of Web Expenses, such as the employee ID, cost center, and reimbursement currency. For example, you can default a value for Per Diem based on the employee's position.
- CUSTOMVALIDATEDFLEXVALUES. Customize this procedure to perform custom validation on values the users enter. This validation is in addition to the validation you define when you define your descriptive flexfield. You can define dynamic validation that is dependent on other fields the user enters in the Enter Receipts page. The same API is called for both expense line level validation and for individual expense-type context-sensitive custom field validation.
- CUSTOMCALCULATEAMOUNT. Customize this feature to define the calculation that the system performs when you choose the Calculate Amount button. The system enters the result of the calculation into the Total Amount field in the Enter Receipts window. However, for multiple currency expense reports where the reimbursement currency does not equal the receipt currency, you can customize this routine either to enter the result in the Receipt Amount field, or to enter use the conversion rate the user enters to calculate and enter the Total Amount field.
Suggestion: To use custom data stored in the Oracle Applications database with the four provided procedures, you must register all new custom tables within Oracle Applications. See: Oracle Applications Developer's Guide.
Attention: You are responsible for the support and upgrade of the logic within the procedures that you write, which may be impacted by database or other changes between releases of the Oracle Applications.
Suggestion: Make a copy of all custom code and place it in a directory protected from upgrade. After an upgrade, if appropriate, reapply any custom code.
Defining Descriptive Flexfields for Expense Reporting
The Oracle Applications Flexfields Guide describes in detail how to define descriptive flexfields. The following discussion will provide some hints for defining descriptive flexfields for Expense reporting. Use this document in conjunction with the Oracle Applications Flexfields Guide.
To enable the Expense Report Line flexfield in the Enter Receipts window in Oracle Web Employees, enable the WebExpenses:Enable DescFlex profile option. Payables also uses the Expense Report Line flexfield for the Expense Reports window in Payables. If you want flexfields to appear in the Payables Expense Reports window but not in the Enter Receipts page in Web Employees, leave the segment Description null in the Segment window.
Prerequisites
To define descriptive flexfields for the Enter Receipts window:
1. Use the System Administrator responsibility.
2. Navigate to the Descriptive Flexfields Segments window. In this window you specify the expense type values for which you will display additional flexfields, for example, Airfare, Mileage, Breakfast, Lunch, and Dinner. For detailed information on this window, see: Descriptive Flexfield Segments Window. Note the following:
Query the Application "Oracle Payables" and the Title "Expense Report Line". Enter the following value:
- Reference Field: ITEM_DESCRIPTION
The remaining values in the Context Field region are not used by Oracle Web Employees, and are used by Oracle Payables in the Expense Reports window.
Enter a line for each expense type for which you want to display unique custom fields. For example: Name: Airfare, Description: Additional information for Airfare.
Attention: You must enter the Context Field Values Name exactly as you enter it in the Expense Item field of the Expense Report Templates window or the context-sensitive flexfield will not appear.
If you want one or more custom fields to appear regardless of the expense type the user enters, use the following default line in the Context Field Values region:
- Name: Global Data Elements
- Description: Global Data Element Context
3. For each context field value, choose the Segments button to navigate to the Segments Summary. Use this window to define the fields that will appear and the values the users can enter for the field. For detailed information on this window, see: Context Field Values (Oracle Applications Flexfields Guide).
In the segment Description field, enter the description that you want the user to see in a pop-up alert when the user clicks on the field prompt in the Enter Receipts page. For example, enter company-specific policy regarding the field.
Attention: You must enter a value for the segment Description field, or the custom field will not appear on the Enter Receipts page. Segments with a null Description will appear only on the Payables Expense Reports window. Segments that are defined without a value in the Description field are not visible to Web Employees users, but if you define custom defaulting for a segment, the underlying database column may still be populated (these values will be visible in the Payables Expense Reports window).
In the Value Set field, you determine whether your users can enter text, for example, AP_SRS_ALPHANUMBERIC_OPT, or you can define specific values the user must enter.
In the Default Type field, if you enter a value other than 'Constant', you must customize the CUSTOMPOPULATEDEFAULT routine. For more information, see: Customizing Flexfield Routines.
If you want to define valid values for the field, first define a value set. Enter a unique name for the value set you want to define, for example, Travel Class. Choose the Value Set button to navigate to the Value Sets window. For detailed information on this window, see: Defining Value Sets.
- Enable Longlist: Enable this option for very long lists, for example, a list of employees. If you enable this option, the custom field will appear as a text field. If you want the field to have a poplist, disable this option. Disable this option only for small lists, because long poplists slow performance.
- Format Validation: If you want to validate the format of the data the users enter, specify your validation criteria.
- Validation Type: Independent, None, and Table are the only Validation Types that will appear in the Enter Receipts window. If you want to have the value appear as a check box instead of the default described below, assign the AP_SRS_YES_NO_MAND value set for that particular custom option.
- Independent. Appears as a poplist.
- None. Appears as a text field.
- Table. Appears as a poplist if the custom poplist provides values. In a future release, the poplist values for table validation will be generated automatically.
Attention: When a segment is linked to a standard poplist, either Independent or Table validation must be used. If a segment is linked to a custom poplist, Table validation must be used.
Attention: To define custom error messages with any custom validation you use in the CUSTOMVALIDATEDFLEXVALUES procedure, pass the relevant error text to the procedure. You do not need to set up custom error messages in an Application Object Library (AOL) table for use with this procedure.
5. In the Segment Values window, define and enable the valid values for the new fields you are defining, for example, for the value set Travel Class, you can define the following values: First, Business, Coach. For detailed information on this window, see: Segment Values Window.
Save your work and return to the Segments window. Enable the new fields. Save your work in the Segments window.
Return to the Descriptive Flexfield Segments window. Enable the Context Field Values you want to use. Check the Freeze Flexfield Definition check box. Choose the Compile button to compile the descriptive flexfield definition.
Suggestion: Before verifying that that the Descriptive Flexfield definition you created or extended works properly with Web Employees, verify its usage first within the Payables Expense Reports window. This may help identify errors in your Flexfield definition.