29 May 2009

Subject: How to Control the Name and the Application that Opens the Concurrent Request Output File on the Client?

Doc ID: 316752.1 Type: HOWTO
Modified Date : 29-MAY-2008 Status: PUBLISHED


Applies to:
Oracle Application Object Library - Version: 11.5.7 to 11.5.10
Information in this document applies to any platform.



Checked for relevance on 29-May-2008
Applications Install 11.5.7 to 11.5.10
Goal
How to control the name and the application that opens the concurrent request output file on the client?

Solution
The following output formats are possible for the output files created by any concurrent request in Oracle Applications Release 11i

- Text
- HTML
- PDF
- PCL
- Postscript
- XML

The following profile options are available in Oracle Applications Release 11i

Viewer: Text
Viewer: PostScript
Viewer: Default Font Size
Viewer: HTML
Viewer: PDF
Viewer: HTML
Viewer: PDF
Viewer: PostScript

The 'Viewer: Text' profile option allows you to send report output directly to a browser window rather than using the default Report Viewer. Enter "browser" in this profile option to enable this feature.
Users can see and update the Viewer:Text profile option.
This profile option is both visible and updatable at all four levels.

The internal name for this profile option is EDITOR_CHAR.

Viewer: Application for HTML
Viewer: Application for PCL
Viewer: Application for PDF
Viewer: Application for PostScript
Viewer: Application for Text
Viewer: Application for XML

These profile options determine the applications a user will use to view reports in the given output formats. For example, you could set Viewer: Application for Text to ’application/word’ to view a Text report in Microsoft Word.

Valid values are defined by the system administrator in the Viewer Options form.
Users can see and update these profile options. The internal names for these profile options are FS_MIME_HTML, FS_MIME_PCL, FS_MIME_PDF, FS_MIME_PS, and FS_MIME_TEXT.

In Applications 11i , use the System Administrator Responsibility and navigate to

Install -> Viewer Options

to open the Form Viewer Options.

The column File Format can take one of the following possible values

- Text
- HTML
- PDF
- PCL
- Postscript
- XML

Corresponding to one specific File Format a number of Mime Types can be associated , there is no restriction on which Mime Type can be associated with a particular File Format . The possible values of Mime Types can be known by opening up the Registry on the Windows Client machine using the command regedit , then following the paths in the registry tree as given below :-

HKEY_CLASSES_ROOT->MIME->Database->Content Type
HKEY_LOCAL_MACHINE->Software->Classes->MIME->Database->Content Type

When a particular Mime Type is clicked under Content Type in the registry (for example the registry key HKEY_LOCAL_MACHINE->Software->Classes->MIME->Database->Content Type/(application/pdf)), the Value data corresponding to Value name : Extension gives the file extension for that Mime Type.

On the Windows client machine (Windows Explorer Tools->Folder Options ->File Types) there is a mapping of file extension with Application, so in short the Mime Type (Mime Type is required in transferring the output file from the Concurrent Processing Server to the Windows client machine using http protocol ) decides the output file extension, which in turn decides the application with which the output file is opened on the Windows client machine

Suppose a user submits a Concurrent Request, the request gets completed successfully to generate an output file in a particular format say PDF. Now the user wants to view or download the output file on his client machine, to transfer the output file from the Concurrent Processing Server to the client machine using http protocol, association of Mime Type with the output file is required. Now the question comes which Mime Type is to be associated?

The decision is based on the following things:

(i) Value of the profile options: Viewer: PDF and Viewer: Application for PDF effective for that Applications User.

(ii) Mime Types defined in Applications, as described earlier, for the output format PDF.

If there are multiple Mime Types defined for PDF File Format and the values of the profile options Viewer: PDF and Viewer: Application for PDF effective for the user do not determine any particular Mime Type then the user is presented with a list of Applications. Application names being seen in the list is the Description column for those combinations of PDF File Format and the corresponding Mime Types in the Viewer Options Form. When a particular application from the list is chosen, the output file is transferred from the Concurrent Processing Server to the Windows client machine using http protocol with Mime Type, as that is there for that particular Application and PDF File Format in the Viewer Options Form. Mime Type used in the transmission of the output file, decides the file extension as described earlier, which in turn decides the application on Windows to be used for opening the file .

The name of the output file being saved is derived from the name of the Concurrent Program. The output file name is obtained by procedure
fnd_webfilepub.req_outfile_name (AFCPWFPB.pls) in the following way:

