Register PL SQL stored procedure in Oracle Apps
Register PL SQL stored procedure in Oracle Apps:
You have a PL/SQL procedure in your database and you want the user to be able to execute it from Oracle Apps front end. To do so, we have to register the procedure in Oracle Apps. Now let’s see how to do that.
Steps to register a PL/SQL program:
1. Create procedure
2. Create Executable
3. Create Program
4. Add this program to the required request group
1. Create procedure
2. Create Executable
3. Create Program
4. Add this program to the required request group
1. Create Procedure:
Let’s create a procedure that will take input as Item name and returns the respective Item ID.
If you want to register a procedure, the procedure should be created with the two below mandatory parameters:
errbuf : For printing out the error messages.
retcode: return 0 for successful execution
return 1 to end the concurrent program in warning
return 2 to end the concurrent program in error
Let’s create a procedure that will take input as Item name and returns the respective Item ID.
If you want to register a procedure, the procedure should be created with the two below mandatory parameters:
errbuf : For printing out the error messages.
retcode: return 0 for successful execution
return 1 to end the concurrent program in warning
return 2 to end the concurrent program in error
Below is the code snippet of the procedure. Compile the same by connecting to the database as APPS user.
PROCEDURE erps21_conc_prog(
errbuf OUT VARCHAR2,
retcode OUT VARCHAR2,
v_name VARCHAR2 )
IS
v_item_id VARCHAR2(100);
BEGIN
SELECT inventory_item_id
INTO v_item_id
FROM mtl_system_items_b
WHERE segment1 = v_name
AND rownum =1;
fnd_file.put_line(fnd_file.output, 'Parameter received:' || v_item_id);
EXCEPTION
WHEN OTHERS THEN
RETCODE := 2;
errbuf := 'Entered EXCEPTION block';
END;
- We can also use API fnd_concurrent.set_completion_Status to set the concurrent program status.
2. Create Executable:
Navigation: System Administrator / Application Developer responsibility > Concurrent > Executable
Navigation: System Administrator / Application Developer responsibility > Concurrent > Executable
Enter the below details and save.
a.Executable: Enter any meaningful name
a.Executable: Enter any meaningful name
b.Short Name: This should be unique and used for internal purposes
c.Application: Specify under which application you want to register this Concurrent Program, normally all customizations will be registered under custom application.
d.Description: Description
e.Execution Method: Choose PL/SQL Stored Procedure since we want to register a procedure
f.Execution File Name: Enter the procedure name. You don’t need to specify any parameters of procedure here. If your procedure is encapsulated within a package, then executable file name should be entered as <package name>.<procedure name>
3. Create Program:
Navigation: System Administrator/Application Developer responsibility > Concurrent > Program
Navigation: System Administrator/Application Developer responsibility > Concurrent > Program
Enter the below details and save the work.
a.Program: User Understandable Program Name
a.Program: User Understandable Program Name
b.Short Name: This should be a unique name and for system reference
c.Application: Enter the application under which you want to register this concurrent program
d.Executable Name: Enter the Executable Short Name created in Step 2.
e.Method: This will be populated automatically from Executable Definition
f.Output Format: Select the format of the output you want
g.Output Style: Select A4 to print on A4 Paper
h.Printer: You can default any printer or you can enter while submitting concurrent program.
i.Enable Trace: Check this if you want to enable trace on this program. This is normally for debugging performance issues.
j.Use in SRS: Check this box if you want the users to be able run this program from Submit Request window.
Click on Parameters button to define the parameters for your concurrent program.
Enter the below details and save the work.
a.Seq: It’s always better to enter sequences in multiple of 5 or 10 so that you can insert any additional parameters if you want later in between.
a.Seq: It’s always better to enter sequences in multiple of 5 or 10 so that you can insert any additional parameters if you want later in between.
b.Parameter: Enter a name for the parameter.
c.Description: You can see this description while submitting the concurrent program.
d.Value set: Enter a valid value set name. You can use the standard value sets provided as well.
e.Default Type and Value: These fields are optional. They are to be used when you want to default any particular value for a parameter.
Current Date : Will be used to pass the Sysdate as default value
Current Time : Will be used to pass the Systime as default value
Constant : Will be used to pass the constant number or date or string as default value
Segment : will be used to get the Previous parameter value as default to the next parameter
SQL Statement: We can pass the SELECT statement result as default value
Profile : This will be used to pass the user profile value as default like userid ,username,respid,respname and so on.
Required CheckBox : This will be used to make the parameter as mandatory or optional
Current Time : Will be used to pass the Systime as default value
Constant : Will be used to pass the constant number or date or string as default value
Segment : will be used to get the Previous parameter value as default to the next parameter
SQL Statement: We can pass the SELECT statement result as default value
Profile : This will be used to pass the user profile value as default like userid ,username,respid,respname and so on.
Required CheckBox : This will be used to make the parameter as mandatory or optional
f.Prompt: This is the actual parameter name displayed while submitting the concurrent program
g.Token: This should be used only when you are registering a report.This is used to link this parameter to the parameter defined in actual report file(.rdf)
h.Enabled CheckBox: will be used to enable or disable the parameter
i. Display CheckBox: will be used to hide or display the parameter
i. Display CheckBox: will be used to hide or display the parameter
4.Assign to Request Group:
Say you want this program to be accessible to Inventory responsibility.
Say you want this program to be accessible to Inventory responsibility.
First find out the request group of this responsibility.
Navigation: System Administrator Responsibility > Security > Responsibility > Define
Navigation: System Administrator Responsibility > Security > Responsibility > Define
Navigation: System Administrator Responsibility > Security > Responsibility > Request
Query for the Request Group obtained above.
Query for the Request Group obtained above.
Now place the cursor under Requests section and click on ADD icon in the Menu.
Enter the below details and save the work.
1. Type: Enter Program if this is a concurrent program. Enter Set if this is a request set.
2. Name: Enter the concurrent program /set name.
1. Type: Enter Program if this is a concurrent program. Enter Set if this is a request set.
2. Name: Enter the concurrent program /set name.
No comments:
Post a Comment