You are on page 1of 4

Oracle Personalization, Execute A Procedure, Return Value To Screen?

[Video] MODULE:
Oracle Inventory Management

PROBLEM STATEMENT
How does one look up values from the database and populate fields using Personalization?

SOLUTION
This should be possible using Personalization with a function on the database that retrieves values based on other data entered on the screen by the user. The function then returns these values to a field on the screen. An example with a movie viewlet recording and screen shots follows. Documentation This is a tricky area and there is not a lot of documentation on the subject. This is one good overview note about personalization though the note does not have details on this topic: Note 743490.1 Customization in Oracle Applications. There are discussions about similar topics on external forums like this one mentioned only as a reference. Note that links change and this was valid as of June 2010. Here is the link: http://apps2fusion.com/apps/21-technical/296-stored-procedure-form-personalization. Example Here is a simple example using a function in the database that queries values, then a personalization that sets the value queried from dual. In this example, the function is extremely simple but more complex logic can be used. Here is the code entered for the personalization text entered as the value for the account. This example is defined in the miscellaneous transactions form (INVTTMTX.fmb) and passes the item number to the function: =select JBP_TEST_f1(''||${item.MTL_TRX_LINE.ITEM.value}||'') from dual

Note that the variable in this case is written as "${item.MTL_TRX_LINE.ITEM.value}". The text "MTL_TRX_LINE.ITEM." is the Block and Field where the item number is written. The syntax around the block and field name ensures that the callout is made to replace the value of the item before passing the text to the function. You can use similar naming for your own fields finding the name of the Block and Field using Help > Diagnostics > Examine. Here is the example routine used - this just does a simple select from dual but other advanced logic could be used: create or replace function JBP_TEST_f1 (p_value in varchar2 default 'none') return varchar2 as l_return_variable varchar2(1000) := 'No Value';
Junaid Iftikhar Ahmed | Sr.Oracle Solution Architect & PM| BCS-SE, MBA-FIN, SCM-EXP

begin select 'x' into l_return_variable from dual; return(p_value||'+'||l_return_variable); end; /

Setup Steps Video - Viewlet recording of personalization (05:57) 1. In SQL, create the function: create or replace function JBP_TEST_f1 (p_value in varchar2 default 'none') return varchar2 as l_return_variable varchar2(1000) := 'No Value'; begin select 'x' into l_return_variable from dual; return(p_value||'+'||l_return_variable); end; /

* Create the function and ensure it is valid. Here is an example SQL for checking for invalids: select object_name, object_type, owner, status from dba_objects where status = 'INVALID' order by object_name

2. Open the form that you want to personalize, then choose Help > Diagnostics > Custom Code > Personalize. In this case, the miscellaneous transactions form is opened.

Junaid Iftikhar Ahmed | Sr.Oracle Solution Architect & PM| BCS-SE, MBA-FIN, SCM-EXP

3. Enter the main information about when this personalization will be active.

4. Enter the action information detailing what the personalization will do. =select JBP_TEST_f1(''||${item.MTL_TRX_LINE.ITEM.value}||'') from dual

Junaid Iftikhar Ahmed | Sr.Oracle Solution Architect & PM| BCS-SE, MBA-FIN, SCM-EXP

5. Save the changes and test the personalization. 6. In this case, the item number is passed from the screen to the database function. The function returns the same value plus a value retrieved from the database. The value is then replaced for the Account field on the screen.

Junaid Iftikhar Ahmed | Sr.Oracle Solution Architect & PM| BCS-SE, MBA-FIN, SCM-EXP

You might also like