SRW FORMAT CURRENCY

14
User Profiles A user profile is a set of changeable options that affects the way your applications run. Oracle Application Object Library establishes a value for each option in a user’s profile when the user logs on or changes responsibility. Your user can change the value of profile options at any time. Oracle Application Object Library provides many options that your users can set to alter the user interface of your applications to satisfy their individual preferences. You can define options at one or more of four levels: Site, Application, Responsibility and User. You can choose at which of these levels you want your system administrator to be able to see and update option values. You also decide which profile options defined at the User level you want your users to be able to see and update. AOL – Application Object Library User Profile Levels User profile options exist at Site, Application, Responsibility and User levels. Oracle Application Object Library treats user profile levels as a hierarchy, where User is the highest level of the hierarchy, followed by Responsibility, Application and at the lowest level, Site. Higher–level option values override lower– level option values. A system Administrator sets site–level option values after installing Oracle AOL–based applications at a site. An option’s run–time value is the highest–level setting for that option. For example, for a given end user, assume the Printer option is set only at the Site and Responsibility levels. When the end user logs on, the Printer option assumes the value set at the Responsibility level, since it is the highest–level setting for the option. You change an option value using the Update Personal Profile Options form. Using this form, you can display all your options and review the values your system administrator has set for them. You can also change those that are updateable. You should define user profile options whenever you want your application to react in different ways for different users, depending on specific user attributes. When you define a profile option you decide whether your system administrator can set values for your option at each of these levels. You also decide whether your end users can view and update options you

description

A detailed document on SRW feature of Formatting currency

Transcript of SRW FORMAT CURRENCY

Page 1: SRW FORMAT CURRENCY

User Profiles

A user profile is a set of changeable options that affects the way your applications run. Oracle Application Object Library establishes a value for each option in a user’s profile when the user logs on or changesresponsibility. Your user can change the value of profile options at any time. Oracle Application Object Library provides many options that your users can set to alter the user interface of your applications tosatisfy their individual preferences.

You can define options at one or more of four levels: Site, Application, Responsibility and User. You can choose at which of these levels you want your system administrator to be able to see and update option values. You also decide which profile options defined at the User level you want your users to be able to see and update.

AOL – Application Object LibraryUser Profile LevelsUser profile options exist at Site, Application, Responsibility and User levels. Oracle Application Object Library treats user profile levels as a hierarchy, where User is the highest level of the hierarchy, followed by Responsibility, Application and at the lowest level, Site. Higher–level option values override lower–level option values. A system Administrator sets site–level option values after installing Oracle AOL–based applications at a site.

An option’s run–time value is the highest–level setting for that option. For example, for a given end user, assume the Printer option is set only at the Site and Responsibility levels. When the end user logs on, the Printer option assumes the value set at the Responsibility level, since it is the highest–level setting for the option.You change an option value using the Update Personal Profile Options form. Using this form, you can display all your options and review the values your system administrator has set for them. You can also change those that are updateable. You should define user profile options whenever you want your application to react in different ways for different users, depending on specific user attributes.When you define a profile option you decide whether your system administrator can set values for your option at each of these levels. You also decide whether your end users can view and update options you define at the User level. The user cannot see or change the profile options CONC_PRINT_OUTPUT and CONC_PRINT_STYLE.

USERNAME Your user’s current Oracle Application Object Library username.

USER_ID Your user’s current Oracle Application Object Library user ID.

RESP_ID Your user’s current responsibility ID.

APPL_SHRT_NAME The short name of the application connected to your user’s current responsibility.

RESP_APPL_ID The application ID of the application connected to your user’s current responsibility.

FORM_NAME The name of the current form. Not available for concurrent programs.

FORM_ID The form ID of the current form. Not available for concurrent programs.

FORM_APPL_NAME The name of the application for which the current form is registered. Not available for

concurrent programs.

FORM_APPL_ID The application ID of the application for which the current form is registered. Not available for

