For setting a Profile Option Value from back end we need the Following three parameters;
- Name of Profile Option
- Value for the profile option which we want to set.
- 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'
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;
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;
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;
hi,
ReplyDeleteI found PO price mismatch with invoice price , how is it possible