View Object Exception -
VO extension is very useful, when need to add a new item to a region. Extend the VO and include the respective column in sql statement. Below are the steps need to follow in order to extend any VO.
1) Go to About This page and check the VO name being used for that region
2) FTP to JAVA_TOP to download the VO and dependent files.
3) De compile the class files and generate the source code
4) Create the same file structure in my projects under Jdeveloper folder
5) Create a new View Object in same structure under your custom path
6) Include the new column in SQL query and finish
7) Open the project properties and click on BC4J component
8) Select substitution and choose standard view as source and custom extended view as substitute
9) Project_Name.jpx file will be generated in myprojects
10) FTP back new extended view and subsequent class files to correct location on server
11) Also place the server.xml file
12) Run the JPXimporter
13) Go to Application and personalize the region
14) Create new item with viewSource = Standard VO Name and viewAttribute= newly added column name
Example -
Requirement – Introduce a new column in My Requisition Table Region to display the Item number in comma separated concatenated format This can be achieved by extending underlying VO, Below are the steps.
Write a program unit to get required values. Input parameter must be in existing VO columns.
CREATE OR REPLACE FUNCTION APPS.Sandeep_Test_prog(param IN VARCHAR2)
RETURN VARCHAR2 AS
CURSOR cur_item_desc(p_segment1 IN VARCHAR2) IS
SELECT NVL(item_description,'Sandeep') item_desc
FROM po_requisition_lines_all a,po_requisition_headers_all b
WHERE a.requisition_header_id = b.requisition_header_id
AND b.segment1=p_segment1;
CURSOR cur_item_number(p_description IN VARCHAR2) IS
SELECT DISTINCT NVL(segment1, 'Sandeep') itemNumber
FROM mtl_system_items_b
WHERE UPPER (description) = UPPER (p_description);
p_item_number VARCHAR2 (100) := null;
BEGIN
FOR c1 in cur_item_desc(param)
LOOP
dbms_output.put_line('Outer Loop>>'||c1.item_desc);
FOR c2 in cur_item_number(c1.item_desc)
LOOP
dbms_output.put_line('Inner Loop >>'||c2.itemNumber);
IF c2.itemNumber<>'Sandeep' THEN
IF p_item_number IS NULL THEN
p_item_number := p_item_number ||c2.itemNumber ;
FOR c1 in cur_item_desc(param)
LOOP
dbms_output.put_line('Outer Loop>>'||c1.item_desc);
FOR c2 in cur_item_number(c1.item_desc)
LOOP
dbms_output.put_line('Inner Loop >>'||c2.itemNumber);
IF c2.itemNumber<>'Sandeep' THEN
IF p_item_number IS NULL THEN
p_item_number := p_item_number ||c2.itemNumber ;
ELSE
p_item_number := p_item_number||','|| c2.itemNumber ;
END IF;
ELSE
p_item_number := p_item_number ||',' ;
END IF;
p_item_number := p_item_number||','|| c2.itemNumber ;
END IF;
ELSE
p_item_number := p_item_number ||',' ;
END IF;
END LOOP;
END LOOP;
RETURN p_item_number;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line ('Error');
RETURN 'Sandeep NULL';
END;
END LOOP;
RETURN p_item_number;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line ('Error');
RETURN 'Sandeep NULL';
END;
Check the VO name required to be extended.Click on About This Page
VO being used for these beans values is MyReqsGlanceVO
Check the full path in Business Component References Details
oracle.apps.icx.por.reqmgmt.server.MyReqsGlanceVOFTP VO and respective VOImpl and VORowImpl class files. Create a similar package structure in JDev myprojects forlder and place the all files and create a new view object.
Modify the SQL and include custom column
Some time you may encounter below error message . To avoid it keep sql query as original and press next till last page. Then come back to SQL page and do the your changes and then press next. It won’t come again.
Press next till reach below page and click the checkbox Generate Java file for ViewRowClass and finish.
This will generate VOImpl and VORowImpl java files also. Now open the Project Properties.
Business Components >> Substitutions >> Available ( Choose the standard VO ) >> Substitute (Pick the extended VO).
If this is new substitution, ADD button will be enabled else UPDATE.
This will generate a OAProject10.jpx and server.xml files. FTP all files at server and run JPX importer to upload the import.
Now Go to Application
Click on Personalize “This Table display a list…..” link
Click create Item icon for Advanced Table
Give the ID Name and Apply – It will create a new column in Advanced Table
Now click new Item icon for TestColumn – It will create a new item for that column. Also create a new item in columnHeader and give a prompt there, to display the column title.
Select the Item style and give the name of item.View Instance hold the name of standard VO and view attribute is custom column name included by us.
Now return to application
New column ColumnHeader holding Item number appears.
No comments:
Post a Comment