There are 2 ways of putting validation in SIT.
1) Write the validation logic in Api Hooks provided for hr_sit_api Api. This validation will be fired when user will try to enter data in SIT using Forms or Self service.
2) Another way of putting validation on self service page is writing a controller and attaching this controller to SIT self service page using personalization.
Here is the detail steps to acheive validation using personalization:-
1) Create a controller file SITCO which wil extend standard oracle controller SitUpdateCO
// Source File Name: SITCO.java
package oracle.apps.per.selfservice.specialinformation.webui;
import java.sql.Connection;
import java.sql.SQLException;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.flexj.KeyFlexfield;
import oracle.apps.fnd.flexj.Segment;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.OAKeyFlexBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.per.selfservice.common.SSHRParams;
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.sql.ARRAY;
import oracle.sql.ArrayDescriptor;
public class SITCO extends SitUpdateCO
{
public SITCO()
{
}
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
}
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
if(pageContext.getParameter("HrNext") != null)
{
String s = null;
OAKeyFlexBean kffBean = (OAKeyFlexBean)webBean.findIndexedChildRecursive("HrSitKeyFlex");
KeyFlexfield keyflexfield = (KeyFlexfield)kffBean.getAttributeValue
(OAWebBeanConstants.FLEXFIELD_REFERENCE);
String s_struc_code = keyflexfield.getStructureCode();
String str[] = new String[30];
for(int i = 0; i < 10; i++)
try
{
str[i] = keyflexfield.getSegment(i).getInputValue();
}
catch(Exception e)
{
str[i] = null;
}
OAApplicationModule am = pageContext.getRootApplicationModule();
Connection connection = am.getOADBTransaction().getJdbcConnection();
String v_message = null;
Integer s_prsn = new Integer(pageContext.getEmployeeId());
SSHRParams sshrparams = new SSHRParams(am.getOADBTransaction());
String v_emp_id = sshrparams.getPersonId();
sshrparams.setProfiles();
String v_person_id = s_prsn.toString();
try
{
ArrayDescriptor segvaldesc = ArrayDescriptor.createDescriptor("SEGMENT_VALUES", connection);
ARRAY segval = new ARRAY(segvaldesc, connection, str);
OracleCallableStatement ocs = (OracleCallableStatement)connection.prepareCall("Begin
XXHR_SIT_VALIDATION_PKG.VALIDATE_RECORD
(p_sit_code=>:1,p_segment=>:2,p_person_id=>:3,p_employee_id=>:4,p_message=>:5); end;");
ocs.setString(1, s_struc_code);
ocs.setARRAY(2, segval);
ocs.setString(3, v_person_id);
ocs.setString(4, v_emp_id);
ocs.registerOutParameter(5, 12);
ocs.execute();
v_message = ocs.getString(5);
ocs.close();
}
catch(SQLException sqlexception)
{
throw new OAException("Error " + sqlexception.getMessage(), (byte)2);
}
if(v_message != null)
throw new OAException(v_message, OAException.ERROR);
super.processFormRequest(pageContext, webBean);
} else
{
super.processFormRequest(pageContext, webBean);
}
}
public static final String RCS_ID = "$Header$";
public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion("$Header$", "%packagename%");
}
2) Login to oracle application and click on personalize link on SIT data entry page.
3) Select Complete view and then against
Default Single Column: Special Information click the personlize link
4) Enter
oracle.apps.per.selfservice.specialinformation.webui.SITCO for Controller class as shown below:-
5) Now create a package named XXHR_SIT_VALIDATION_PKG and put a function in it called VALIDATE_RECORD (p_sit_code varchar2,p_segment SEGMENT_VALUES,p_person_id number,p_employee_id number ,p_message varchar2);
6) Structure of this package will be somewhat shown below:-
Create or replace package body XXHR_SIT_VALIDATION_PKG as
function VALIDATE_RECORD (p_sit_code varchar2,p_segment SEGMENT_VALUES,p_person_id number,p_employee_id number ,p_message varchar2) as
begin
if p_sit_code varchar2 = then
if p_segment(1)= then
your code here
end if;
elsif p_sit_code varchar2 = then
end if;
exception
when others then
-----
end;
end;