By PRajkumar on Apr 29, 2012
1. Create a Search Page to Create a page please go through the following link
2. Implement a Delete in your SearchEOImpl Class
public void remove()
{ super.remove();
} // end remove()
{ super.remove();
} // end remove()
3. Create a Delete Image
Select ResultsTable right click > New > Item
Set following properties for New Item
ID – DeleteAction
Item Style – image
Image URI – deleteicon_enabled.gif
Atribute Set -- /oracle/apps/fnd/attributesets/Buttons/Delete
Prompt -- Delete
Additional Text – Delete record action enabled
Height – 24
Width – 24
Action Type – fireAction
Event – delete
Submit – True
Select Parameter Properties define parameter name as Column1 and whose value is
${oa.SearchVO1.Column1}
Select Parameter Properties define parameter name as Column2 and whose value is
${oa.SearchVO1.Column2}
Select OK button to create your request parameters
4. Add Page Controller
Add a New Contoller for SearchPG
Name – SearchCO
Package -- prajkumar.oracle.apps.fnd.searchdemo.webui
Implement Delete Action
5. Add deleteRecord() method to SearchAMImpl
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.jbo.domain.Number;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;
import oracle.jbo.RowSetIterator;
...
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.jbo.domain.Number;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;
import oracle.jbo.RowSetIterator;
...
public void deleteRecord(String Column1)
{ OAViewObject vo = (OAViewObject)getSearchVO1();
SearchVORowImpl row = null;
{ OAViewObject vo = (OAViewObject)getSearchVO1();
SearchVORowImpl 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 = (SearchVORowImpl)deleteIter.getRowAtRangeIndex(i);
row.remove();
getTransaction().commit();
break;
}
}
deleteIter.closeRowSetIterator();
} // end deleteRecord
if (fetchedRowCount > 0)
{ deleteIter.setRangeStart(0);
deleteIter.setRangeSize(fetchedRowCount);
for (int i = 0; i < fetchedRowCount; i++)
{
row = (SearchVORowImpl)deleteIter.getRowAtRangeIndex(i);
row.remove();
getTransaction().commit();
break;
}
}
deleteIter.closeRowSetIterator();
} // end deleteRecord
Note – Create Standard FND Messages DELETE_RECORD_WARN and DELETE_CONFIRM
6. Add DeleteSelection Handler Code to SearchCO.processFormRequest()
import com.sun.java.util.collections.HashMap;
import oracle.apps.fnd.framework.webui.OADialogPage;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.OARow;
import oracle.apps.fnd.framework.OAApplicationModule;
...
import oracle.apps.fnd.framework.webui.OADialogPage;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.OARow;
import oracle.apps.fnd.framework.OAApplicationModule;
...
OAApplicationModule am = pageContext.getApplicationModule(webBean);
OAViewObject vo =(OAViewObject)am.findViewObject("SearchVO1");
OAViewObject vo =(OAViewObject)am.findViewObject("SearchVO1");
String rowRef =
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
OARow row = (OARow)am.findRowByRef(rowRef);
if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))
{
String Column1 = (String)row.getAttribute("Column1");
String Column2 = (String)row.getAttribute("Column2");
{
String Column1 = (String)row.getAttribute("Column1");
String Column2 = (String)row.getAttribute("Column2");
String Column3 = pageContext.getParameter("Column1");
String Column4 = pageContext.getParameter("Column2");
String Column4 = pageContext.getParameter("Column2");
MessageToken[] tokens = { new MessageToken("COLUMN1", Column1),
new MessageToken("COLUMN2", Column2)};
OAException mainMessage = new OAException("FND",
"DELETE_RECORD_WARN", tokens);
new MessageToken("COLUMN2", Column2)};
OAException mainMessage = new OAException("FND",
"DELETE_RECORD_WARN", tokens);
OADialogPage dialogPage = new OADialogPage(OAException.WARNING,
mainMessage, null, "", "");
mainMessage, null, "", "");
String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);
String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
dialogPage.setOkButtonItemName("DeleteYesButton");
String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
dialogPage.setOkButtonItemName("DeleteYesButton");
dialogPage.setOkButtonToPost(true);
dialogPage.setNoButtonToPost(true);
dialogPage.setPostToCallingPage(true);
dialogPage.setOkButtonLabel(yes);
dialogPage.setNoButtonLabel(no);
dialogPage.setNoButtonToPost(true);
dialogPage.setPostToCallingPage(true);
dialogPage.setOkButtonLabel(yes);
dialogPage.setNoButtonLabel(no);
java.util.Hashtable formParams = new java.util.Hashtable(1);
formParams.put("Column1", Column3);
formParams.put("Column2", Column4);
dialogPage.setFormParameters(formParams);
pageContext.redirectToDialogPage(dialogPage);
}
formParams.put("Column1", Column3);
formParams.put("Column2", Column4);
dialogPage.setFormParameters(formParams);
pageContext.redirectToDialogPage(dialogPage);
}
7. Add Delete Confirmation Handler Code to SearchCO.processFormRequest()
import java.io.Serializable;
import oracle.apps.fnd.framework.OAApplicationModule;
...
import oracle.apps.fnd.framework.OAApplicationModule;
...
else if (pageContext.getParameter("DeleteYesButton") != null)
{
String Column1 = (String)row.getAttribute("Column1");
String Column2 = (String)row.getAttribute("Column2");
Serializable[] parameters = { Column1 };
{
String Column1 = (String)row.getAttribute("Column1");
String Column2 = (String)row.getAttribute("Column2");
Serializable[] parameters = { Column1 };
OAApplicationModule am =
pageContext.getApplicationModule(webBean);
pageContext.getApplicationModule(webBean);
am.invokeMethod("deleteRecord", parameters);
OAException message = new OAException("FND",
"DELETE_CONFIRM", null,
OAException.CONFIRMATION, null);
"DELETE_CONFIRM", null,
OAException.CONFIRMATION, null);
pageContext.putDialogMessage(message);
}
}
8. Congratulation you have successfully finished. Run Your page and Test Your Work
No comments:
Post a Comment