Loading

Wednesday, March 31, 2010

How to get the Description of the Item based on Item catalog group using API (invicgds.inv_get_icg_desc)

Description of the Item based on Item catalog group can be got by using the below API

              invicgds.inv_get_icg_desc
                                  (inv_item_id,
                                   first_elem_break,
                                   use_name_as_first_elem,
                                   description_for_item,
                                   Delimiter,
                                   show_all_delim,
                                   ERROR_TEXT
                                  );

• API accept Inventory item id as the input.
• Based on the inventory item id, it gets the new description from the Item catalog group Screen.
• If any delimiter is specified, API uses the delimiter in the description definition. Else by default it take dot (‘.’) delimiter to get the description.
• If any error is encounter during the call of the API, the information will be available in ERROR_TEXT.

Below script can be used for getting the description

DECLARE
IS

 V_item_id               NUMBER         : = 0;
 v_icg_description       VARCHAR2 (1000) := NULL;
 v_organization_id       NUMBER         := 0;
 v_error_msg             VARCHAR2(1000) := NULL;

BEGIN

   --Getting the Organization id
   BEGIN
      SELECT Organization_id
      INTO   v_organization_id
      FROM   mtl_parameters mp
      WHERE  mp.organization_code = 'V1';
   EXCEPTION
      WHEN OTHERS THEN
         fnd_file.put_line (fnd_file.LOG,'Error in getting the Organization id for Organization code V1 and error is '||SUBSTR (SQLERRM, 1,200));
   END;

   --Getting the item id for the existing item ABCTEST
   BEGIN
      SELECT inventory_item_id
      INTO   v_item_id
      FROM   mtl_system_items_b msi
      WHERE  msi.segment1 = 'ABCTEST'
      AND    msi.organization_id = v_organization_id;
   EXCEPTION
      WHEN OTHERS THEN
         fnd_file.put_line (fnd_file.LOG,'Error in getting the item id for Item ABCTEST and error is '||SUBSTR (SQLERRM, 1,200));
   END;
   
   BEGIN 
       invicgds.inv_get_icg_desc
       (inv_item_id                 => v_item_id,
        first_elem_break            => 30,
        use_name_as_first_elem      => 'N',
        description_for_item        => v_icg_description,
        delimiter                   => NULL,
        show_all_delim              => 'Y',
        ERROR_TEXT                  => v_error_msg
       );
      fnd_file.put_line (fnd_file.LOG,'Description of the item based on Catalog group:'||v_icg_description);
   EXCEPTION
          WHEN OTHERS THEN
             fnd_file.put_line (fnd_file.LOG, 'Error in calling the api and error is '||SUBSTR (SQLERRM, 1,200));
   END;
END;

0 Responses to “How to get the Description of the Item based on Item catalog group using API (invicgds.inv_get_icg_desc)”

Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.