concurrent programs.

Page 2: SRW FORMAT CURRENCY

LOGON_DATE Your user’s logon date for the current session.

LAST_LOGON_DATE Your user’s logon date for the previous session.

LOGIN_ID Your user’s Sign–On Audit login ID in Oracle Application Object Library.

CONC_REQUEST_ID The request ID associated with a particular instance of your running current program. You

can only use this profile option in a concurrent program.

CONC_PROGRAM_ID The program ID associated with a running current program.

User Profile APIs (FND_PROFILE)

User profile APIs you can use in your PL/SQL procedures. You can use these user profile routines to manipulate the option values stored in client and server user profile caches.

FND_PROFILE.PUT

procedure FND_PROFILE.PUTname IN varchar2,value IN varchar2);

Argumentsname - The (developer) name of the profile option you want to set.Value - The value to set in the specified profile option.

DescriptionPuts a value to the specified user profile option. If the option does not exist, you can also create it with PUT.

FND_PROFILE.GETprocedure FND_PROFILE.GET (name IN varchar2, value OUT varchar2);

Example - FND_PROFILE.GET (’USER_ID’, user_id);

DescriptionGets the current value of the specified user profile option, or NULL if the profile does not exist.

FND_PROFILE.VALUE

function FND_PROFILE.VALUE(name IN varchar2) return varchar2;

DescriptionVALUE works exactly like GET, except it returns the value of the specified profile option as a function result.________________________________________________________________________

FND SRWINIT and FND SRWEXIT

Page 3: SRW FORMAT CURRENCY

FND SRWINIT and FND SRWEXIT are used to access profile values, multiple organizations, or Oracle Applications user exits, and for your program to be used with concurrent processing. The first and last user exits called by your Oracle Reports program be FND SRWINIT and FND SRWEXIT.

FND SRWINIT sets your profile option values and allows Oracle Application Object Library user exits to detect that they have been called by a Oracle Reports program. FND SRWEXIT ensures that all the memory allocated for Oracle Application Object Library user exits has been freed up properly.

Create a lexical parameter P_CONC_REQUEST_ID with the datatype Number. The concurrent manager passes the concurrent request ID to your report using this parameter.

Call FND SRWINIT in the ”Before Report Trigger.” Call FND SRWEXIT in the ”After Report Trigger.”

The following AOL USER EXITS help us to access user profile values and perform calculations in Oracle Reports program:

1. FND FORMAT_CURRENCY 2. FND FLEXSQL3. FND FLEXIDVAL

You can call many Oracle Applications PL/SQL routines, such as user profiles routines, from your Oracle Reports programs as well as these user exits. In general, you should use PL/SQL routines instead of user exits where possible.

You can test your Oracle Reports program that calls Oracle Applications user exits by running

ar25run - for chararcter mode reportsar25runb - for bitmap mode reports. Ex., HTML,PDF FILESar25des - This is the bitmap designer to build and modify reports which use Oracle Applications user exits.

*************************************************************************************

Page 4: SRW FORMAT CURRENCY

User Exits Used in Oracle Reports FND SRWINIT FND SRWEXIT FND FORMAT_CURRENCY FND FLEXIDVAL FND FLEXSQL

FND SRWINIT / FND SRWEXITFND SRWINIT sets your profile option values and allows Oracle Application Object Library user exits to detect that they have been called by an Oracle Reports program. FND SRWINIT also allows your report to use the correct organization automatically. FND SRWEXIT ensures that all the memory allocated for Oracle Application Object Library user exits has been freed up properly.

FND FLEXIDVAL / FND FLEXSQLThese user exits allow you to use flexfields in your reports. They are documented in the Oracle Applications Flexfields Guide.

