Skip to main content

Hello,

I’m running into an error trying to use an API method from the equipment object structure costs, and I’m wondering if this is a bug or if it’s intended functionality. If it’s intended functionality, would someone be able to explain why? Below is an example of the issue. For reference, we are running Apps 10 update 13.

 On equipment objects, there is a tab called cost/year. This shows summed costs that have been transacted against this object. On object V13201 below, the display shows a total cost for 2022 at $300.45. This is actually the sum of 4 different transactions so far, all with the cost type of Expenses.

 

However when I run the API method EQUIPMENT_STRUCTURE_COST_API.Get_Total_Cost_Year('V13201', '104', '2022'), I get a null result returned.

To confirm this API method works, I tested it on another object that has multiple cost types associated with it. The screenshot below shows V00042 has a total cost of $743.98 with $449.22 being cost type Expenses and $294.76 being cost type Personnel.

When I run the API method EQUIPMENT_STRUCTURE_COST_API.Get_Total_Cost_Year('V00042', '104', '2022'), I only get a total of $294.76. It appears to me that this API method for getting total cost is ignoring costs with the cost type of Expenses. It seems like a bug to me that this would be ignored because these are still true costs. I wanted to see if anyone else has run into this or might know why it is ignoring this cost type. 

Thanks,

Evan Edwards

Hi Evan,

I actually think this is a bug. I hade a look at the code and it seems like it’s looking for “External” twice, instead of External and Expenses. 

   CURSOR get_cost IS
SELECT sum(cost) cost
FROM equipment_structure_cost
WHERE mch_code = mch_code_
AND contract = contract_
AND equipment_obj_cost_type IN (Equipment_Obj_Cost_Type_API.DB_MATERIAL,
Equipment_Obj_Cost_Type_API.DB_PERSONNEL,
Equipment_Obj_Cost_Type_API.DB_TOOLS_FACILITIES,
Equipment_Obj_Cost_Type_API.DB_EXTERNAL,
Equipment_Obj_Cost_Type_API.DB_EXTERNAL)
AND to_char(cre_date, 'YYYY') = year_;

CURSOR get_tot_cost IS
SELECT sum(cost) cost
FROM equipment_structure_cost
WHERE mch_code = mch_code_
AND contract = contract_
AND equipment_obj_cost_type IN (Equipment_Obj_Cost_Type_API.DB_MATERIAL,
Equipment_Obj_Cost_Type_API.DB_PERSONNEL,
Equipment_Obj_Cost_Type_API.DB_TOOLS_FACILITIES,
Equipment_Obj_Cost_Type_API.DB_EXTERNAL,
Equipment_Obj_Cost_Type_API.DB_EXTERNAL,

Please report a bug for this.


Hi Evan,

I actually think this is a bug. I hade a look at the code and it seems like it’s looking for “External” twice, instead of External and Expenses. 

   CURSOR get_cost IS
SELECT sum(cost) cost
FROM equipment_structure_cost
WHERE mch_code = mch_code_
AND contract = contract_
AND equipment_obj_cost_type IN (Equipment_Obj_Cost_Type_API.DB_MATERIAL,
Equipment_Obj_Cost_Type_API.DB_PERSONNEL,
Equipment_Obj_Cost_Type_API.DB_TOOLS_FACILITIES,
Equipment_Obj_Cost_Type_API.DB_EXTERNAL,
Equipment_Obj_Cost_Type_API.DB_EXTERNAL)
AND to_char(cre_date, 'YYYY') = year_;

CURSOR get_tot_cost IS
SELECT sum(cost) cost
FROM equipment_structure_cost
WHERE mch_code = mch_code_
AND contract = contract_
AND equipment_obj_cost_type IN (Equipment_Obj_Cost_Type_API.DB_MATERIAL,
Equipment_Obj_Cost_Type_API.DB_PERSONNEL,
Equipment_Obj_Cost_Type_API.DB_TOOLS_FACILITIES,
Equipment_Obj_Cost_Type_API.DB_EXTERNAL,
Equipment_Obj_Cost_Type_API.DB_EXTERNAL,

Please report a bug for this.

Thank you for looking into this and confirming the bug suspicion. We will submit a bug report for this.


Reply