The problem - Thin Easy Solution for Oracle APPS 11i Remote Print

 
This solution developed by me(jnc) needs IE5/6 to be available and should work from Windows95 upwards.
 
It does not take care of multi-node load balancing situations
and assumes only 1 box server node - the usual case in most installations.
 
Servlet1 jncAppsRequests.java picks up all Print Requests for a
specified Apps User between 2 dates
 
Servlet2 jncAppsPrint.java downloads specified file to front-end
 
VB6 program jncAppsPrinter that
request for Apps User and 2 dates From & To
On "GO" the jncAppsRequests is fired to populate a MS FlexiGrid
 
User double-click on a row in FlexiGrid will show a modal window
use can View, Print in Full or Print in Part
 
MS IE API "URLDownloadToFile" makes the VB6 program almost trivial!
 
At present the program is geared for Text ONLY
but easily extended with Windows API ShellExecute() function
 

 
Detailed Instructions
 
1. 1st find where Apache is under OS Apps Login
    login as appdev say set the environment as needed and then
    env | egrep -i apache
 
   Oracle makes good use of PERL JAVA SERVLETS but all in a 8.0.6 SQLNet way
   as 90% of Apps is D2K 6i. The JDBC of 9i is far better but Apps users use normally version 8.
 
2. I have developed 2 Servlets to be kept in "servlets" directory 
 
    cd   $APPL_TOP/iAS/Apache/Jserv/servlets 
 
    export CLASSPATH=.:$APPL_TOP/8.0.6/jdbc/lib/classes111.zip: 
                                 $APPL_TOP/iAS/Apache/Jsdk/lib/jsdk.jar
 
   The above export is in 1 line no spaces 
 
3. To deploy this in Production   
    put 3 java files in Apache Servlet directory in APPS Node
    Edit 1 line each of jncAppsRequests.java & jncX.java   
         "jdbc:oracle:thin:@coil12:1521:dev","dic","target"  
    to something that will work in your PROD
 
    Test using SQLPLus Also edit & compile jncX.java
    javac jncX.java     
    and run using "java jncX UPPERCASEUSER 11-Mar-06 11-Mar-06"
    Only when SQLPLUS & jncX both work in PROD
    then compile BOTH servlets as Apache does not have admin unload of servlet from memory
 
    Avoid trial & error - hence use jncX which is main command-line program version of Servlet
 
    javac jncAppsPrint.java
    javac jncAppsRequests.java   
 
   There is no standard method/mechanism to unload a servlet from memory.
   This can be changed by a setting in Apache Jserv but I would NOT recommend change.
   Hence I followed soft option of changing filename and classname during tests - very painful
 
4. Please go through the two trivial servlets.
   To appreciate Oracle ERP with upcoming SOA Fusion  BPEL etc... you need to be Java oriented
   It is VERY EASY to learn Java as there are numerous excellent web resources
 
5. The VB6 frontend is also very small.
    The Win32 IE6 API URLDownloadToFile does all the hard work
 
   Edit the VB6 apps 2 URLs with hard coded IP addresses visible by NAT from outside firewall.
   Till you have firewall activated use Package IP that all users can see
   If you want to hardcode user or restrict USER create a default parameter file in c:\Reports
 
 
6. Make VB6 installer package for the application
    manually create c:\Reports and ensure 4 exe programs are there
    print16 pgfilt notepad unix2dos
 
7. In future you should extend this to work for HTML PDF PS etc ....
You can use the Windows API ShellExecute() function to start the application associated with a given document extension without knowing the name of the associated application. For example, you could start the Acrobat Reader program by passing the filename DIC.PDF to the ShellExecute() function.

See example at end - it works!
 
 
The SQL
 SELECT r.request_id,                                       
        r.actual_completion_date,                           
        n.user_concurrent_program_name,                      
        r.completion_text,                                  
        r.outfile_name
   FROM applsys.fnd_concurrent_requests r,                         
        applsys.fnd_user                u,                             
        apps.fnd_concurrent_programs_vl n             
  WHERE printer IS NOT NULL 
    AND r.requested_by = u.user_id                     
    AND u.user_name = ? 
    AND r.program_application_id =  n.application_id     
    AND r.concurrent_program_id = n.concurrent_program_id                                 
    AND UPPER(NVL(r.output_file_type,'TEXT')) = 'TEXT'        
    AND actual_completion_date                              
        BETWEEN to_date( ? ) AND ( to_date( ? ) + 1 )       
 ORDER BY actual_completion_date desc, request_id desc
 
 
 