Using Dynamic Currency in Oracle ReportsCurrency formatting support provides a flexible, consistent method to format a numeric value according to its associated currency. The currency value appears with the correct thousands separator and radix character (decimal point) of the user’s country. The value appears with positive and negative indicators of the user’s choice. When reporting on mixed currency amounts you include a special argument to indicate that you wish to align all different currency types at a standard point (usually the precision of the currency with the greatest precision). This precision is defined by a profile option or set by the user of the report at execution time.

A report based on a single currency type should display currency amounts aligned along the radix character as illustrated in the following example:

Currency Value Code120,300.00 USD–4,201.23 USD

or120,300.00 USD(4,201.23) USD

or120,300.00+ USD–4,201.23 USDIf the user chooses a negative or a positive indicator such as parentheses that appears at the right of the currency amount, then values are not flushed with the right margin but are shifted to the left to accommodate the indicator. A mixed currency report should display currency amounts aligned along the radix character (or implied radix for currencies with no precision like JPY).Currency Value Code300.0 USD105.250 DNR1,000 JPY–24,000.34 FRF

Page 5: SRW FORMAT CURRENCY

Call the FND FORMAT_CURRENCY user exit to format the Currency Value column. In this mixed currency report, the minimum precision (specified in the MINIMUM_PRECISION token in the user exit) is set to 3.

FND FORMAT_CURRENCY User Exit

This user exit formats the currency amount dynamically depending upon the precision of the actual currency value, the standard precision, whether the value is in a mixed currency region, the user’s positive and negative format profile options, and the location (country) of the site. The location of the site determines the thousands separator and radix to use when displaying currency values. An additional profile determines whether the thousands separator is displayed.

You obtain the currency value from the database into an Oracle Reports column. Define another Oracle Reports column, a formula column of type CHAR, which executes the FORMAT_CURRENCY user exit to format the currency value. A displayed field has this formula column as its source so that the formatted value is automatically copied into the field for display.

SyntaxFND FORMAT_CURRENCYCODE=”:column containing currency code”DISPLAY_WIDTH=”field width for display”AMOUNT=”:source column name”DISPLAY=”:display column name”[MINIMUM_PRECISION=”:P_MIN_PRECISION”][PRECISION=”{STANDARD|EXTENDED}”][DISPLAY_SCALING_FACTOR=””:P_SCALING_FACTOR”]

CODE - Specify the column which contains the currency code for the amount. The type of this column isCHARACTER.DISPLAY_WIDTH - Specify the width of the field in which you display the formatted amount.AMOUNT - Specify the name of the column which contains the amount retrieved from the database. This amount is of type NUMBER.DISPLAY - Specify the name of the column into which you want to display the formatted values. The type of this column is CHARACTER.MINIMUM_PRECISION - Specify the precision to which to align all currencies used in this report region. You specify the MINIMUM_PRECISION token in mixed currency report regions to ensure all currency values align at the radix character for easy readability. Your user can adjust the report by setting an input parameter when submitting the report to specifically tailor the report output to a desired minimum precision or accept the default which is determined from the profile option CURRENCY:MIXED_PRECISION (Currency:Mixed Currency Precision). Your report submission must pass the value as a report argument. You use P_MIN_PRECISION as the name of this lexical.PRECISION - If specified as STANDARD, then standard precision is used. DISPLAY_SCALING_FACTOR - Optionally, specify the scaling factor to be applied to the amount in that column. If this token is not specified or is negative no scaling is performed. You use P_SCALING_FACTOR as the name of this lexical parameter.

Example Report Using FND FORMAT_CURRENCY

Page 6: SRW FORMAT CURRENCY

The following report illustrates how various currencies are formatted using the FND FORMAT_CURRENCY user exit for a report which displays mixed currency values. This document explains how you develop such a report. Information about the radix character and thousands separator are determined from the location of the user. The special display for negative and positive currency values is specified by two profile options. Hence, a report can appear differently depending upon the location of the user and the profile options values set. The following reports, one run by a user in United States and the other by a user in Germany, depict this difference. In Germany the radix character and thousand separators are switched from the US counterpart. In these reports, both Manama and Seattle had a loss and the negative numbers display in parentheses () or angle brackets <> depending upon the user’s preference.

