This discussion is archived
1 Reply Latest reply: Dec 4, 2012 11:25 PM by FrankvdSchans RSS

How to make attachments mandatory in oracle iExpense Page

krishna vadlapatla Newbie
Currently Being Moderated
Hi All

I have a requirment of making the attachment mandatory in Oracle Iexpenses. When the user hit the submit button in the review page I have to check whether it has at least one attachment either at the header level or at the line level.
I tried to extend the FinalReviewPage controller and i am getting the below error. Not sure what went wrong. Please throw some ideas. Any help would be greatly appreciated.

Error Message
## Detail 0 ## java.lang.NullPointerException at xxlin.oracle.apps.ap.oie.entry.summary.webui.XXXFinalReviewPageCO.processFormRequest(XXXFinalReviewPageCO.java:26)


Following is the logic I have written in the controller.

package xxx.oracle.apps.ap.oie.entry.summary.webui;

import oracle.apps.ap.oie.entry.summary.webui.FinalReviewPageCO;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageAttachmentLinkBean;

public class XXXFinalReviewPageCO extends FinalReviewPageCO {

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{ super.processRequest(pageContext, webBean);
     }
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
if(pageContext.getParameter("OIESubmit") != null)
{
OAApplicationModule oam = pageContext.getApplicationModule(webBean);
String val ;
OAMessageAttachmentLinkBean oamessageattachmentlinkbean = (OAMessageAttachmentLinkBean)webBean.findChildRecursive("AttachmentLink");
val = (String)oamessageattachmentlinkbean.getAttributeValue(pageContext.getRenderingContext(),TEXT_ATTR);
if("None" .equals(val))
{   throw new OAException("Attachment is mandatory to Claim the expenses ",OAException.ERROR);                    
}
else
{
super.processFormRequest(pageContext, webBean);
}
}
}
public XXLINFinalReviewPageCO()
{
}
}


Regards!
krishna
  • 1. Re: How to make attachments mandatory in oracle iExpense Page
    FrankvdSchans Newbie
    Currently Being Moderated
    The following works for us. I've created a controller extension for the FinalReviewPageCO in iExpense using the following code. It throws an error if receipt is required and no attachment was supplied.

    package xx.oracle.apps.ap.oie.entry.summary.webui;
    import oracle.apps.ap.oie.entry.summary.webui.FinalReviewPageCO;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;
    import oracle.apps.fnd.framework.webui.beans.message.OAMessageAttachmentLinkBean;
    import oracle.apps.fnd.framework.OAException;

    public class xxFinalReviewPageCO extends FinalReviewPageCO
    {

    public void processRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
    {
    super.processRequest(oapagecontext, oawebbean);
    }

    public void processFormData(OAPageContext oapagecontext, OAWebBean oawebbean)
    {
    super.processFormData(oapagecontext, oawebbean);
    }

    public void processFormRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
    {
    String s = oapagecontext.getParameter("OIESubmit");

    if (s != null)
    {
    OAMessageStyledTextBean oamessagestyledtextbean = (OAMessageStyledTextBean)oawebbean.findChildRecursive("ReceiptRequired");
    String strReceiptRequired = oamessagestyledtextbean.getText(oapagecontext);

    if ("Required".equals(strReceiptRequired))
    {
    // Receipt is required, check for required attachment

    OAMessageAttachmentLinkBean oamessageattachmentlinkbean = (OAMessageAttachmentLinkBean)oawebbean.findChildRecursive("ReviewGenInfoHeaderAttachments");
    String strAttachment = (String)oamessageattachmentlinkbean.getAttributeValue(oapagecontext.getRenderingContext(), TEXT_ATTR);

    if("None".equals(strAttachment.trim()))
    {
    throw new OAException("XX", "XX_AP_WEB_ATTACHMENT_REQD");
    }
    else
    {
    super.processFormRequest(oapagecontext, oawebbean);
    }
    }
    else
    {
    super.processFormRequest(oapagecontext, oawebbean);
    }
    }
    else
    {
    super.processFormRequest(oapagecontext, oawebbean);
    }
    }
    }

    Regards,
    Frank

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points