DBA Data[Home] [Help]

APPS.CN_NOTIFY_ORDERS SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 30

		SELECT	'Y'
		INTO 	exist
		FROM 	sys.dual
		WHERE 	EXISTS
			(SELECT 1
			 FROM 	cn_not_trx
			 WHERE 	source_trx_id = hid
			 AND 	org_id = p_org_id);
Line: 103

    SELECT collected_flag
      INTO col_flag
      FROM cn_not_trx_all a
     WHERE a.source_trx_id = hid
       AND a.source_trx_line_id = lid
       AND a.org_id = x_org_id
       AND a.not_trx_id = (	SELECT max(b.not_trx_id)
				  FROM cn_not_trx_all b
				 WHERE b.source_trx_id = hid
				   AND b.source_trx_line_id = lid
				   AND b.org_id = a.org_id );
Line: 155

     CURSOR batch_size IS SELECT system_batch_size FROM cn_repositories WHERE org_id = x_org_id;
Line: 162

    cn_process_audits_pkg.insert_row
	( l_rowid, l_proc_audit_id, NULL, 'NOT', 'Notification run',
	  NULL, NULL, NULL, NULL, NULL, SYSDATE, NULL, x_org_id);
Line: 178

      INSERT INTO cn_not_trx_all (
        org_id,
        not_trx_id,
        batch_id,
        notified_date,
        processed_date,
        notification_run_id,
        collected_flag,
        row_id,
        source_trx_id,
        source_trx_line_id,
	   source_doc_type,
        adjusted_flag,
        event_id)
      SELECT
        asoh.org_id,
        cn_not_trx_s.NEXTVAL,
        FLOOR(cn_not_trx_s.CURRVAL/NVL(l_sys_batch_size,200)),
        SYSDATE,
        asoh.booked_date,
        l_proc_audit_id,
        'N',
        asoh.rowid,
        asoh.header_id,
        asol.line_id,
	   g_source_doc_type,
        p_adj_flag,
        cn_global.ord_event_id
      FROM
        aso_i_oe_order_headers_v asoh,
        aso_i_oe_order_lines_v asol
      WHERE
        asoh.header_id = p_header_id
        AND asoh.booked_flag = 'Y'              -- only interested in status of booked
	   -- NOTE: asoh.header_id is a primary key, so no need to
	   -- have an org filter for the join to asol
        AND asol.header_id = asoh.header_id
        AND asol.line_id = p_line_id
        AND asol.org_id = x_org_id -- R12 MOAC Changes
        AND asoh.org_id = asol.org_id -- R12 MOAC Changes
-- also collect 'RETURN's        AND asol.line_category_code = 'ORDER'   -- only collect 'Order' lines
        AND EXISTS
		  (SELECT 1
		  FROM mtl_system_items mtl
		  WHERE
                --+
                -- Because this procedure is looking at orders for any
                -- org_id, we have to get the inventory organization for
                -- the org_id of the order, by passing that org_id into
                -- our call to OE_PROFILE.VALUE.
                --+
			 NVL(mtl.organization_id,NVL(oe_profile.value('OE_ORGANIZATION_ID',asoh.org_id),-99)) =
                    NVL(oe_profile.value('OE_ORGANIZATION_ID',asoh.org_id),-99)
                AND mtl.inventory_item_id = asol.inventory_item_id
                AND mtl.invoiceable_item_flag = 'Y');     -- only want invoiceable items
Line: 261

  PROCEDURE notify_deleted_line (
	p_header_id	NUMBER,
	p_line_id	     NUMBER,
	p_org_id NUMBER) IS

	l_proc_audit_id NUMBER;
Line: 270

     CURSOR batch_size IS SELECT system_batch_size FROM cn_repositories WHERE org_id = p_org_id;
Line: 274

    cn_message_pkg.debug('notify: adjust: entering notify_deleted_line (lid = '||p_line_id||')');
Line: 275

    fnd_file.put_line(fnd_file.Log, 'notify: adjust: entering notify_deleted_line (lid = '||p_line_id||')');
Line: 280

    cn_process_audits_pkg.insert_row
	( l_rowid, l_proc_audit_id, NULL, 'NOT', 'Notification run',
	  NULL, NULL, NULL, NULL, NULL, SYSDATE, NULL, p_org_id);
Line: 293

      INSERT INTO cn_not_trx_all (
		 org_id,
	     not_trx_id,
	     batch_id,
	     notified_date,
	     processed_date,
	     notification_run_id,
	     collected_flag,
	     row_id,
	     source_trx_id,
	     source_trx_line_id,
	     source_doc_type,
	     adjusted_flag,
	     event_id)
      SELECT
		 asoh.org_id,
	     cn_not_trx_s.NEXTVAL,
	     FLOOR(cn_not_trx_s.CURRVAL/NVL(l_sys_batch_size,200)),
	     SYSDATE,
	     asoh.booked_date,
	     l_proc_audit_id,
          'N',
	     asoh.rowid,
	     asoh.header_id,
	     p_line_id,
	     g_source_doc_type,
	     'Y',
	     cn_global.ord_event_id
      FROM
          aso_i_oe_order_headers_v asoh
      WHERE
          asoh.header_id = p_header_id
          AND asoh.booked_flag = 'Y'
		  AND asoh.org_id = l_org_id;              -- only interested in status of booked
Line: 331

    cn_message_pkg.debug('exit from notify_deleted_line (lid = '||p_line_id||')');
Line: 332

    fnd_file.put_line(fnd_file.Log, 'exit from notify_deleted_line (lid = '||p_line_id||')');
Line: 333

  END notify_deleted_line;
Line: 357

      SELECT top_model_line_id, service_reference_line_id
      FROM aso_i_oe_order_lines_v
      WHERE line_id = cp_lid
	  AND org_id = l_org_id;
Line: 369

    cn_process_audits_pkg.insert_row
	( l_rowid, l_proc_audit_id, NULL, 'NOT', 'Notification run',
	  NULL, NULL, NULL, NULL, NULL, SYSDATE, NULL, p_org_id);
Line: 387

          (SELECT line_id
           FROM   aso_i_oe_order_lines_v asol
           WHERE  asol.header_id = p_header_id
                  AND asol.service_reference_line_id IS NULL
                  AND asol.org_id = l_org_id
                  AND (asol.top_model_line_id IS NULL OR
                      asol.top_model_line_id = asol.line_id)
                  AND NOT EXISTS
                    (SELECT 1
                     FROM aso_i_oe_sales_credits_v assc
                     WHERE assc.line_id = asol.line_id))
        LOOP
            notify_affected_lines(p_header_id, rec.line_id, l_org_id);
Line: 436

              (SELECT header_id, line_id
               FROM   aso_i_oe_order_lines_v asol
               WHERE  asol.service_reference_line_id = p_line_id
               AND    asol.org_id = p_org_id
                      AND NOT EXISTS
                        (SELECT 1
                         FROM aso_i_oe_sales_credits_v assc
                         WHERE assc.line_id = asol.line_id))
            LOOP
                notify_line(rec.header_id, rec.line_id,x_org_id => l_org_id);
Line: 457

              (SELECT line_id
               FROM   aso_i_oe_order_lines_v asol
               WHERE  asol.top_model_line_id = p_line_id
               AND asol.org_id = p_org_id
                      AND asol.header_id = p_header_id   -- makes use of index
                      AND NOT EXISTS
                        (SELECT 1
                         FROM aso_i_oe_sales_credits_v assc
                         WHERE assc.line_id = asol.line_id)
                      AND asol.line_id <> p_line_id)     -- don't re-collect ourself
            LOOP
                notify_line(p_header_id, rec.line_id,x_org_id => l_org_id);
Line: 524

      SELECT header_id, line_id
      FROM aso_i_oe_order_lines_v
      WHERE header_id = cp_hid
	  AND org_id = x_org_id; -- R12 MOAC Change
Line: 533

      SELECT header_id, line_id
      FROM aso_i_oe_order_lines_v
      WHERE service_reference_line_id = cp_lid
        AND header_id <> cp_hid
		AND org_id = x_org_id;
Line: 556

   cn_message_pkg.debug('notify: Got update information from Order Capture Feedback Queue for an adjusted order.');
Line: 557

   fnd_file.put_line(fnd_file.Log, 'notify: Got update information from Order Capture Feedback Queue for an adjusted order.');
Line: 566

    SAVEPOINT	Update_Headers;
Line: 616

    cn_message_pkg.debug('notify: adjust: Deleted Lines? - Line_Tbl');
Line: 617

    fnd_file.put_line(fnd_file.Log, 'notify: adjust: Deleted Lines? - Line_Tbl');
