Making a DFF read only through custom.pll

We can make a DFF read only through Custom.pll by using a seeded procedure ‘FND_DESCR_FLEX.UPDATE_DEFINITION’.

Here is the syntax of the procedure:

FND_DESCR_FLEX.UPDATE_DEFINITION(
  /* Arguments that specify the flexfield location */
    BLOCK=>'block_name',
    FIELD=>'field_name',
  /* Argument to enable or disable flexfield */
    [ENABLED=>'{Y|N}',]
  /* Other optional parameters  */
    [VDATE=>'date',]
    [TITLE =>'Title',]
    [AUTOPICK=>'{Y|N}',]
    [USEDBFLDS=>'{Y|N}',]
    [READ_ONLY=>'{Y|N}',]
    [LOCK_FLAG=>'{Y|N}',]
    [HELP=>'APPL=application_short_name;
            TARGET=target_name',]
    [CONTEXT_LIKE=>'WHERE_clause_fragment'}
     );

Example to make ‘Items’ DFF as read only:

IF (event_name = 'WHEN-NEW-BLOCK-INSTANCE' AND form_name = 'INVIDITM') THEN
  IF (fnd_profile.value('RESP_NAME') = 'Inventory') THEN
    fnd_descr_flex.update_definition( 
			block	   => 'MTL_SYSTEM_ITEMS', 
			FIELD	   => 'DF_MIR', 
			enabled	   => 'N', 
			read_only  => 'Y' 
				);
  END IF;
END IF;

the procedure disables all the DFF segments as a whole, because the a Flexfield is a single field in a Form but then when you click into it and it opens up the flexfields window, the multiple fields you see is actually a user exit with multi segment values, not form fields. Hence no events are triggered on flexfield windows (user exits). No Form Personalization events are passed to segments inside the flexfield window (user exit).

If you want to know how to make individual segments of a DFF as read only then read this post “Making a DFF Segment read only through ‘Special’ type of Value Set