Monday, 8 April 2024

API to Populate India GST Tax lines in Oracle APPS R12 Sales Order

 

Currently we have gone through a case where all sales order lines were not populated in India GST Tax form. To resolve this issue i.e. to populate remaining lines in India-GST-Tax form, we had to run below script:

DECLARE
    l_return_code     VARCHAR2(100);
    l_return_message  VARCHAR2(2000);
    l_event_class_rec zx_api_pub.event_class_rec_type;
    l_lines           oe_order_lines_all%ROWTYPE;
BEGIN
    fnd_global.Apps_initialize(fnd_global.user_id, 50278, 660);

    FOR c1 IN (SELECT *
               FROM   oe_order_lines_all A
               WHERE  header_id = 9348683
                      AND NOT EXISTS (SELECT 1
                                      FROM   jai_tax_det_factors X
                                      WHERE  X.trx_id = A.header_id
                                             AND X.trx_line_id = A.line_id
                                             AND X.application_id = 660)) LOOP
        l_event_class_rec.application_id := 660;

        l_event_class_rec.event_class_code := 'SALES_TRANSACTION_TAX_QUOTE';

        l_event_class_rec.event_type_code := 'CREATE';

        l_event_class_rec.entity_code := 'OE_ORDER_HEADERS';

        l_event_class_rec.trx_id := c1.header_id;

        l_event_class_rec.trx_date := SYSDATE;

        l_event_class_rec.tax_event_class_code := 'SALES_TRANSACTION';

        l_event_class_rec.tax_event_type_code := 'CREATE';

        l_event_class_rec.internal_organization_id := 105;

        -- l_event_class_rec.TAX_INVOICE_DATE :=SYSDATE;
        --l_event_class_rec.LINE_LEVEL_ACTION :='CREATE';
        l_event_class_rec.legal_entity_id := 101;

        l_event_class_rec.ledger_id := 1001;

        jai_om_tax_det_pkg.Determine_factors 

        (p_action_code => 'CREATE',
         p_line_id => c1.line_id, 
         p_event_class_rec => l_event_class_rec,
         x_return_code => l_return_code, 
         x_return_message => l_return_message,
         p_call_from => 'API');

        fnd_file.Put_line(fnd_file.log, l_return_code||'-'||l_return_message);
    END LOOP;

    COMMIT;
END; 

No comments:

Post a Comment