Thursday, 21 March 2013

Delete records in OAF page

Delete records in OAF page


Hi Friends, we are going to discuss about delete records in oaf page. In the previous Posts,we have discussed how we can create Data Entry Page in OAF before this we have discussed how we create a “Search Page” in OAF Based on EO. Now in this topic we will try to delete record in OAF PAGE which is based on EO. We will share the detail steps with screen shots to delete the multiple records in oaf page. We need to provide some new privileges in the OAF page to delete records in OAF Page. In this post , we will try to explain each and every details about the Delete records in OAF page.

Step by Step to Delete records in OAF Page

We will start this after creating  “Search Page” in OAF.In the Last Update We have already Create the “Search Page”.So we start to Implement delete record after creating search page.

In the Search Page we have create the “Results Table” in the Structure window as Highlighted below.Right Click on “Results Table”.

Delete records in OAF page
Delete records in OAF page

Click on New =>Click Item
Delete records in OAF page
Delete records in OAF page

Then item1 has created under Region “Results Table” as shown below.



Click on newly created Item1 and then in right han side change the properties for item1.

Set Properties for Item1

ID=DeleteIcon

Item Style=image
Prompt=Delete.
Image URI =deleteicon_enabled.gif.
 
Delete records in OAF page
Delete records in OAF page



Delete records in OAF page
Delete records in OAF page
Delete records in OAF page
Delete records in OAF page
Now we have write code for this .We will create a method “deleteRecord” under “Application Module” java class.


To create method “delete Record”.

Click on “application Module” named “RohitSearchPageAM”.In the Structure pane  It shows the Jave file name “RohitSearchPageAMIMPL.java”.Double Click on this java file .Then AM Java class will open here we create the method name”deleteRecord”.
Delete records in OAF page
Delete records in OAF page

Code of delete Record.

public void deleteRecord(String Column1)
  {
  OAViewObject vo = (OAViewObject)getSupplierVO();
 
    SupplierVORowImpl row = null;

    int fetchedRowCount = vo.getFetchedRowCount();

   RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");
    if (fetchedRowCount > 0)
    {  deleteIter.setRangeStart(0); 
       deleteIter.setRangeSize(fetchedRowCount);
       for (int i = 0; i < fetchedRowCount; i++)
      {
        row = (SupplierVORowImpl)deleteIter.getRowAtRangeIndex(i);
        row.remove();
        getTransaction().commit();
        break;
      }
    }
   deleteIter.closeRowSetIterator();
  }
 ---------------------------------------------------------------------------------------------------------------------------------------------
Delete records in OAF page
Delete records in OAF page





Now again click on “ DeleteIcon”  under “Results Table”.Go to the right hand  side in Property window.
Set Property for Delete Icon.
Action Type=firePartialAction
Event=delete.
Delete records in OAF page
Delete records in OAF page


 
Delete records in OAF page
Delete records in OAF page

To do “Delete” Record OAF we have to do some change in View Object(VO).
Right Click on “supplierVO”.Click “EditSupplierVO”.
Delete records in OAF page
Delete records in OAF page

Click on Java tab as like below.
Select the check box under “View Row Class”.
Select the Check Boxes as like below.

Delete records in OAF page
Delete records in OAF page
Now we have to call the method “deleteRecord”.So we will write code under the controller “RohitSearchPageCO”.Double Click on controller “RohitSearchPageCO” as like beow.
Delete records in OAF page
Delete records in OAF page
 Write code under the controller in processFormRequest as like below
Delete records in OAF page
Delete records in OAF page

Write code under the controller in processFormRequest as like below

    if("delete".equals(pageContext.getParameter(EVENT_PARAM)))
    {
      OAApplicationModule am=(OAApplicationModule)pageContext.getApplicationModule(webBean);
      am.invokeMethod("DeleteRecord",null);
      throw new OAException("Record Deleted Succesfully",OAException.INFORMATION);
     
    }


3 comments:

Richard C. Lambert said...

We will start this after creating “Search Page” in OAF.In the Last Update We have already Create the “Search Page”.So we start to Implement delete record after creating search page. Hack Line Rangers

Unknown said...

Hi rohit,

nice article, i applied your process but i am facing a error.
when i click on delete image it draging the page to below error,could you help me out




Error








You are trying to access a page that is no longer active.
- The referring page may have come from a previous session. Please select Home to proceed.

thanks,
vishnu.

Anonymous said...

your blog is really informative and helpful for me.Thanks for sharing information
Oracle Fusion Financials Online Training
Oracle Fusion Technical Online Training

Post a Comment

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *