Reporting to the concurrent program output file
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:
Add a procedure to write to the output file
Add a cursor to get some data
Add code to fetch data and write to the output file
Run the concurrent program
View the concurrent program output file
Add a procedure to write to the output file
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.
How to do it...
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.
How it works...
We have now added a procedure to write messages to the concurrent program output file.
Add a cursor to get some data
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.
How to do it...
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:
Note
Remember that the cursor is available in the download bundle in the XXHREEBS_1_6.pkb
package.
How it works...
We have added a cursor that will return data at runtime. We want to format the data and display it in the output file.
Add code to fetch data and write to the output file
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.
How to do it...
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.
How it works...
For the employee record that we have entered in the person parameter we will fetch the record from the database and write the details to the output file.
Running the concurrent program
Now we want to run the concurrent program testing that the code we have just added writes messages to the log file.
How to do it...
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.)
How it works...
We have run the concurrent program to test the code that we added to write to the output file. We can now view the output to ensure that the layout is as expected.
View the concurrent program output file
Now we want to view the output file to see the messages we have written to it.
How to do 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:
How it works...
As you can see we have generated formatted data that we have written to the output file.