Sample Report OutputReport 1 Run in the United States

The territory information can be find in preferences menu in oracle application home page.

Set the territory location as United States and required format to display the currency.

Information from the territory: – Thousand Separator: ’,’ (comma)– Radix Character: ’.’ (decimal)

Profile option settings:– Negative Format: <>– Minimum Precision: 3Display Thousands Separator: Yes

Page 7: SRW FORMAT CURRENCY

CREATE A TABLE NAMED “CURRENCY_TABLE” IN APPS LOGIN AS SHOWED BELOW:CREATE TABLE CURRENCY_TABLE( OFFICE VARCHAR2(40 BYTE), CURRENCY VARCHAR2(3 BYTE), NETINCOME NUMBER);

OFFICE CURRENCY NETINCOMEBoston USD 12,345.00Chicago USD 123,456.76Manama BHD 23,456.76Isa Town BHD -12,345,678.77Seattle USD -12,345.50Tokyo JPY 12,345,676.00

ProcedureStep 1. Define Your ParametersFirst define all the parameters (using the Oracle Reports Parameter Screen). Use these parameters in the user exit calls and SQL statements.

Name: P_CONC_REQUEST_IDData Type: NUMBERWidth: 15Initial Value: 0

You always create this lexical parameter. ”FND SRWINIT” uses this parameter to retrieve information about this concurrent request.

Name: P_MIN_PRECISIONData Type: NUMBERWidth: 2Initial Value:

You reference this lexical parameter in your FND FORMAT_CURRENCY user exit call.

Step 2. Call FND SRWINIT and FND SRWEXITYou always call FND SRWINIT from the Before Report Trigger as follows:

Page 8: SRW FORMAT CURRENCY

SRW.USER_EXIT(’FND SRWINIT’);This user exit sets up information for use by profile options and other AOL features.

You always call FND SRWEXIT from the After Report Trigger as follows:SRW.USER_EXIT(’FND SRWEXIT’);This user exit frees all the memory allocation done in other AOL exits.

Step 3. Create the Currency Code QueryCreate a query which selects the currency code and the currency amount from your table. In this case you might use:

SELECT OFFICE, NET_INCOME INCOME,CURRENCY MY_CURRENCY FROM CURRENCY_TABLE;

Step 4. Create a column for the currency callCreate one formula column (C_NET_INCOME) which contains the user exit (FND FORMAT_CURRENCY) call. This is a formula column which formats the number and displays it. The user exit call looks like the following:

SRW.REFERENCE(:MY_CURRENCY);SRW.REFERENCE(:INCOME);SRW.USER_EXIT('FND FORMAT_CURRENCY CODE=":MY_CURRENCY"DISPLAY_WIDTH="15"AMOUNT=":INCOME"DISPLAY=":C_NET_INCOME"MINIMUM_PRECISION=":P_MIN_PRECISION"');RETURN(:C_NET_INCOME);

Step 5. Define Your Report with Application Object Library

Register the report in oracle application. Place the created report in the below path D:\Oracle\Prodappl\Fnd\11.5.0\Reports\US\SAMPLE_REPORT.RDF

1. Register the report in oracle application. Change the responsibility to SYSADMIN

CurrentProgramExecutable

2. Create the program to submit the report.ConcurrentProgramDefine

Page 9: SRW FORMAT CURRENCY

3. Create a parameter to pass the minimum precision variable value to the report.

3. Add it to the request groupSecurity ResponsibilityRequest

4. Submit a request to run the report and enter the parameter to pass the minimum precision value

Page 10: SRW FORMAT CURRENCY

5. The formatted currency output is displayed as shown below:

NOTE: You cannot run the srw.user_exit reports in report builder, it will show error. So register the report in oracle application and run the report by submitting the request.