select substrb(p.user_concurrent_program_name,1,30) || '_' ||
&; to_char(r.Actual_Start_Date,'ddmmrr'),
NVL(r.output_file_type, 'TEXT')
into temp_name, file_type
from fnd_concurrent_programs_vl p,
fnd_concurrent_requests r,
fnd_file_temp t and p.application_id = r.program_application_id
and t.request_id = r.request_id
and t.file_id = id;
.
if ( file_type = 'TEXT' ) then
file_ext := 'txt';
elsif ( file_type = 'HTML') then
file_ext := 'html';
elsif ( file_type = 'PDF' ) then
file_ext := 'pdf';
elsif ( file_type = 'PS' ) then
file_ext := 'ps';
elsif ( file_type = 'PCL' ) then
file_ext := 'pcl';
elsif ( file_type = 'XML' ) then
file_ext := 'xml';

end if;

outfile_name := temp_name || '.' || file_ext;

If there is any special character in the name of the Concurrent Program it may create problems in opening or saving the output file unless the default applications corresponding to the Output File Formats are used on the Windows client machine.

For example create a Concurrent Program with the name as "PROLDAN - ñáéíóúäëiöü - Active Users". Execute the Concurrent Program to generate all the supported output formats. All the output files could be saved on the Windows Client machine. Here are the names under with the different output files were saved as:
.
For Text: PROLDAN - ñáéíóúäëiö _060705.txt
For HTML: PROLDAN - ñáéíóúäëiö _060705.html
For PDF: PROLDAN - ñáéíóúäëiö _060705.pdf
For PCL: PROLDAN - ñáéíóúäëiö _060705.pcl
For Postscript: PROLDAN - ñáéíóúäëiö _060705.ps
For XML: PROLDAN - ñáéíóúäëiö _060705.xml
.

Text Files should be opened using Notepad on the Windows Client machine.

HTML Files should be opened using IE browser on the Windows Client machine.

PDF Files should be opened using Acrobat Reader on the Windows Client machine.

PCL Files should be opened using Swift View on the Windows Client machine.

Postscript Files should be opened using Ghost View on the Windows Client machine.

XML Files should be opened using IE browser on the Windows Client machine.


All of the above files were successfully saved and opened using the default applications such as Notepad, IE browser, Acrobat Reader, Swift View, Ghost View and again IE browser respectively. This means that Oracle Applications provides output file names for all its supported output formats that are correctly used to open and save these files across all the main applications used to view them.

If there is any issue in saving the output file on the client due to any other reason than the name of the output file, the following can be checked:

NOTE: Be VERY careful when using regedit you may disable your system permanently.
3.1. Open up regedit and search for Temporary Internet Files
3.2. Look for the entry in the
mycomputer\hkey_current_user\software\microsoft\windows\
currentversion\explorer\shell folders
3.3. Click on the cache subkey and rename the directory to one that has
no spaces. This directory must also exist.
For example, change to c:\iecache
3.4. Search again for Temporary Internet Files and you should find the
next subkey my computer\hkey_current_user\software\microsoft\
windows\currentversion\explorer\user shell folders
3.5. Change the value for the cache key to c:\iecache.



One Example

---------------

Logon to Oracle Applications, use the System Administrator Responsibility and Navigate to:
Install -> Viewer Options to open the Form "Viewer Options".

Then do the entry as shown below:

File Format Mime Type Description
Text application/msword Microsoft Word(.doc)
Text application/vnd.ms-excel Excel (.xls)
Text text/plain Notepad(.txt)

Then ensure that the profile option 'Viewer: Application for Text' is set to BLANK at the Site Level.

Then ensure that the profile option 'Viewer: Text' is set to 'browser' at the Site Level.

Then restart the Concurrent Processing Server.

Submit a Concurrent Request that generates Text Output File.
Click on View Output button. You will see an LOV showing:
Microsoft Word(.doc)
Excel (.xls)
Notepad(.txt)

When you choose Microsoft Word(.doc), the text file will be transferred using the Mime Type application/msword, so the browser will open the text file in Word.

When you choose Excel (.xls) , the text file will be transferred using the Mime Type application/vnd.ms-excel, so the browser will open the text file in Excel.

When you choose Notepad(.txt), the text file will be transferred using the Mime Type text/plain,
so the browser will open the text file in Notepad.

13 May 2009

Sales Orders: How to find total cost of Sales Order

Using following function to find the cost of a Sales ORDER.

select
TO_CHAR(oe_oe_totals_summary.prt_order_total (header_id),
fnd_currency.safe_get_format_mask (transactional_curr_code, 30)
) order_total
from OE_ORDER_HEADERS_ALL