Wednesday, 21 August 2019

India GST Tax Category Rule Override API in Oracle APPS R12

Use below API to re-populate tax lines in India Localization Form:

CREATE OR REPLACE PROCEDURE XX_APPLY_TAX_CAT_PRC (p_det_factor_id NUMBER, 
                                                  p_tax_cat_id    NUMBER) 
AS 
  lv_process_status VARCHAR2(2000); 
BEGIN 
    FOR c1 IN (SELECT * 
               FROM   jai_tax_det_factors 
               WHERE  det_factor_id = p_det_factor_id) LOOP 

        fnd_global.Apps_initialize(<p_user_id>, <p_resp_id>, <p_resp_appl_id>); 

        mo_global.Set_policy_context('S', <l_org_id>); 
                /* This procedure MO_GLOBAL.SET_POLICY_CONTEXT(p_access_mode,p_org_id) has two parameters 
        p_access_mode : Pass a value "S" in case you want your current session to work against Single ORG_ID
        Pass a value of "M" in case you want your current session to work against multiple ORG_ID's
        p_org_id : Only applicable if p_access_mode is passed value of "S"*/
 

        jai_tax_determination_pkg.Override_tax_category_rule ( 
        pn_tax_rule_id => c1.tax_rule_id, pn_tax_category_id => p_tax_cat_id, 
        pn_det_factor_id => p_det_factor_id, 
        pv_process_status => lv_process_status, 
        pv_process_message => lv_process_status); 
    END LOOP; 

    COMMIT; 
END; 

(OR)

CREATE OR replace PROCEDURE apps.xx_apply_taxes_api(p_trx_id         NUMBER,
                                                       p_application_id NUMBER,
                                                       p_tax_cat_id     NUMBER)
AS
  lv_process_status  VARCHAR2(2000);
  lv_process_message VARCHAR2(2000);
BEGIN
    FOR c1 IN (SELECT *
               FROM   jai_tax_det_factors a
               WHERE  a.trx_id = p_trx_id
                      --AND DET_FACTOR_ID=27695004
                      AND a.application_id = p_application_id
                      AND NOT EXISTS (SELECT 1
                                      FROM   jai_tax_lines X
                                      WHERE  X.det_factor_id = a.det_factor_id))
    LOOP
        jai_tax_determination_pkg.Override_tax_category_rule(
        pn_tax_rule_id => c1.tax_rule_id, pn_tax_category_id => p_tax_cat_id,
        pn_det_factor_id => c1.det_factor_id,
        pv_process_status => lv_process_status
        ,
        pv_process_message => lv_process_message);
    END LOOP;

    COMMIT;
END;


BEGIN
    xx_apply_taxes_api(12589619, 707, 11097);
END; 

2 comments:

  1. Thanks, do we have an API to create new tax for a PO receipt line

    ReplyDelete
  2. Abhishek, FYI, I override the taxes using this API but the accounting generated with previous tax rates. So I don't think this API is working as expected.

    Any comments there.

    ReplyDelete