Vous êtes sur la page 1sur 12

11i Mileage Calculation –

CustomCalculateAmount
Extension for Use in Oracle
Internet Expenses – Fixed Rate
An Oracle White Paper
June 2001
11i Mileage Calculation - CustomCalculateAmount
Extension for Use in Oracle Internet Expenses –
Fixed Rate

FOCUS

Rate Per Mile * Miles = Mileage Calculation


This paper demonstrates how to define the variables in order to compute this
equation. MILES is a variable the user provides.
Rate per mile in this example is a flat rate, which is embedded in a stored
procedure. Benefit? They tell you how far, you determine how much.
(Another paper entitled “11i Mileage Calculation – CustomCalculateAmount
Extension for Use in Oracle Internet Expenses – Variable Rate” demonstrates
how to use rate per mile as well.)
This example will assume $2.00 per mile reimbursement.

Receipt Detail form to enter mileage in Internet Expenses.

1
SCOPE
In order to utilize mileage calculation in Internet Expenses, a descriptive flexfield
must be set up, and a package must be customized and recompiled against the
database.

TECHNICAL SETUP
Try this first in your test database.
The package.procedure that needs to be edited is
AP_WEB_CUST_DFLEX_PKG.CustomCalculateAmount.
The file should be located in $AP_TOP/patch/115/sql/apwdfcfb.pls
If the file is not here, obtain the latest OIE (Oracle Internet Expenses) patchset
from MetaLink.
Backup the seeded package. Modify the seeded package.
Edit the package, removing the section on the PROCEDURE
CustomCalculateAmount, and replacing it with the edited procedure provided
below. Save your changes to the package.
For these changes to take effect in the database, you need to recompile the
package. From the directory the modified package is in,
connect to sqlplus as apps/<password> and run the following:
@apwdfcfb.pls <return>

This is how procedure CustomCalculateAmount should look when it is modified.


Note where the flat rate of $2.00 is set (in bold).:

-----------------------------------------------
PROCEDURE CustomCalculateAmount(
p_exp_header_info IN OUT
AP_WEB_DFLEX_PKG.ExpReportHeaderRec,
p_exp_line_info IN OUT
AP_WEB_DFLEX_PKG.ExpReportLineRec,
p_custom_fields_array IN
AP_WEB_DFLEX_PKG.CustomFields_A)
-----------------------------------------------
IS
l_miles NUMBER;
l_rate_per_mile NUMBER;
l_debug_info VARCHAR2(2000);
l_curr_calling_sequence VARCHAR2(200)
:= 'CustomCalculateAmount';
BEGIN

2
-----------------------------------------------
-- Example code: Mileage
--

IF (upper(p_exp_line_info.expense_type) =
'MILEAGE') THEN

l_miles :=
AP_WEB_DFLEX_PKG.GetCustomFieldValue('MILES',
p_custom_fields_array);
-- l_rate_per_mile :=
AP_WEB_DFLEX_PKG.GetCustomFieldValue('RATE PER
MILE',
p_custom_fields_array);
p_exp_line_info.calculated_amount :=
l_miles * 2;

p_exp_line_info.copy_calc_amt_into_receipt_amt
:= 'Y';

-- ELSIF
(upper(p_exp_line_info.expense_type) = 'PER
DIEM') THEN
-- NULL;

-- ELSE IF ...

END IF;
-----------------------------------------------
EXCEPTION
WHEN OTHERS THEN
FND_MESSAGE.SET_NAME('SQLAP','AP_DEBUG');
FND_MESSAGE.SET_TOKEN('ERROR',SQLERRM);

FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE',
l_curr_calling_sequence);

FND_MESSAGE.SET_TOKEN('DEBUG_INFO',l_debug_info
);

AP_WEB_UTILITIES_PKG.DisplayException(fnd_messa
ge.get);
END CustomCalculateAmount;

3
FUNCTIONAL SETUP

Create A Value Set in the Core Application


Oracle Payables -> Setup -> Flexfields -> Validation -> Sets
Create a Value Set that looks like the following:

4
Set up Descriptive Flexfield

Oracle Payables -> Setup -> Flexfield -> Descriptive -> Segments
Query up the Title "Expense Report Line".
Unfreeze the flexfield.

For testing purposes, disable everything related to this flexfield.


Please note down what you disable in the following section, so you can re-enable
this information after testing. Disable all Context field values on the lower
portion of this screen. You will not be able to disable the Global Data Elements
line. Put cursor in the Global Data Elements field value and choose the Segments
button. Disable all segments related to Global Data Elements. Save changes.

Create and enable a new Context Field Value as it appears below for "Mileage".
Choose the Segments button.

5
The segments form will open.
Create a Segment just like the below screenshot.
You may need to choose a different attribute column, depending on what is
available. Chose the Value Set that was created earlier in this document.
Once this is done, save your changes.
Choose the Open button at the bottom of the screen.

6
The screen should look like the screenshot below.
If it does not, make any necessary changes.
A description is required for the flexfield to display in Internet Expenses.
Once this is completed, save your changes, and close this form and the
Segments form, so you are now back on the Descriptive Flexfield Segments form.
Freeze and recompile the flexfield.

7
Set up Expense Template:

Setup -> Invoice -> Expense Report Template


Create a new template.
Make sure that:
1) The template is enabled for Self-Service Users (check box).
2) The expense item name is "Mileage"
The calculate amount button is checked for this expense item.

8
TESTING:

We can now test the calculate mileage feature.


Sign on to Oracle Self-Service Applications.
Choose the Expense Reports responsibility you are using for Internet
Expenses. Choose Create New Expense Report.
Make sure to choose the template you created in the previous step for
your expense template.
Then go to the first line, and choose the details icon.
The following details form will display:

Notice the calculate amount button next to the field labeled MILES.
For this screenshot:
1 day was entered.
Mileage was chosen as the expense type.
“5” was entered in the miles field.
The calculate amount button was chosen.
This populated the 10.00 receipt amount, daily rate, and reimbursable
amount.

9
After the information is chosen on the details form, and the details form
is closed, information will display similar to the following:

10
11i Mileage Calculation – CustomCalculateAmount Extension for Use in Oracle Internet Expenses – Fixed Rate
June 2001
Author: Leigh Lindquist
Copyright © Oracle Corporation 2001
All Rights Reserved Printed in the U.S.A.

This document is provided for informational purposes


only and the information herein is subject to change
without notice. Please report any errors herein to
Oracle Corporation. Oracle Corporation does not
provide any warranties covering and specifically
disclaims any liability in connection with this document.

Oracle is a registered trademark and Enabling the


Information Age, Oracle Internet Expenses are trademarks
of Oracle Corporation.

Oracle Corporation
World Headquarters
500 Oracle Parkway
Redwood Shores, CA 94065
U.S.A.

Worldwide Inquiries:
415.506.7000
Fax 415.506.7200

Copyright © Oracle Corporation 2001


All Rights Reserved

11

Vous aimerez peut-être aussi