Anil's Blog is Best Viewed on GOOGLE CHROME

Tuesday, June 8, 2010

Attachment Feature in Advanced Table

Please go through article Advanced Table in Advanced Table via View Link as I am creating attachment link in the existing Advanced Table Region.

This exercise has nothing to do with above mentioned exercise I just referred the already created table region to add the Attachment feature in existing screen.

Steps Followed

1. Create a new column inside the existing Advanced Table Region.
2.  Right click on that column  à New à Item.
3.  Item Style: attachmentImage
     Set following Property of this item:
                                                        *   Automatic Save   à  True
                                                        *   View Instance  ChildVO2








4. When you create item of Type attachmentImage automatically an entityMap get created.
     Set the Entity : DEMO_PA_ASSIGNMENT [This is what we put for testing].






5. Right Click on entityMap and create primaryKeys and here set the View Attribute property of it.






Save your work. Import page again to see the changes. Finally the page will look like this.









Advanced Table in Advanced Table via View Link

This article is contributed by my friend - Pranav Maheshwari. Thanks for his extended support.

In this article we are creating Advanced table in Advanced Table and show the details region data by creating View Link between these tables View Object.




Steps you need to follow.

1. Create a Advanded Table Region on page. We call it Main Table Region.





2. Right click on Table region and click on New -> detail. We call it detail region
3. This details table region will show those column which are not availabe intially when page renders.
4. Create a Application Module
5. Create a Controller.
5. Create Two View Object let say ParentVO and Child VO.
7. Create a View Link between these two view objects.
















8. Take an instance of View Object and View Link in Application Module



Things to remember
1. Both View Object must have one same Key Attribute. Like in our case it is Assignment Id.



2. Also create a Transient Attribute in MasterVO of Boolean Type. We name it DetailFlag.




In Main Table Region set the following property.

1. View Instance: ParentVO1
2. Details View Attribute: DetailFlag
3. Child View Attribute: AssignmentId
4. View Link Instance: MasterToDetailsVL1




In Details Table Region set the following property.

1. View Instance: ChildVO2
2. View Link Instance: MasterToDetailsVL1



Controller CODE:

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import xx.oracle.apps.pa.tableaudit.server.MainApplicationAMImpl;;


public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
    MainApplicationAMImpl AM=(MainApplicationAMImpl)pageContext.getApplicationModule(webBean);
    pageContext.writeDiagnostics(this, "Calling Method", 1);
    AM.AssignmentAuditDetails(pageContext,webBean);
  }


Application Module CODE:

import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.jbo.server.ViewLinkImpl;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;

public void AssignmentAuditDetails(OAPageContext pageContext,OAWebBean webBean)
  {
    ParentVOImpl pvo = getParentVO1();
    pvo.executeQuery();
  }

Add/Minus 1 date from a given date

We will use the Calendar class to achieve.


Controller - Process Request


import java.util.Calendar;

//Here we are getting the projectEnd_Date from PL/SQL which is project end date +1. So we are doing minus from projectEnd_Date variable.

projectEnd_Date  = cstmt.getDate(4);

//Subtracting 1 date from a Given date with the help of Calender CLASS

Calendar cal = Calendar.getInstance();
cal.setTime(projectEnd_Date);
cal.add(Calendar.DATE, -1);

//We need to change the date to String as we have to set this on MessageStyled Bean.
String pNewEndDate  = pageContext.getOANLSServices().dateToString(cal.getTime());

//And finally we are setting this date on MessageStyledText Bean.
OAMessageStyledTextBean projEndDate = (OAMessageStyledTextBean)pageBean.findChildRecursive("ProjectED");

if(projEndDate != null)
{
   Debug.log(pageContext,"SCOCreate","String Project End Date is "+pNewEndDate,1);
   projEndDate.setText(pageContext, pNewEndDate); 
 }