Monday, March 30, 2015

Logic for BOM Implosion using bompimpl.imploder_userexit API

DECLARE
   i                             INTEGER;
   l_next_seq_num                NUMBER;
   l_err_msg                     VARCHAR2 (2000);
   l_err_code                    VARCHAR2 (2000);
   l_rev_date                    VARCHAR2 (30)
                                    := TO_CHAR (SYSDATE + 1
                                              , 'YYYY/MM/DD HH24:MI:SS');

   TYPE item_id_tbl_typ IS VARRAY (2) OF NUMBER;

   item_id_tbl                   item_id_tbl_typ;
BEGIN
   item_id_tbl         := item_id_tbl_typ (405199, 405214);

   BEGIN
      DELETE FROM xx_bom_implosion_temp_stg;
   EXCEPTION
      WHEN OTHERS
      THEN
         NULL;
   END;

   DELETE FROM bom_implosion_temp;

   FOR i IN 1 .. item_id_tbl.COUNT
   LOOP
      l_next_seq_num       := bom_implosion_temp_s.NEXTVAL;


      bompimpl.imploder_userexit (
         sequence_id                     => l_next_seq_num
       , eng_mfg_flag                    => 1
       , org_id                          => 103
       , impl_flag                       => 1
       , display_option                  => 1
       , levels_to_implode               => 59
       , item_id                         => item_id_tbl ( i)
       , impl_date                       => l_rev_date
       , err_msg                         => l_err_msg
       , err_code                        => l_err_code);

      INSERT INTO xx_bom_implosion_temp_stg
         SELECT * FROM bom_implosion_temp;

      COMMIT;
   END LOOP;
END;

1 comment:

  1. This is great, How do we pass the parameter to consider ALL Organizations.

    Thanks,
    Neeraj,

    ReplyDelete

Note: Only a member of this blog may post a comment.