Solved

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

  • 17 May 2021
  • 4 replies
  • 608 views

Userlevel 5
Badge +11

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.

icon

Best answer by dhlelk 17 May 2021, 20:51

View original

This topic has been closed for comments

4 replies

Userlevel 7
Badge +30

Hi @baris.halici,
I hope you have referred the following KBAs;
 

 

Userlevel 5
Badge +11

Hi @Yasas Kasthuriarachchi ,

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

Userlevel 6
Badge +15

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.

Userlevel 5
Badge +11

Hi @Yasas Kasthuriarachchi,

 

Thanks for answers. This was very useful.