Skip to main content
Solved

"Override" and "Overtake" For the Same Method on Dev Studio


baris.halici
Hero (Customer)
Forum|alt.badge.img+12

Hi,

I want to use both "Overtake" and "Override" for a "procedure" or "function". 

I tried many methods but, after deploy it considers the last operation valid.

Kind Regards.

Best answer by dhlelk

Hi @baris.halici,

 

To the best of my knowledge, we can only either overtake or override a given source file in one layer.

Ideally, you should get an exception as follows when you try to generate the code,
   Exception while generating code for ShopOrd-Cust.entity
   Overloaded method Post_Insert___ has the same method signature in file.

 

However if you really want to accomplish this behavior, you can use the following approach,
1. Prepend the pre-processing code to the first code line in the method.
2. Do your overtakes or surgical overtakes as required.
3. Append the post-processing code to the last code line in the method.

@Overtake Core
PROCEDURE Post_Insert___ (
   objid_ IN            VARCHAR2,
   attr_  IN OUT NOCOPY VARCHAR2 )
IS
   $PREPEND
   --Add your comments here
   $SEARCH
   info_                 VARCHAR2(32000);
   $END
BEGIN
   $PREPEND
   -- 1. Prepend the pre-processing code to the first code line in the method.
   Dbms_Output.Put_Line('Add pre-processing code here');
   $SEARCH
   shop_ord_rec_  := Get_Object_By_Id___(objid_);
   $END

   $SEARCH
   part_attr_rec_ := Manuf_Part_Attribute_API.Get(shop_ord_rec_.contract, shop_ord_rec_.part_no);
   $REPLACE
   -- 2. Do your overtakes or surgical overtakes as required.
   part_attr_rec_ := Manuf_Part_Attribute_API.Get(shop_ord_rec_.contract, NVL(shop_ord_rec_.part_no, 'DHLELK'));
   $END

   $SEARCH
   IF  (shop_ord_rec_.rowstate = 'Released') THEN
      -- IF Shop Order is in state released, then so shall the operations.
      FOR oprec IN get_op LOOP
         Shop_Order_Operation_API.Modify_Oper_Status_Code_Db(shop_ord_rec_.order_no, shop_ord_rec_.release_no, shop_ord_rec_.sequence_no, oprec.operation_no, Oper_Status_Code_API.DB_RELEASED);

         -- Create Purchase Requisition for Outside_operation
         IF (Work_Center_API.Get_Work_Center_Code_Db(oprec.contract, oprec.work_center_no) = outside_wc_db_) THEN
            Shop_Order_Operation_List_API.Create_Outside_Op_Req (
               shop_ord_rec_.order_no, shop_ord_rec_.release_no,
               shop_ord_rec_.sequence_no, oprec.operation_no,
               oprec.revised_qty_due, oprec.outside_op_item,  oprec.outside_op_supply_type);
         END IF;
      END LOOP;
   END IF;
   $APPEND
   -- 3. Append the post-processing code to the last code line in the method.
   Dbms_Output.Put_Line('Add post-processing code here');
   $END
END Post_Insert___;


Cheers !
Dhananjaya.

View original
This topic has been closed for replies.

4 replies

Yasas Kasthuriarachchi
Superhero (Employee)
Forum|alt.badge.img+30

baris.halici
Hero (Customer)
Forum|alt.badge.img+12
  • Author
  • Hero (Customer)
  • 127 replies
  • May 17, 2021

Hi @Yasas Kasthuriarachchi ,

Thanks for the answer. Yes, I studied but did not understand.


dhlelk
Superhero
Forum|alt.badge.img+15
  • Superhero
  • 200 replies
  • Answer
  • May 17, 2021

Hi @baris.halici,

 

To the best of my knowledge, we can only either overtake or override a given source file in one layer.

Ideally, you should get an exception as follows when you try to generate the code,
   Exception while generating code for ShopOrd-Cust.entity
   Overloaded method Post_Insert___ has the same method signature in file.

 

However if you really want to accomplish this behavior, you can use the following approach,
1. Prepend the pre-processing code to the first code line in the method.
2. Do your overtakes or surgical overtakes as required.
3. Append the post-processing code to the last code line in the method.

@Overtake Core
PROCEDURE Post_Insert___ (
   objid_ IN            VARCHAR2,
   attr_  IN OUT NOCOPY VARCHAR2 )
IS
   $PREPEND
   --Add your comments here
   $SEARCH
   info_                 VARCHAR2(32000);
   $END
BEGIN
   $PREPEND
   -- 1. Prepend the pre-processing code to the first code line in the method.
   Dbms_Output.Put_Line('Add pre-processing code here');
   $SEARCH
   shop_ord_rec_  := Get_Object_By_Id___(objid_);
   $END

   $SEARCH
   part_attr_rec_ := Manuf_Part_Attribute_API.Get(shop_ord_rec_.contract, shop_ord_rec_.part_no);
   $REPLACE
   -- 2. Do your overtakes or surgical overtakes as required.
   part_attr_rec_ := Manuf_Part_Attribute_API.Get(shop_ord_rec_.contract, NVL(shop_ord_rec_.part_no, 'DHLELK'));
   $END

   $SEARCH
   IF  (shop_ord_rec_.rowstate = 'Released') THEN
      -- IF Shop Order is in state released, then so shall the operations.
      FOR oprec IN get_op LOOP
         Shop_Order_Operation_API.Modify_Oper_Status_Code_Db(shop_ord_rec_.order_no, shop_ord_rec_.release_no, shop_ord_rec_.sequence_no, oprec.operation_no, Oper_Status_Code_API.DB_RELEASED);

         -- Create Purchase Requisition for Outside_operation
         IF (Work_Center_API.Get_Work_Center_Code_Db(oprec.contract, oprec.work_center_no) = outside_wc_db_) THEN
            Shop_Order_Operation_List_API.Create_Outside_Op_Req (
               shop_ord_rec_.order_no, shop_ord_rec_.release_no,
               shop_ord_rec_.sequence_no, oprec.operation_no,
               oprec.revised_qty_due, oprec.outside_op_item,  oprec.outside_op_supply_type);
         END IF;
      END LOOP;
   END IF;
   $APPEND
   -- 3. Append the post-processing code to the last code line in the method.
   Dbms_Output.Put_Line('Add post-processing code here');
   $END
END Post_Insert___;


Cheers !
Dhananjaya.


baris.halici
Hero (Customer)
Forum|alt.badge.img+12
  • Author
  • Hero (Customer)
  • 127 replies
  • May 18, 2021

Hi @Yasas Kasthuriarachchi,

 

Thanks for answers. This was very useful.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings