Now that we have written to the log file to view log information, we want to write more user-friendly information to the user. We will make this more formatted so that it provides useful information to the user about the processing that has taken place.
The tasks we are going to perform in this recipe are as follows:
We are now going to add the code to the executable, which is our package called XXHREEBS
. If you wish to view or copy the code then it can be found in the file XXHREEBS_1_6.pkb
. You can compile the package body provided or use the following instructions to add the code manually.
To add a procedure to write to the output file perform the following steps:
1. Open SQL Developer and connect to the apps user.
2. Navigate to Packages and select the
XXHREEBS
package.3. Now edit the package body.
4. Add a new procedure called
write_output
, shown as follows:5. Compile the package body.
We are now going to add a cursor to our procedure to get some data back so that it can be displayed in the output file.
To write a cursor to retrieve some data perform the following steps:
1. Edit the procedure
First_Concurrent_Program
and add the cursor as shown in the following image:
We are now going to add a cursor for
loop to our procedure to get some data back, so that it can be written to the output file.
To add code to fetch data and write to the output file do the following:
1. Edit the
First_Concurrent_Program
procedure and add a cursorfor
loop to get the data. Make some calls to thewrite_output
procedure to add the information to the output file as shown in the following image:2. Compile the package body.
Now we want to run the concurrent program testing that the code we have just added writes messages to the log file.
To run the concurrent program to view the output file, perform the following:
1. Log in to Oracle with the XXEBS Extending e-Business Suite responsibility.
2. Navigate to Submit Requests and submit a single request.
3. Select the XXHR First Concurrent Program concurrent program and leave the
Run Date
parameter set to the default date (which is the current date).4. Select Vision Corporation from the list of values for the
Organization
parameter and then click OK.5. Select an employee record from the list of values for the
Person
parameter and then click OK.6. Click on the Submit button and when prompted to submit a new request select No and the form will close down.
7. Navigate to View Requests and click on the Find button (to find all requests).
8. You should see that the concurrent program we just submitted has completed successfully. (If it is still Pending then click the refresh button until the status is Completed.)
Now we want to view the output file to see the messages we have written to it.
To open the output file to test our changes do the following:
1. Click on the View Output button and a browser window will open.
2. You will see that the messages we put into the
First_Concurrent_Program
package have been written to the output file as shown in the following image: