Tuesday, 11 August 2020

SQL to find PO,PR and their Delivery details

 


select   po.segment1 po_num,

         po.creation_date po_date,

         po.approved_date,

         decode (po.segment1,

                 null, '',

                 nvl (po.authorization_status, 'INCOMPLETE'))

            po_status,

         poven.vendor_name,

         pol.line_num po_line_num,

         xxmb_get_item_code (pol.item_id, poloc.ship_to_organization_id)

            po_productid,

         pol.item_description po_item_description,

         podis.quantity_ordered po_quantity_ordered,

         pol.unit_price po_unit_price,

         (pol.unit_price * podis.quantity_ordered) po_amt,

         po.currency_code po_currency_code,

         podis.rate po_rate,

         decode (po.currency_code,

                 'USD', pol.unit_price * podis.quantity_ordered,

                 pol.unit_price * podis.rate * podis.quantity_ordered)

            po_amt_usd,

         poloc.quantity_received qty_rec,

         poloc.quantity_billed qty_billed,

         poloc.need_by_date,

         poloc.promised_date,

         (select   max (transaction_date)

            from   rcv_transactions

           where   transaction_type = 'RECEIVE'

                   and po_distribution_id = podis.po_distribution_id)

            receiving_date,

         (poloc.promised_date

          - (select   max (transaction_date)

               from   rcv_transactions

              where   transaction_type = 'RECEIVE'

                      and po_distribution_id = podis.po_distribution_id))

            promised_to_rec_days,

         (select   max (transaction_date)

            from   rcv_transactions

           where   transaction_type = 'DELIVER'

                   and po_distribution_id = podis.po_distribution_id)

            deliver_date,

         buyer.full_name buyer_name,

         (select   full_name

            from   per_all_people_f rec_per

           where   1 = 1

                   and rec_per.person_id =

                         (select   employee_id

                            from   rcv_transactions

                           where   transaction_type = 'RECEIVE'

                                   and po_distribution_id =

                                         podis.po_distribution_id

                                   and rownum = 1)

                   and sysdate between rec_per.effective_start_date

                                   and  rec_per.effective_end_date

                   and rownum = 1)

            receiver_name,

         pol.closed_code po_closed_status,

         req_details.requisition_num,

         decode (

            gcc.segment4,

            null,

            '',

            substr (

               apps.gl_flexfields_pkg.get_description_sql (

                  gcc.chart_of_accounts_id,

                  4,

                  gcc.segment4

               ),

               1,

               40

            )

         )

            segment4_desc,

         decode (

            gcc.segment5,

            null,

            '',

            substr (

               apps.gl_flexfields_pkg.get_description_sql (

                  gcc.chart_of_accounts_id,

                  5,

                  gcc.segment5

               ),

               1,

               40

            )

         )

            segment5_desc,

         req_details.requestor

  from   po_headers_all po,

         po_vendors poven,

         po_lines_all pol,

         po_line_locations_all poloc,

         po_distributions_all podis,

         gl_code_combinations gcc,

         (select   *

            from   per_all_people_f

           where   sysdate between effective_start_date

                               and  effective_end_date) buyer,

         (select   porh.segment1 requisition_num,

                   requestor.full_name requestor,

                   pord.distribution_id

            from   po_requisition_headers_all porh,

                   po_requisition_lines_all porl,

                   po_req_distributions_all pord,

                   (select   *

                      from   per_all_people_f

                     where   sysdate between effective_start_date

                                         and  effective_end_date) requestor

           where   porh.requisition_header_id = porl.requisition_header_id

                   and porl.requisition_line_id = pord.requisition_line_id

                   and requestor.person_id(+) = to_person_id) req_details

 where       po.po_header_id = pol.po_header_id

         and po.po_header_id = poloc.po_header_id

         and poven.vendor_id = po.vendor_id

         and po.po_header_id = podis.po_header_id

         and pol.po_line_id = poloc.po_line_id

         and pol.po_line_id = podis.po_line_id

         and buyer.person_id = po.agent_id

         and gcc.code_combination_id = podis.code_combination_id

         and req_details.distribution_id(+) = podis.req_distribution_id

