Search This Blog

Thursday, October 27, 2022

Customize PO Approval workflow to add NonRecoverable Tax in the Approver Notification Message

Requirement: 

User Enter the PO All Details and submit for Approval.

Actions --> Manage --> can view the NonRecoverable Tax, Recoverable Tax.

PO Approval workflow to add NonRecoverable Tax in the Approver Notification Message

  1. New Attribute 

XXRECOVERABLE_TAX


  1. Open Process








  1. Under Message add your new attribute value

Recoverable Tax : &XXRECOVERABLE_TAX






  1. New Function (XX_PONOTIF_TO_SUPPLIER)

Function Name; XX_PONOTIF_TO_SUPPLIER 🡪 this is the procedure in the database available at the end.











  1. Attach this function to the process.

/* Formatted on 10/27/2022 2:18:31 PM (QP5 v5.336) */

CREATE OR REPLACE PROCEDURE XX_PONOTIF_TO_SUPPLIER (

    p_item_type   IN            VARCHAR2,

    p_item_key    IN            VARCHAR2,

    p_actid       IN            NUMBER,

    p_funmode     IN            VARCHAR2,

    p_result         OUT NOCOPY VARCHAR2)

IS

    L_RECOVER_TAX        NUMBER;

    L_RECOVER_TAX_CHAR   VARCHAR2 (200);

BEGIN

    BEGIN

        SELECT SUM (POD.RECOVERABLE_TAX)

          INTO L_RECOVER_TAX

          /*nvl(sum( round (nvl(POD.RECOVERABLE_TAX,0) *

                                    decode(quantity_ordered,

                                           NULL,

                                           (nvl(POD.amount_ordered,0) - nvl(POD.amount_cancelled,0)) / nvl(POD.amount_ordered, 1),

                                           (nvl(POD.quantity_ordered,0) - nvl(POD.quantity_cancelled,0)) / nvl(POD.quantity_ordered, 1)

                                          ) / 5

                                    ) * 5

                           ),0)*/

          FROM po_distributions_all POD, PO_HEADERS_ALL POA, apps.wf_items wi

         WHERE     POD.po_header_id = POA.PO_HEADER_ID --POHdr_rec.po_header_id

               AND NVL (POD.distribution_type, 'STANDARD') NOT IN

                       ('PREPAYMENT')                              -- 11876122

               AND POD.line_location_id IS NOT NULL

               AND wi.item_type = 'POAPPRV'

               AND wi.item_key = p_item_key

               AND wi.user_key = POA.segment1;


        L_RECOVER_TAX_CHAR := TO_CHAR (NVL (L_RECOVER_TAX, 0));


        wf_engine.setitemattrtext (itemtype   => p_item_type,

                                   itemkey    => p_item_key,

                                   aname      => 'XXRECOVERABLE_TAX',

                                   avalue     => L_RECOVER_TAX_CHAR);

    EXCEPTION

        WHEN OTHERS

        THEN

            AP_WEB_UTILITIES_PKG.logProcedure ('ERROR IN XXRECOVERABLE_TAX',

                                               'sqlerrm' || SQLERRM);

            wf_engine.setitemattrtext (itemtype   => p_item_type,

                                       itemkey    => p_item_key,

                                       aname      => 'XXRECOVERABLE_TAX',

                                       avalue     => '0');

    END;


    p_result := 'Y';

EXCEPTION

    WHEN OTHERS

    THEN

        p_result := 'N';

END;











Output:

Submit PO for Approval and check the Approver Notification. 

No comments:

Post a Comment