Infolinks

Monday, 24 September 2012

Read-Only DFF Segments

Read-Only DFF Segments


Converting normal fields in Oracle Applications Forms into read-only fields is a fairly common requirement and it can be achieved quite easily using Form Personalization. All you need to do is to set the ‘ENABLED’ property of the item to ‘FALSE’.
Read-only Field using Form Personalization
With Descriptive Flexfield Field(DFF) segments however, things become a little more complicated since DFF segments cannot be modified through Form Personalization. Metalink Notes#1289789.1 and 735423.1 explain why it is not possible to alter DFF segments through Form Personalization.
So, coming back to the original question- how do we make a DFF segment read-only? Well, there are three ways:
Through CUSTOM.pll using the FND_DESCR_FLEX.UPDATE_DEFINITION() API. This method will enable or disable the entire DFF and not individual segments.
By populating the Value Set of the DFF segment dynamically at run-time with a single value. This approach is based on the premise that if the Value Set of the DFF segment contains only one value then the segment effectively becomes a read-only segment. Here is how you do it:
  1. Create a custom table and register it with AOL. It should contain at least two columns- one for storing the segment value, one for storing the user_id.
  2. Use Form Personalization in the form containing the DFF to populate the table created in Step#1 with the value that you want the DFF segment to display and the user_id of the user accessing the form. You can do this from the WHEN-NEW-FORM-INSTANCE or any other suitable trigger and by using the FORMS_DDL builtin. The sequence of commands in the builtin should be:   delete from custom table any existing records created by the current user – insert value into custom table along with the current user’s user_id – commit.
  3. Create a table validated Value Set based on the custom table and add ‘column_name= :$PROFILES$.USER_ID’ (where column_name is the name of the column in your custom table which stores the user_id) in the where clause to ensure that only the record created by the current user is returned.
  4. Attach the Value Set created in Step#4 with the read-only DFF segment.
We need to store the user_id and access the Value Set based on the correct user_id because in a production environment, the same Oracle Applications form might be accessed concurrently by multiple users leading to multiple records being inserted in the custom table. Since the success of this approach depends on a single value being returned, so we need to limit the values returned by the value_set using the user_id.

No comments:

Post a Comment