This blog will help u in applying validations in Report parameters.
One simple way is to use LOVs but this does will not help u every time.
Let us start by understanding the requirement.
Requirement: We have a report “XX Leave Balance”, in
this report I have two parameters “From Date” and “To Date”. Now I have
requirement that user should not be able to enter the values in parameters of
different year.
Steps:
- Navigate to Application Developer --> Application --> Validation --> Set
- Enter the details as mentioned below
1.
Value Set Name :
XXFIL_DATE_VALIDATION_VS
2.
List Type : List of Values
3. Format Type : Standard Date
4. Validation
Type : Special- Click on "Edit Information" button.
- In the next window select Event : Validate and paste the code as mentioned below:
FND PLSQL "DECLARE
L_TO_DATE
DATE;
L_MAX_DATE
DATE;
L_FROM_YEAR
VARCHAR2(50);
L_FROM_DATE
date;
L_TO_YEAR
VARCHAR2(50);
BEGIN
L_TO_DATE
:= TO_DATE(:!VALUE,'DD-MON-YYYY');
L_FROM_YEAR
:= EXTRACT (YEAR FROM TO_DATE(':$FLEX$.P_FROM_DATE','YYYY-MM-DD HH24:MI:SS'));
L_TO_YEAR
:= EXTRACT (YEAR FROM L_TO_DATE);
IF
L_TO_YEAR <> L_FROM_YEAR THEN
fnd_message.set_name('XXAPP','XX_DATE_VALIDATE_MSG');
fnd_message.set_token('VAL','Please
select date of same year');
fnd_message.raise_error;
END
IF;
END;
"
- Now attach this value set to your parameter on your concurrent program. Navigate to Application Developer --> Concurrent --> Program
- Now go and run the program & check it.