Thursday, October 11, 2012

To Set / Change Profile Option Value from Backend

For setting a Profile Option Value from back end we need the Following three parameters;
  1. Name of Profile Option
  2. Value for the profile option which we want to set.
  3. And the level at which we want to set the profile option value.
To get the name of profile option we can use the table  table fnd_profile_options_tl which stores the all the profile option details. 
For example if we want to set the values of the profile option "MO: Operating Unit" then we can find out the name of this profile option using the following Query:
SELECT profile_option_name
  FROM fnd_profile_options_tl
 WHERE user_profile_option_name = '
MO: Operating Unit'
Result:
ORG_ID
Now to find out the organization id for a specific Org we can use the following Query:

SELECT organization_id, NAME
  FROM hr_all_organization_units;

Finally using the Profile Option Name, Organization Id and the Level at which we have to set the profile option value we can change the profile option using the following code: 



DECLARE
   stat   BOOLEAN;
BEGIN
   DBMS_OUTPUT.DISABLE;
   DBMS_OUTPUT.ENABLE (100000);
   stat := fnd_profile.SAVE ('ORG_ID', 204, 'SITE');
   IF stat
   THEN
      DBMS_OUTPUT.put_line ('Stat = TRUE - profile updated');
   ELSE
      DBMS_OUTPUT.put_line ('Stat = FALSE - profile NOT updated');
   END IF;
   COMMIT;
END;

1 comment:

  1. hi,

    I found PO price mismatch with invoice price , how is it possible

    ReplyDelete