Solved

modify tax code in order line via event action

  • 19 August 2021
  • 1 reply
  • 247 views

Userlevel 3
Badge +7

Hi all,

under certain circumstances we want to update the tax code in customer order line. 

The trigger-event is the release (saving) of the order line (we use CustomerOrderLineHist to not receive any mutating error).

The code is as follows (I would say the code as such is fine : )) which I used in a similar way as well for several other updates of the order line:

For any reason the API CUSTOMER_ORDER_LINE_API.MODIFY_ does NOT update the tax code.

Any ideas why this might be a problem. Other columns in order line can be modified without any problem!

Thank you!

 

DECLARE

info_ VARCHAR2(4000); 
objid_ VARCHAR2(4000);
objversion_ VARCHAR2(4000);
attr_ VARCHAR2(4000);
order_no_ VARCHAR2(4000) :='&NEW:ORDER_NO';
line_no_ VARCHAR2(4000) :='&NEW:LINE_NO';
rel_no_ VARCHAR2(4000) :='&NEW:REL_NO';
line_item_no_ VARCHAR2(4000) :='&NEW:LINE_ITEM_NO';

del_country_ VARCHAR2(4000);
site_country_ VARCHAR2(4000);
supply_code_db_ VARCHAR2(4000);
sale_unit_price_ VARCHAR2(4000);
UNIT_PRICE_INCL_TAX_ VARCHAR2(4000);
BASE_SALE_UNIT_PRICE_ VARCHAR2(4000);
BASE_UNIT_PRICE_INCL_TAX_ VARCHAR2(4000);

CURSOR fetchobjid IS
select supply_code_db, sale_unit_price, UNIT_PRICE_INCL_TAX, BASE_SALE_UNIT_PRICE, BASE_UNIT_PRICE_INCL_TAX, objid, objversion 
from customer_order_line
where order_no = '&NEW:ORDER_NO'
and line_no = '&NEW:LINE_NO' 
and rel_no = '&NEW:REL_NO' 
and line_item_no = '&NEW:LINE_ITEM_NO'
and state <> 'Cancelled' and
catalog_type_db <> 'PKG';

CURSOR fetchdelcountry IS
select country_code from CUST_ORD_ADDRESS_2_UIV
where
order_no = '&NEW:ORDER_NO';

CURSOR fetchsitecountry IS
select country_db  from COMPANY_SITE
where contract = '&CONTRACT';


BEGIN

OPEN fetchobjid;
FETCH fetchobjid into supply_code_db_, sale_unit_price_, unit_price_incl_tax_, BASE_SALE_UNIT_PRICE_, BASE_UNIT_PRICE_INCL_TAX_, objid_, objversion_;
CLOSE fetchobjid;

OPEN fetchdelcountry;
FETCH fetchdelcountry INTO del_country_;
CLOSE fetchdelcountry;

OPEN fetchsitecountry;
FETCH fetchsitecountry INTO site_country_;
CLOSE fetchsitecountry;


IF  '&CONTRACT' = '101' and
supply_code_db_ = 'IPD' and
del_country_ <> site_country_

THEN

--error_sys.record_general('',':P1, :P2, :P3', '&CONTRACT', supply_code_db_, site_country_);

Client_SYS.Clear_Attr(attr_);
Client_SYS.Add_To_Attr('SALE_UNIT_PRICE',sale_unit_price_, attr_);
Client_SYS.Add_To_Attr('UNIT_PRICE_INCL_TAX',UNIT_PRICE_INCL_TAX_, attr_);
Client_SYS.Add_To_Attr('BASE_SALE_UNIT_PRICE',BASE_SALE_UNIT_PRICE_, attr_);
Client_SYS.Add_To_Attr('BASE_UNIT_PRICE_INCL_TAX',BASE_UNIT_PRICE_INCL_TAX_, attr_);
Client_SYS.Add_To_Attr('TAX_CODE','1000AA', attr_);
Client_SYS.Add_To_Attr('SET_TAX_FROM_ORIGINAL','FALSE', attr_);
Client_SYS.Add_To_Attr('FETCH_TAX_FROM_DEFAULTS','FALSE', attr_);
Client_SYS.Add_To_Attr('MULTIPLE_TAX_LINES','FALSE', attr_);
Client_SYS.Add_To_Attr('TAX_CLASS_ID','', attr_);

IFSAPP.CUSTOMER_ORDER_LINE_API.MODIFY__(info_,objid_,objversion_, attr_,'DO');


END IF;
END;

 

icon

Best answer by Janandi Vishaka 19 August 2021, 09:24

View original

This topic has been closed for comments

1 reply

Userlevel 5
Badge +8

Hi,

I assume that only tax code is not updated, and other fields are updated right? When the modify method executes sometimes the logic and validations could be changing back the tax_code to the same value as in the customer order line. So, you will see as it is not updated but actually during the execution logic it ignore the value we pass and assign a value based on the code. I would suggest you debug the method with the parameters add some break points and see if that happens.

Best Regards,

Vishaka