Requisition to PO details Query

SELECT   PORH.SEGMENT1 REQUISITION_NUM,

         PORH.CREATION_DATE REQUISITION_DATE,

         PORH.APPROVED_DATE REQUISITION_APPROVED_DATE,

         DECODE (PORH.SEGMENT1,

                 NULL, '',

                 NVL (PORH.AUTHORIZATION_STATUS, 'INCOMPLETE'))

            REQUISITION_STATUS,

         PORL.LINE_NUM REQUISITION_LINE_NUM,

         XXMB_GET_ITEM_CODE (PORL.ITEM_ID, PORL.ORG_ID) REQUISITION_PRODUCTID,

         PORL.ITEM_DESCRIPTION REQUISITION_ITEM_DESCRIPTION,

         PORD.REQ_LINE_QUANTITY REQUISITION_QUANTITY_ORDERED,

         PORL.UNIT_PRICE REQUISITION_UNIT_PRICE,

         (PORL.UNIT_PRICE * PORD.REQ_LINE_QUANTITY) REQUISITION_AMOUNT,

         PORL.CURRENCY_CODE REQUISITION_CURRENCY_CODE,

         PORL.RATE REQUISITION_RATE,

         DECODE (PORL.CURRENCY_CODE,

                 'USD', PORL.UNIT_PRICE * PORD.REQ_LINE_QUANTITY,

                 PORL.UNIT_PRICE * PORL.RATE * PORD.REQ_LINE_QUANTITY)

            REQ_AMT_USD,

         PORL.NEED_BY_DATE,

         DECODE (

            GCC.SEGMENT4,

            NULL,

            '',

            SUBSTR (

               APPS.GL_FLEXFIELDS_PKG.GET_DESCRIPTION_SQL (

                  GCC.CHART_OF_ACCOUNTS_ID,

                  4,

                  GCC.SEGMENT4

               ),

               1,

               40

            )

         )

            SEGMENT4_DESC,

         DECODE (

            GCC.SEGMENT5,

            NULL,

            '',

            SUBSTR (

               APPS.GL_FLEXFIELDS_PKG.GET_DESCRIPTION_SQL (

                  GCC.CHART_OF_ACCOUNTS_ID,

                  5,

                  GCC.SEGMENT5

               ),

               1,

               40

            )

         )

            SEGMENT5_DESC,

         REQUESTOR.FULL_NAME REQUESTOR,

         PO_DETAILS.PO_NUM,

         PO_DETAILS.PO_DATE,

         PO_DETAILS.APPROVED_DATE,

         PO_DETAILS.PO_STATUS,

         PO_DETAILS.VENDOR_NAME,

         PO_DETAILS.PO_LINE_NUM,

         PO_DETAILS.PO_PRODUCTID,

         PO_DETAILS.PO_ITEM_DESCRIPTION,

         PO_DETAILS.PO_QUANTITY_ORDERED,

         PO_DETAILS.PO_UNIT_PRICE,

         PO_DETAILS.PO_AMT,

         PO_DETAILS.PO_CURRENCY_CODE,

         PO_DETAILS.PO_RATE,

         PO_DETAILS.PO_AMT_USD,

         PO_DETAILS.BUYER_NAME,

         PO_DETAILS.PROMISED_DATE,

         PO_DETAILS.PO_CLOSED_STATUS,

         (PO_DETAILS.APPROVED_DATE - PORH.APPROVED_DATE) PR_TO_PO_DAYS

  FROM   PO_REQUISITION_HEADERS_ALL PORH,

         PO_REQUISITION_LINES_ALL PORL,

         PO_REQ_DISTRIBUTIONS_ALL PORD,

         GL_CODE_COMBINATIONS GCC,

         (SELECT   *

            FROM   PER_ALL_PEOPLE_F

           WHERE   SYSDATE BETWEEN EFFECTIVE_START_DATE

                               AND  EFFECTIVE_END_DATE) REQUESTOR,

         (SELECT   PO.SEGMENT1 PO_NUM,

                   PO.CREATION_DATE PO_DATE,

                   PO.APPROVED_DATE,

                   DECODE (PO.SEGMENT1,

                           NULL, '',

                           NVL (PO.AUTHORIZATION_STATUS, 'INCOMPLETE'))

                      PO_STATUS,

                   POVEN.VENDOR_NAME,

                   POL.LINE_NUM PO_LINE_NUM,

                   XXMB_GET_ITEM_CODE (POL.ITEM_ID,

                                       POLOC.SHIP_TO_ORGANIZATION_ID)

                      PO_PRODUCTID,

                   POL.ITEM_DESCRIPTION PO_ITEM_DESCRIPTION,

                   PODIS.QUANTITY_ORDERED PO_QUANTITY_ORDERED,

                   POL.UNIT_PRICE PO_UNIT_PRICE,

                   (POL.UNIT_PRICE * PODIS.QUANTITY_ORDERED) PO_AMT,

                   PO.CURRENCY_CODE PO_CURRENCY_CODE,

                   PODIS.RATE PO_RATE,

                   DECODE (

                      PO.CURRENCY_CODE,

                      'USD',

                      POL.UNIT_PRICE * PODIS.QUANTITY_ORDERED,

                      POL.UNIT_PRICE * PODIS.RATE * PODIS.QUANTITY_ORDERED

                   )

                      PO_AMT_USD,

                   BUYER.FULL_NAME BUYER_NAME,

                     POLOC.PROMISED_DATE

                   - TRUNC (PO.CREATION_DATE)

                   + NVL (TRUNC (PO.APPROVED_DATE), SYSDATE)

                      PROMISED_DATE,

                   POL.CLOSED_CODE PO_CLOSED_STATUS,

                   PODIS.REQ_DISTRIBUTION_ID

            FROM   PO_HEADERS_ALL PO,

                   PO_VENDORS POVEN,

                   PO_LINES_ALL POL,

                   PO_LINE_LOCATIONS_ALL POLOC,

                   PO_DISTRIBUTIONS_ALL PODIS,

                   (SELECT   *

                      FROM   PER_ALL_PEOPLE_F

                     WHERE   SYSDATE BETWEEN EFFECTIVE_START_DATE

                                         AND  EFFECTIVE_END_DATE) BUYER

           WHERE       PO.PO_HEADER_ID = POL.PO_HEADER_ID

                   AND PO.PO_HEADER_ID = POLOC.PO_HEADER_ID

                   AND POVEN.VENDOR_ID = PO.VENDOR_ID

                   AND PO.PO_HEADER_ID = PODIS.PO_HEADER_ID

                   AND POL.PO_LINE_ID = POLOC.PO_LINE_ID

                   AND POL.PO_LINE_ID = PODIS.PO_LINE_ID

                   AND BUYER.PERSON_ID = PO.AGENT_ID) PO_DETAILS

 WHERE       PORH.REQUISITION_HEADER_ID = PORL.REQUISITION_HEADER_ID

         AND PORL.REQUISITION_LINE_ID = PORD.REQUISITION_LINE_ID

         AND GCC.CODE_COMBINATION_ID = PORD.CODE_COMBINATION_ID

         AND PORD.DISTRIBUTION_ID = PO_DETAILS.REQ_DISTRIBUTION_ID(+)

         AND REQUESTOR.PERSON_ID(+) = TO_PERSON_ID

Tuesday, 28 April 2020

Running Periodic Alert Scheduler Manually

Please use the below steps navigation to run the Periodic Alert Scheduler Manually which  is used to reschedule the updated periodic Alerts.

1.You need to Navigate to Alert Manager Responsibility
2.You Navigate to alert ->Define ;Go to Request->Schedule
3.There we can see periodic Alert Scheduler =>Active it (Click on Activate button)