March 20, 2017

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
  1. Enable and Disable the Date parameter based on the value in Document Type parameter
  2. Accept only valid dates in Date parameter
So actually to achieve the enable and disable of the Date parameter, we need to have a dummy parameter created which will not be displayed and the same should not be used in the code present in background.

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”.


Also set default value to populate Y when the Document Type is Sub Trns else NULL
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 Parameter


So to achieve this, we need to use a table type valueset where we need to put the validation for validating with Dummy1 parameter value.

So as per the requirement when Document Type is “Sub Trns”, then Date should be enabled which means when Dummy1 value is Y.



Using 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.

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 as

FND PLSQL "BEGIN
IF 'AND :$FLEX$.Dummy1' <> 'Y' THEN
NULL;
END IF;
END;"
Read More
Copyright © . Oracle Apps (SCM) . All Rights Reserved
Oracle Apps (SCM) is an online knowledge sharing blog which index online free tutorials, blogs and other sources, to get easier and accessible manner. The blog has been created keeping only one intention of sharing knowledge and for learning purpose. All trademarks, trade names, service marks, copyrighted work, logos referenced herein belong to their respective owners/companies. If any of the posting is violating copyright and you want us to remove that content. Please contact Here