Interesting!
In Oracle Applications Release 11i (11.5.7 and higher) the TCF (Thin Client Framework) SocketServer is implemented as a servlet that runs within the Apache JServ engine framework. The TCF SocketServer enables certain Java components of the Oracle Applications user interface to communicate with the middle tier and database tier. These components include the AK Object Navigator, the Function Security Menu Viewer, BOM Flow Routing Network Designer, WIP Manufacturing Scheduling Workbench, and others. The TCF SocketServer process should always be running in a production installation.
 
Prior to Release 11i (11.5.7 and higher) the TCF SocketServer was implemented as a standalone process.
 
This new implementation does require that you have Apache and Apache Jserv installed. There are no additional manual steps required for the TCF SocketServer, assuming that the Apache installation is set up properly. However, there are some recommended steps related to the Apache configuration. First, you should check that the Apache JServ engine is configured properly to run servlets. Second, you should add the TCF SocketServer to the list of servlets that are started automatically when the Apache Jserv is started.
 
This exercise should motivate all in Oracle Apps Tech to hunger for hot cups of Java!
 
 Regards
-jnc 
 
 
Jayanta Narayan Choudhuri
Flat 302, 395 Jodhpur Park
Kolkata 700 068
India
TelRes: 91(33)2473-1891 
           91(33)2414-4719
Mobile: 91 98302-42070
Email:
sss@cal.vsnl.net.in
URL: http://www.geocities.com/ojnc

 
Private Sub Command1_Click()
fHandleFile "d:\MTFSB\wndw-ebook.pdf", WIN_NORMAL
End Sub

 
Private Declare Function apiShellExecute Lib "shell32.dll" _
    Alias "ShellExecuteA" _
    (ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) _
    As Long
 
'***App Window Constants***
Private Const WIN_NORMAL = 1         'Open Normal
Private Const WIN_MAX = 3            'Open Maximized
Private Const WIN_MIN = 2            'Open Minimized
 
'***Error Codes***
Private Const ERROR_SUCCESS = 32&
Private Const ERROR_NO_ASSOC = 31&
Private Const ERROR_OUT_OF_MEM = 0&
Private Const ERROR_FILE_NOT_FOUND = 2&
Private Const ERROR_PATH_NOT_FOUND = 3&
Private Const ERROR_BAD_FORMAT = 11&
 
'***************Usage Examples***********************
'Open a folder:     ?fHandleFile("C:\TEMP\",WIN_NORMAL)
'Call Email app:    ?fHandleFile("
mailto:dash10@hotmail.com",WIN_NORMAL)
'Open URL:          ?fHandleFile("
http://home.att.net/~dashish", WIN_NORMAL)
'Start Access instance:
'                   ?fHandleFile("I:\mdbs\CodeNStuff.mdb", Win_NORMAL)
'Start Acrobat Reader:
'                   ?fHandleFile "d:\MTFSB\wndw-ebook.pdf", WIN_NORMAL

'****************************************************
 
Function fHandleFile(stFile As String, lShowHow As Long)
Dim lRet As Long, varTaskID As Variant
Dim stRet As String
    'First try ShellExecute
    lRet = apiShellExecute(hWndAccessApp, vbNullString, _
            stFile, vbNullString, vbNullString, lShowHow)
           
    If lRet > ERROR_SUCCESS Then
        stRet = vbNullString
        lRet = -1
    Else
        Select Case lRet
            Case ERROR_NO_ASSOC:
                'Try the OpenWith dialog
                varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " _
                        & stFile, WIN_NORMAL)
                lRet = (varTaskID <> 0)
            Case ERROR_OUT_OF_MEM:
                stRet = "Error: Out of Memory/Resources. Couldn't Execute!"
            Case ERROR_FILE_NOT_FOUND:
                stRet = "Error: File not found.  Couldn't Execute!"
            Case ERROR_PATH_NOT_FOUND:
                stRet = "Error: Path not found. Couldn't Execute!"
            Case ERROR_BAD_FORMAT:
                stRet = "Error:  Bad File Format. Couldn't Execute!"
            Case Else:
        End Select
    End If
    fHandleFile = lRet & _
                IIf(stRet = "", vbNullString, ", " & stRet)
End Function
'************ Code End **********