Line: 621

        IF p_line_tbl(i).operation = 'DELETE' THEN
            notify_deleted_line
	                         (p_line_tbl(i).header_id,
	                          p_line_tbl(i).line_id,
							  p_org_id => l_org_id);
Line: 634

        cn_message_pkg.debug('notify: adjust: Header Insert/Update?');
Line: 635

        fnd_file.put_line(fnd_file.Log, 'notify: adjust: Header Insert/Update?');
Line: 642

        ELSIF p_header_rec.operation = 'UPDATE' THEN
            IF unequal(p_header_rec.invoice_to_org_id , p_old_header_rec.invoice_to_org_id) OR
               unequal(p_header_rec.invoice_to_contact_id , p_old_header_rec.invoice_to_contact_id) OR
               unequal(p_header_rec.ship_to_org_id , p_old_header_rec.ship_to_org_id) OR
               unequal(p_header_rec.order_number , p_old_header_rec.order_number) OR
               unequal(p_header_rec.booked_flag , p_old_header_rec.booked_flag) OR
               unequal(p_header_rec.transactional_curr_code , p_old_header_rec.transactional_curr_code) OR
               unequal(p_header_rec.conversion_rate , p_old_header_rec.conversion_rate)
            THEN
                l_order_changed := TRUE;
Line: 652

                cn_message_pkg.debug('notify: adjust: .  update of interest');
Line: 653

                fnd_file.put_line(fnd_file.Log, 'notify: adjust: .  update of interest');
Line: 683

        cn_message_pkg.debug('notify: adjust: Line Insert/Update? - Line_Tbl');
Line: 684

        fnd_file.put_line(fnd_file.Log, 'notify: adjust: Line Insert/Update? - Line_Tbl');
Line: 702

            ELSIF p_line_tbl(i).operation = 'UPDATE' THEN
                --+
                -- Locate the Before Image of the line
                --+
                l_found := FALSE;
Line: 734

                   (p_line_tbl(i).operation='UPDATE' AND p_old_line_tbl(l_idx).operation ='CREATE') -- Added for Main Line Placeholder Bug 4665116
                THEN
                    cn_message_pkg.debug('notify: adjust: .  update of interest');
Line: 737

                    fnd_file.put_line(fnd_file.Log, 'notify: adjust: .  update of interest');
Line: 754

            IF p_header_scredit_tbl(i).operation = 'DELETE' THEN
                cn_notify_orders.notify_affected_lines
                      (p_old_header_scredit_tbl(i).header_id,
                       p_old_header_scredit_tbl(i).line_id, p_org_id => l_org_id);  -- this should be NULL
Line: 766

        cn_message_pkg.debug('notify: adjust: Header Sales Credit Insert/Update? - Header_Scredit_Tbl');
Line: 767

        fnd_file.put_line(fnd_file.Log, 'notify: adjust: Header Sales Credit Insert/Update? - Header_Scredit_Tbl');
Line: 784

            ELSIF p_header_scredit_tbl(i).operation = 'UPDATE' THEN
                --+
                -- Locate the Before Image of the header_scredit
                --+
                l_found := FALSE;
Line: 811

                    cn_message_pkg.debug('notify: adjust: .  update of interest');
Line: 812

                    fnd_file.put_line(fnd_file.Log, 'notify: adjust: .  update of interest');
Line: 829

            IF p_line_scredit_tbl(i).operation = 'DELETE' THEN
                cn_notify_orders.notify_affected_lines
                      (p_old_line_scredit_tbl(i).header_id,
                       p_old_line_scredit_tbl(i).line_id,p_org_id => l_org_id);
Line: 841

        cn_message_pkg.debug('notify: adjust: Line Sales Credit Insert/Update? - Line_Scredit_Tbl');
Line: 842

        fnd_file.put_line(fnd_file.Log, 'notify: adjust: Line Sales Credit Insert/Update? - Line_Scredit_Tbl');
Line: 859

            ELSIF p_line_scredit_tbl(i).operation = 'UPDATE' THEN
                --+
                -- Locate the Before Image of the line_scredit
                --+
                l_found := FALSE;
Line: 886

                    cn_message_pkg.debug('notify: adjust: .  update of interest');
Line: 887

                    fnd_file.put_line(fnd_file.Log, 'notify: adjust: .  update of interest');
Line: 914

      ROLLBACK TO Update_Headers;
Line: 923

      ROLLBACK TO Update_Headers;
