SEACH PAGE VALIDATION (Display the Value after Entering value in
Search Criteria)
Public int /**This is Search page Validation*/
ConsumerSearch (OAPageContext pc,OAWebBean wb)
{
int flag = 0; //For search page Validation
String pna=null;
String div=null;
String ctno=null;
XXconsumer_DiscountVOImpl
vo=getXXconsumer_DiscountVO1();
if(pc.getParameter("PartyName")!=null
&& ! pc.getParameter("PartyName").equals(""))
{
pna=pc.getParameter("PartyName").toString();
vo.setWhereClauseParam(0,pna);
flag =1; //For search page Validation
}
else
{
vo.setWhereClauseParam(0,null);
}
if(pc.getParameter("Division")!=null && !
pc.getParameter("Division").equals(""))
{
div=pc.getParameter("Division").toString();
vo.setWhereClauseParam(1,div);
flag=2;//For search page Validation
}
else
{
vo.setWhereClauseParam(1,null);
}
if(pc.getParameter("ContractNumber")!=null && !
pc.getParameter
("ContractNumber").equals(""))
{
ctno=pc.getParameter("ContractNumber").toString();
vo.setWhereClauseParam(2,ctno);
flag=3;//For search page Validation
}
else
{
vo.setWhereClauseParam(2,null);
}
return flag;//For search page Validation
}
IN Search CO
(ProcessFormRequest) Write the code
after B/T Go & Commit
if(pageContext.getParameter("Go")!=null)
{
int
flag=am.ConsumerSearch(pageContext,webBean);
if(flag==0)
{
am.getXXconsumer_DiscountVO1().setWhereClauseParam(0,"asdf");
am.getXXconsumer_DiscountVO1().setWhereClauseParam(1,"lkjh");
am.getXXconsumer_DiscountVO1().setWhereClauseParam(1,"qwer");
throw new OAException("plz entry
any value in search criteria",OAException.ERROR);
}
else
{
am.getXXconsumer_DiscountVO1().executeQuery();
}
}
COMPARE TWO DAYS (Validation
on Start Date & End Date)
In Create CO
(ProcessFormRequest) Write the code b/t the save and commit
import.java.util.Date;
String startdate=pageContext.getParameter("ContractStartDate");
String
enddate=pageContext.getParameter("ContractEndDate");
if((null!=startdate)&&(null!=enddate))
{
Date sdate=new Date(startdate);
Date edate=new Date(enddate);
if(edate.getTime()<sdate.getTime())
{
throw new OAException("end date
should be greaterthan stard date",OAException.ERROR);
}
}
COMPARE TWO NUMBER (Validation
on Levels to Greater than one as another)
In Create CO (ProcessFormRequest) Write the code b/t save and commit
import.oracle.jbo.domain.Number;
String
slevel1=pageContext.getParameter("Level1From");
String
slevel2=pageContext.getParameter("Level1To");
Number nlevel1=null;
Number nlevel2=null;
try
{
nlevel1 = new Number (slevel1);
nlevel2 = new Number (slevel2);
}
catch (Exception e)
{
e.printStackTrace();
}
if((null!=slevel1)&&(null!=slevel2))
{
if(nlevel1.intValue() >
nlevel2.intValue())
{
throw new OAException("level2 is
greater than level1",OAException.ERROR);
}
}
DISPLAY CAPTER LETERS ON FIELD (validation
on BillToLocation)
In Create CO (ProcessRequest)
import
oracle.cabo.style.CSSStyle;
import
oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;
CSSStyle css=new CSSStyle();
css.setProperty("text-transform","uppercase");
OAMessageLovInputBean
mti=(OAMessageLovInputBean)webBean. findChildRecursive("BillToLocation");
if(mti!=null)
{
mti.setInlineStyle(css);
}
CHANGE THE COLORS OF THE LETTERS (Validation
on BillToLocation)
In Create CO
(ProcessRequest)
import
oracle.cabo.style.CSSStyle;
CSSStyle css=new CSSStyle();
css.setProperty("color","#ff0000");//
THIS FOR COLORS OF THE FIED
OAMessageLovInputBean
mti=(OAMessageLovInputBean)webBean.
findChildRecursive("BillToLocation");
if(mti!=null)
{
mti.setInlineStyle(css);
}
SPECIAL CHARACTERS ARE NOT ALLOWED ON
A FIELD (validation On PartyName)
In Create CO
(ProcessFormRequest) Write the code b/t
save and commit
String
cname=pageContext.getParameter("PartyName");
Pattern
p=Pattern.compile("[^a-zA-Z0-9\\s]");
Matcher m=p.matcher(cname);
if(m.find())
{
throw new OAException("Special
Characters are not allowed",OAException.ERROR);
}
FRIEGHT DEDUCTION FIELD SHOULD NOT
ALLOW MORE THAN 100
(Validation
on Freight Deduction)
In Create PG Select Freight Deduction item
In Properties Action Type: FirepartialAction
event: firepartial (here we can
give any name)
In Create CO
(ProcessFormRequest)
if("firepartial".equals(pageContext.getParameter(EVENT_PARAM)))
{
String fright=pageContext.getParameter("FreightDeduct");
Number frighting=null;
try
{
frighting=new Number(fright);
}
catch (Exception e)
{
e.printStackTrace();
}
if((null!=fright))//&&(null!=fright))
{
if((frighting.intValue()<=0)||(frighting.intValue()>=100))
//
if((frighting.intValue()<0)||(frighting.intValue()>100))
{
throw new OAException("frieght
deduction should not allow more then 100",
OAException.ERROR);
}
}
DEPENDENT LOV (Validation on PartyName &
BillToLocation) CREATE 2 VO'S &
VO's to AM
1.CUSTOMERVO (QUERY)
SELECT
hp.party_name,
hp.party_id,
hp.party_number
FROM
hz_parties hp
WHERE
EXISTS
(SELECT HCAS.CUST_ACCOUNT_ID,HCAS.PARTY_SITE_ID,
HPS.PARTY_ID
FROM hz_cust_acct_sites_all HCAS,
HZ_PARTY_SITES HPS
WHERE
HPS.PARTY_SITE_ID = HCAS.PARTY_SITE_ID AND
HP.PARTY_ID
= HPS.PARTY_ID AND
HP.STATUS
<> 'M')
ORDER BY HP.PARTY_NAME
2. LOCATIONVO
(QUERY)
SELECT
hzsu.site_use_id,
hzl.address1||DECODE(hzl.address2,NULL,NULL,','||hzl.address2)||
','||hzl.city||','||hzl.country||','||hzl.postal_code
LOCATION,
hp.party_id
FROM
hz_parties hp,
hz_cust_accounts hza,
hz_cust_acct_sites_all hzas,
hz_cust_site_uses_all hzsu,
hz_party_sites hzps,
hz_locations hzl
WHERE
hza.party_id = hp.party_id
AND hzas.cust_account_id =
hza.cust_account_id
AND hzps.party_site_id = hzas.party_site_id
AND hzl.location_id = hzps.location_id
AND hzsu.site_use_code = 'BILL_TO'
AND hzsu.cust_acct_site_id =
hzas.cust_acct_site_id
AND hzsu.org_id = hzas.org_id
Create one item under DefaultDebouleRegion
Item
Style: Form Value ID& Prompt:
Linkid
Create one more Mapping under PartyName
In Properties: LOV Region Item: PartyId
Return Item: Linkid
Create one more Mapping under
BillToLocation
In Properties: LOV Region Item: PartyId
Criteria item: Linkid
DEPENDENT POPLIST
Create
2 VO's Under POP List..Server & Attach VO's To AM
1.
DNameVO: SELECT DNAME FROM SCOTT.DEPT
2.
ENameVO: SELECT ENAME, DNAME FROM SCOTT.EMP E, SCOTT.DEPT D WHERE
E.DEPTNO=D.DEPTNO
In
Search PG Create Item under MessageComponetLayout
Item Style: Message
Choice Id & Prompt: DName
In Properties: PickListviewinstance: DNameVo
PickdisplayAttribute:
DName
PicklistvalueAttribute: DName
Add Block Value : False ( if use this values
will enable in field)
Action
Type: FirePartialAction
Event: DName
Create
one more Item Style: MessageChoice Id & Prompt: EName
In Properties: PickListviewinstance: ENameVo
PickdisplayAttribute: EName
PicklistvalueAttribute: EName
Add Block Value : False ( if use this values
will enable in field)
Go to AMIpmL.java
public
void initquary (String dname)
{
EnameVOImpl vo=getEnameVO1();
vo.setWhereClause("DNAME=:1");
vo.setWhereClauseParams(null);
vo.setWhereClauseParam(0,dname);
vo.executeQuery();
}
In Search CO (ProcessFormRequest)
import
java.io.Serializable;
if("Dname".equals(pageContext.getParameter(EVENT_PARAM)))
{
String
dname=pageContext.getParameter("Dname");
if(!(("".equals(dname))&&(dname==null)))
{
Serializable[] param={dname};
am.invokeMethod("initquary",param); }
}
DISPLAY CURRENCY VALUE/FORMAT (Validation
on Advertising Rebate)
In Search VO we have to ADD 1
Column -Advertising Rebate
In Search PG Create Item under Table Region
Item Id &Prompt: Advertising Rebate Style: message Styled Text input
In
Properties: View Instance: SearchVo
View Attribute: AdvertisingRebate
In Search CO (ProcessRequest)
import
oracle.apps.fnd.framework.webui.beans.table.OATableBean;
import
oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;
OATableBean
tb=(OATableBean)webBean.findChildRecursive("region4");
OAMessageStyledTextBean
mst=(OAMessageStyledTextBean)webBean.
findChildRecursive("ADVERTISING_REBATE");
if(mst!=null)
{
mst.setCurrencyCode("USD");
}
EXPORTING DATE TO EXCELL SHEET
In Search PG
Create
Item under RowLoyoutRegion
Item Id & Prompt:
Export Style: export Button
In properties: View Instance: SearchVO
MESSAGE FILE UPLOADBEAN (Validation
on Attachment Column)
IN Create PG
Attachment Data Type: Make sure=BLOB
if want display the file Name on the
field write below code
InprocessRequest
import
oracle.apps.fnd.framework.webui.beans.message.OAMessageFileUploadBean;
import
oracle.apps.fnd.framework.webui.OADataBoundValueViewObject;
OAMessageFileUploadBean
upload=(OAMessageFileUploadBean)webBean.
findChildRecursive("ContractAttachment");
OADataBoundValueViewObject displaybound=new
OADataBoundValueViewObject
(upload,"FileName");
upload.setAttributeValue(DOWNLOAD_FILE_NAME,displaybound);
Good Job Jennifer, appreciate your sharing.
ReplyDeletereally supper keep it up your good work
ReplyDelete