Monday, February 24, 2014

How to progrmmatically create FND flex values for a Flex Value Set using FND_FLEX_VAL_API



-- Following is the sample code to programmatically create Flex value for a particular Value set
--API Name: fnd_flex_val_api.create_independent_vset_value
-- Parameters:
--       p_user_id -- FND User_Id
--       p_resp_id -- Responsibility Id
--       p_resp_appl_id -- Responsibility Application Id
--       p_flex_value_set_name -- FND Flex Value Set Name
--       p_flex_value -- FND Flex Value
--       p_flex_value_desc -- FND Flex Value Description

DECLARE
   x_str_value          VARCHAR2 (2000);
   lv_message           VARCHAR2 (2000);
   lv_user_id           NUMBER := &p_user_id;
   lv_resp_id           NUMBER := &p_resp_id;
   lv_resp_appl_id      NUMBER := &p_resp_appl_id;
   lv_flex_vs_name      VARCHAR2 (60) := '&p_flex_value_set_name';
   lv_flex_value        VARCHAR2 (60) := '&p_flex_value';
   lv_flex_value_desc   VARCHAR2 (60) := '&p_flex_value_desc';
BEGIN
   --Initialize required if this block is run from within Oracle database
   fnd_global.apps_initialize (user_id        => lv_user_id,
                               resp_id        => lv_resp_id,
                               resp_appl_id   => lv_resp_appl_id);

   fnd_flex_val_api.create_independent_vset_value (
      p_flex_value_set_name   => lv_flex_vs_name,
      p_flex_value            => lv_flex_value,
      p_description           => lv_flex_value_desc,
      p_enabled_flag          => 'Y',
      x_storage_value         => x_str_value);
   DBMS_OUTPUT.put_line (x_str_value);
EXCEPTION
   WHEN OTHERS
   THEN
      v_message := fnd_flex_val_api.MESSAGE;
      DBMS_OUTPUT.put_line (lv_message);
END;

No comments:

Post a Comment