Line: 932

      ROLLBACK TO Update_Headers;
Line: 1022

      SELECT booked_flag
      FROM aso_i_oe_order_lines_v
	WHERE header_id = cp_hid
	AND org_id = x_org_id; -- R12 MOAC Change
Line: 1031

   SAVEPOINT	Update_Headers_Savepoint;
Line: 1085

	    --            ROLLBACK TO Update_Headers_Savepoint;
Line: 1303

    CURSOR batch_size IS SELECT system_batch_size FROM cn_repositories WHERE org_id = x_org_id;
Line: 1325

    cn_message_pkg.debug('notify: Getting any pending order updates off of the Order Capture Feedback Queue');
Line: 1326

    fnd_file.put_line(fnd_file.Log, 'notify: Getting any pending order updates off of the Order Capture Feedback Queue');
Line: 1337

    cn_process_audits_pkg.insert_row
	( l_rowid, l_proc_audit_id, NULL, 'NOT', 'Notification run',
	  NULL, NULL, NULL, NULL, NULL, SYSDATE, NULL, x_org_id);
Line: 1345

	( 'notify: Inserting records into CN_NOT_TRX from period '
	   || l_start_date ||' to period '|| l_end_date ||'.');
Line: 1348

    fnd_file.put_line(fnd_file.Log, 'notify: Inserting records into CN_NOT_TRX from period '
	   || l_start_date ||' to period '|| l_end_date ||'.');
Line: 1355

    INSERT INTO cn_not_trx (
	   not_trx_id,
	   batch_id,
	   notified_date,
	   processed_date,
	   notification_run_id,
	   collected_flag,
	   row_id,
	   source_trx_id,
	   source_trx_line_id,
	   source_doc_type,
	   adjusted_flag,
	   event_id,
	   org_id)
    SELECT
	   cn_not_trx_s.NEXTVAL,
	   FLOOR(cn_not_trx_s.CURRVAL/l_sys_batch_size),
	   SYSDATE,
	   asoh.booked_date,
	   l_proc_audit_id,
	   'N',
	   asoh.rowid,
	   asoh.header_id,
	   asol.line_id,
	   g_source_doc_type,
	   x_adj_flag,
	   cn_global.ord_event_id,
	   l_client_org_id
    FROM
        aso_i_oe_order_headers_v asoh,
	    aso_i_oe_order_lines_v asol
    WHERE
        -- Multi_org filter, see comment in procedure header
	   -- NOTE: asoh.header_id is a primary key, so no need to
	   -- have an org filter for the join to asol
	   --+
        NVL(asoh.org_id,l_client_org_id) = l_client_org_id
        AND asol.org_id = asoh.org_id
        --+
        AND asoh.booked_flag = 'Y'              -- only interested in status of booked
        AND asol.header_id = asoh.header_id
-- also collect 'RETURN's        AND asol.line_category_code = 'ORDER'   -- only collect 'Order' lines
        AND TRUNC(asoh.booked_date)
            BETWEEN TRUNC(nvl(l_start_date,asoh.booked_date))
                AND TRUNC(nvl(l_end_date,asoh.booked_date))
        AND EXISTS
		  (SELECT 1
		  FROM mtl_system_items mtl
		  WHERE NVL(mtl.organization_id,l_so_org_id) = l_so_org_id
                  AND mtl.inventory_item_id = asol.inventory_item_id
                  AND mtl.invoiceable_item_flag = 'Y')     -- only want invoiceable items
        AND NOT EXISTS
                       (SELECT 1
                       FROM cn_not_trx
                       WHERE source_trx_id = asoh.header_id
                             AND source_trx_line_id = asol.line_id
                             AND event_id= cn_global.ord_event_id
							 AND org_id = l_client_org_id) ;
Line: 1420

    cn_process_audits_pkg.update_row(l_proc_audit_id, NULL, SYSDATE, 0,
      'Finished notification run: Notified ' || l_trx_count || ' orders.');
Line: 1427

      cn_message_pkg.debug('notify: No rows inserted into CN_NOT_TRX. Possible reason: Order transactions may have already been collected.');
Line: 1428

      fnd_file.put_line(fnd_file.Log, 'notify: No rows inserted into CN_NOT_TRX. Possible reason: Order transactions may have already been collected.');
Line: 1455

    cn_process_audits_pkg.update_row(l_proc_audit_id, NULL, SYSDATE, SQLCODE,
      SQLERRM);