Enabling & Disabling Concurrent Program Parameter Dynamically
Enabling and disabling a parameter (for taking a valid date) in a concurrent program depending on another parameter
Let’s do this with one example.There is a concurrent program named XXX Invoice Generation which has 2 parameters
Document Type (Others & Sun Trns) and Date
Date field should be enabled only when the Document Type is Sub Trns or else it should be disabled. Also when the Date parameter is enabled, it should accept only dates
So here we have 2 requirements
- Enable and Disable the Date parameter based on the value in Document Type parameter
- Accept only valid dates in Date parameter
So there will be 3 parameters in the concurrent program
Document Type:
Here in this example the parameter is created as Type and prompt as Document Type which is attached to a value set TEST_TYPE which is of type independent and has the values “Others” and “Sub Trns”.Dummy1:
This is the Dummy parameter which is created to control the enabling disabling of the Date parameter.This parameter is attached to a valueset DUMMY1 which is of type independent and has the values “Y”.
select decode(:$FLEX$.Type,'Sub Trns','Y', null) from dual
So when Document Type is “Sub Trns”, Dummy1 value will be Y or else NULL
Date:
This parameter will behave based on the values in the Dummy1 ParameterUsing above setup enabling and disabling of the Date parameter can be achieved.
But we have another requirement is to validate the values entered in Date parameter as a valid date or not.
Normally this could have been validated using a valueset FND_STANDARD_DATE but that is of Validation Type None and we cannot have the enabling and disabling functionality if we use this.
So technically to achieve this, we need to tweek the requirement little bit.
We cannot have a plain valueset which will simply validate whether it’s a valid date or not. Instead, as we are using a table type valueset to trigger the enabling and siabling of the parameter, we have to create and use a view which will hold dates for certain period like in this example, last 6 months and next 6 months date. And pull the dates from the view in the valueset.
So when user enters a date, it will validate with the list of values for date between last and next 6 months and allow to proceed further.
Normally this could have been validated using a valueset FND_STANDARD_DATE but that is of Validation Type None and we cannot have the enabling and disabling functionality if we use this.
So technically to achieve this, we need to tweek the requirement little bit.
We cannot have a plain valueset which will simply validate whether it’s a valid date or not. Instead, as we are using a table type valueset to trigger the enabling and siabling of the parameter, we have to create and use a view which will hold dates for certain period like in this example, last 6 months and next 6 months date. And pull the dates from the view in the valueset.
So when user enters a date, it will validate with the list of values for date between last and next 6 months and allow to proceed further.
So mentioning below the view created for the same
create or replace view system_date_six_months as
(SELECT (TO_DATE (SYSDATE - 180 + LEVEL, 'DD-MON-RRRR')) date_range
, (TO_CHAR (SYSDATE - 180 + LEVEL, 'Month, DD RRRR')) date_word
FROM DUAL CONNECT BY LEVEL <= 360)
Update on achieving the second requirement for validating entered value as a valid date or not in Date parameter.
Normal date condition can be also achieved with valueset type as special and with Validate condition asFND PLSQL "BEGIN
IF 'AND :$FLEX$.Dummy1' <> 'Y' THEN
NULL;
END IF;
END;"
No comments:
Post a Comment