DECLARE
info_ varchar2(32000) := null;
objid_ varchar2(2000) := null;
objversion_ varchar2(2000) := null;
action_ varchar2(20) := 'DO';
attr_ varchar2(2000);
order_no_ varchar2(25);
company_ varchar2(200);
contract_ varchar2(50);
charge_type_ ifsapp.CUSTOMER_ORDER_CHARGE_TAB.charge_type%TYPE;
PRAGMA AUTONOMOUS_TRANSACTION;
cursor c1_ IS select ifsapp.site_api.get_company(contract) company, contract, order_no FROM ifsapp.customer_order_tab where contract = ‘&NEW:CONTRACT’ and order_no = '&NEW:ORDER_NO';
BEGIN
OPEN c1_;
LOOP
FETCH c1_ INTO company_, contract_, order_no_ ;
EXIT WHEN c1_%NOTFOUND;
ifsapp.Client_Sys.Clear_Attr(attr_);
ifsapp.Client_Sys.Add_To_Attr('CHARGE_TYPE', 'FREIGHT', attr_);
ifsapp.Client_Sys.Add_To_Attr('CHARGE_AMOUNT', '0', attr_);
ifsapp.Client_Sys.Add_To_Attr('CHARGED_QTY', '1', attr_);
ifsapp.Client_Sys.Add_To_Attr('SALES_UNIT_MEAS', 'EA', attr_);
ifsapp.Client_Sys.Add_To_Attr('BASE_CHARGE_AMOUNT', '0', attr_);
ifsapp.Client_Sys.Add_To_Attr('STATISTICAL_CHARGE_DIFF', '0', attr_);
ifsapp.Client_Sys.Add_To_Attr('COLLECT_DB','INVOICE', attr_);
ifsapp.Client_Sys.Add_To_Attr('TAX_CODE','0', attr_);
ifsapp.Client_Sys.Add_To_Attr('TAX_CALC_STRUCTURE_ID','', attr_);
ifsapp.Client_Sys.Add_To_Attr('CUSTOMER_TAX_USAGE_TYPE','',attr_);
ifsapp.Client_Sys.Add_To_Attr('DELIVERY_TYPE','GOODS', attr_);
ifsapp.Client_Sys.Add_To_Attr('CHARGE_COST','0', attr_);
ifsapp.Client_Sys.Add_To_Attr('INVOICED_QTY', '0', attr_);
ifsapp.Client_Sys.Add_To_Attr('PRINT_CHARGE_TYPE_DB','Y', attr_);
ifsapp.Client_Sys.Add_To_Attr('PRINT_COLLECT_CHARGE_DB','NO PRINT',attr_);
ifsapp.Client_Sys.Add_To_Attr('INTRASTAT_EXEMPT_DB','FALSE',attr_);
ifsapp.Client_Sys.Add_To_Attr('UNIT_CHARGE_DB','FALSE',attr_);
ifsapp.Client_Sys.Add_To_Attr('ORDER_NO', order_no_, attr_);
ifsapp.Client_Sys.Add_To_Attr('CONTRACT', contract_, attr_);
ifsapp.Client_SYS.Add_To_Attr('COMPANY', company_, attr_);
ifsapp.Client_SYS.Add_To_Attr('CURRENCY_RATE', '1', attr_);
ifsapp.Client_SYS.Add_To_Attr('FETCH_TAX_CODES', 'TRUE', attr_);
ifsapp.Client_SYS.Add_To_Attr('SET_TAX_FROM_ORIGINAL', 'FALSE', attr_);
ifsapp.Client_SYS.Add_To_Attr('MULTIPLE_LINES', 'FALSE', attr_);
-- dbms_output.put_line('Attr: ' || attr_);
ifsapp.customer_order_charge_api.NEW__(info_,objid_, objversion_, attr_, action_);
END LOOP;
END;
Running in PL/SQL appears to work fine after amending the filter to contract and order_no
Checked the Customer_Order_Charge_tab and the record is added.
On creating custom event to trigger on a new record to the CUSTOMER_ORDER_TAB.
Although no errors were received no record is being created on the Charges tab.
Would this be better as a deferred job?
Thank you.