register pl sql stored procedure in oracle apps.docx

12
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: 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. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 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

Upload: praveen-kumar

Post on 09-Dec-2015

240 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Register PL SQL stored procedure in Oracle Apps.docx

Register PL SQL stored procedure in Oracle AppsRegister 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:

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.

123456789101112131415161718

PROCEDURE erps21_conc_prog(errbuf OUT VARCHAR2,retcode OUT VARCHAR2,v_name VARCHAR2 )ISv_item_id VARCHAR2(100);BEGINSELECT inventory_item_idINTO v_item_idFROM mtl_system_items_bWHERE segment1 = v_nameAND rownum =1;fnd_file.put_line(fnd_file.output, 'Parameter received:' || v_item_id);EXCEPTIONWHEN OTHERS THENRETCODE := 2;errbuf := 'Entered EXCEPTION block';END;

We can also use API  fnd_concurrent.set_completion_Status to set the concurrent program status.

Page 2: Register PL SQL stored procedure in Oracle Apps.docx

2. Create Executable:

Navigation: System Administrator / Application Developer responsibility > Concurrent >

Executable

Enter the below details and save.

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

Page 3: Register PL SQL stored procedure in Oracle Apps.docx

Enter the below details and save the work.

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.

Page 4: Register PL SQL stored procedure in Oracle Apps.docx

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.

b.Parameter: Enter a name for the parameter.

c.Description: You can see this description while submitting the concurrent program.

Page 5: Register PL SQL stored procedure in Oracle Apps.docx

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

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

Page 6: Register PL SQL stored procedure in Oracle Apps.docx

4.Assign to Request Group:

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

Page 7: Register PL SQL stored procedure in Oracle Apps.docx

Navigation: System Administrator Responsibility > Security > Responsibility > Request

Query for the Request Group obtained above.

Page 8: Register PL SQL stored procedure in Oracle Apps.docx

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.

Page 9: Register PL SQL stored procedure in Oracle Apps.docx

2. Name: Enter the concurrent program /set name.

XML Publisher Registration Steps

1)Develop the Report(.rdf) Only  DataModel2)Save the report and Compoile it.3)Move the the .rdf into custom Top like CUS_TOP\11.5.0\Reports\US

 .rdf File registration :

Page 10: Register PL SQL stored procedure in Oracle Apps.docx

  =========================

  4)Create Executeable 

   ====>Pass the Executeable Name :xxxxx

   ====>Short Name                         :xxxxx

   ====>Application name                 :xxxxx

  =====>Execution method               :oracle reports

  =====>Execution file name            :your .rdf file name

5) create Concurrent Program 

        Output = XML

  6)create Request Group and attached to Concurrent program

7) Attach u r request group to based on client given    Responsibility

        go to file---> switch responsility----> select what ever ur add responsibility

Go to view--->request --->  SRS

8)submit ur cp and refresh it we will get output.

9) save your output as .xml format.

10)Copy the Concurrent Program Short name 

11)Open the Ms-WOrd document  Design the Layout  include the follwing Tool Bar options called Form  and Templete builder13)Define the Table and Specify the Titles and Labels whatever we would like to print====>If we want to Develop through wizard  go to Template builder=>data->load XML Data====> Template Builder=>Insert=>Table/form=>wizard====>file=>save=>save Rich text format

14)Include 'Text Form Field' Double CLick => Add Help Text button enter the following  syntax  <?for-each:G_USER_ID?>  : Here G_USER_ID is Group name from .rdf Data Model Note: It means Indirectley Repeating Frame starting

15)Define the Fields which we would like to display

  Include 'Text Form Field' Double CLick => Add Help Text button enter the following  syntax   <?Column Name>?

Note: Define all the fields like this

16)We have to close the Repeating Frame (For each Loop)  Include 'Text Form Field' Double CLick => Add Help Text button enter the following  syntax <?end for-each?>

17)Save the document in .rtf(Rich Text File format)

Page 11: Register PL SQL stored procedure in Oracle Apps.docx

19)Load the .xml file data and generate the Output in pdf Format  Data=>Load XMl Data=>Load the .xml File=>Once Data is Loaded succesfully

20)Generate the Preview as per this Preview=>PDF

1)Develop the .rdf file and .rtf file2)Register both .rdf and .rtf file

  .rdf File registration :  =========================  1)Move the .rdf file into CUS_TOP\11.5.0\Reports\US  2)Create Execuiteable           Concurrent Program  Output = XML           Request Group           Responsibility           User           SRS  3)Copy the Concurrent Program Short name

  .rtf File Regitration: =======================

1)Goto the XML Publisher Administrator Responsibility2)Select Data Definations form  Enter Data Defination Name = Enter Any Name  Code              = Concurrent Program Short Name  Application              = Any application  startdate      = Current Date

3)Copy the DataDefination name we have to add this to the Templete4)Open the Templete Form  Enter Templete Name : Any Name  DataDefination      : enter data defination whatever we have created  Code                : Concurrent Program Short Name  Type                : rtf  application         : any Application  File                : Upload the .rtf file  Laguage             : English  Territory           : United States

5)Select Apply button

After register the .rtf file submit concurrent Program from SRS window system willautomatically pick the .rtf file and generates  the Output.

If we want to customze the .rtf file we have to download by using templete , Customize thenupload the .rtf templete