DBA Data[Home] [Help]

APPS.WSH_PROCESS_INTERFACED_PKG SQL Statements

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

Line: 59

    SELECT wth3.transaction_id,
        wth3.document_type,
        wth3.document_direction,
        wth3.document_number,
        wth3.orig_document_number,
        wth3.entity_number,
        wth3.entity_type,
        wth3.trading_partner_id,
        wth3.action_type,
        wth3.transaction_status,
        wth3.ecx_message_id,
        wth3.event_name,
        wth3.event_key ,
        wth3.item_type,
        wth3.internal_control_number,
        --R12.1.1 STANDALONE PROJECT
        wth3.document_revision,
        wth3.attribute_category,
        wth3.attribute1,
        wth3.attribute2,
        wth3.attribute3,
        wth3.attribute4,
        wth3.attribute5,
        wth3.attribute6,
        wth3.attribute7,
        wth3.attribute8,
        wth3.attribute9,
        wth3.attribute10,
        wth3.attribute11,
        wth3.attribute12,
        wth3.attribute13,
        wth3.attribute14,
        wth3.attribute15,
        NULL -- LSP PROJECT : just added for dependency for client_id
  FROM wsh_transactions_history wth1,
       wsh_transactions_history wth2,
       wsh_transactions_history wth3
  WHERE
  wth2.entity_number = v_entity_number
  AND wth2.document_direction = 'I'
  AND wth2.document_type = 'SA'
  AND wth1.event_key = wth2.event_key
  AND wth1.document_number = wth2.ORIG_DOCUMENT_NUMBER
  AND wth1.action_type = 'A'
  and wth1.document_direction  = 'O'
  and wth1.document_type       = 'SR'
  AND wth1.entity_type = 'DLVY'
  AND wth3.entity_number = wth1.entity_number
  AND wth3.document_type       = 'SR'
  AND wth3.document_direction  = 'O'
  AND wth3.action_type = 'D'
  ORDER BY wth1.transaction_id DESC;
Line: 224

      WSH_INTERFACE_COMMON_ACTIONS.G_Update_Attributes_Tab.delete;
Line: 225

      WSH_INTERFACE_COMMON_ACTIONS.G_Packing_Detail_Tab.delete;
Line: 226

      WSH_INTERFACE_COMMON_ACTIONS.G_SERIAL_RANGE_TAB.delete;
Line: 358

                  UPDATE wsh_transactions_history
                     SET transaction_status = 'SC',
                         entity_number = x_delivery_id,
                         entity_type = 'DLVY'
                   WHERE entity_type = 'DLVY_INT'
                     AND entity_number = to_char(l_delivery_interface_id)
		     AND document_type =  'SR';
Line: 366

		-- Delete only for 'SR' because for 'SA' delete done in ship_advice_pkg
		IF(l_trns_history_rec.document_type = 'SR') THEN
 			Delete_Interface_Records(
				L_Delivery_Interface_ID,
				X_Return_Status);
Line: 372

		   wsh_debug_sv.log (l_module_name, 'Return status after delete interface records', X_Return_Status);
Line: 381

		-- Update done only for 'SR' because , for 'SA', update
		-- done in ship_advice_pkg
                  --Fulfillment Batch XML Project
                  --Moved the code to handle error status in workflow activity, in case the shipment advice handling for batches is carried out through workflows.
                  IF   l_trns_history_rec.document_type = 'SA'
                   AND l_trns_history_rec.event_name = 'oracle.apps.wsh.batch.bsai'
                   AND l_trns_history_rec.event_key IS NOT NULL THEN
                      IF l_debug_on THEN
                          wsh_debug_sv.log (l_module_name, 'Ship Advice error.Move to error event in workflow.');
Line: 392

                      UPDATE wsh_transactions_history
                         SET transaction_status = 'ER'
                       WHERE entity_type = 'DLVY_INT'
                         AND entity_number = to_char(l_delivery_interface_id)
                         -- TPW - Distributed changes
                         AND document_type in ('SR', 'SA');
Line: 477

                UPDATE wsh_transactions_history
                SET transaction_status = 'ER'
                WHERE entity_type = 'DLVY_INT'
                AND entity_number = to_char(l_delivery_interface_id)
                     AND document_type IN ('SR', 'SA');
Line: 1080

to Derive, Validate data in the Interface tables and update ID columns in interface tables.
This procedure includes calls to various APIs available in Shipping.

Only fields which are not being Derived/validated by any of the Public APIs(which will be
called subsequently) are Derived/Validated here.

If all the fields are successfully derived/Validated, the ID columns will be updated in
the Interface tables.
=======================================================================================*/


   PROCEDURE derive_ids (
      p_delivery_interface_id   IN       NUMBER,
      p_document_type           IN       VARCHAR2,
      x_return_status           OUT NOCOPY       VARCHAR2
   )
   IS
      CURSOR delivery_cur
      IS
         SELECT name, organization_code, customer_number,
                intmed_ship_to_location_code, initial_pickup_location_code,
                ultimate_dropoff_location_code, customer_name,
		-- TPW - Distributed changes
                ship_to_customer_name,
                ship_to_address1, ship_to_address2, ship_to_address3, ship_to_address4,
                ship_to_city, ship_to_state, ship_to_postal_code, ship_to_country
           FROM wsh_new_del_interface
          WHERE delivery_interface_id = p_delivery_interface_id
	  AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 1111

      SELECT 'X'
      FROM HZ_CUST_ACCT_SITES_ALL HCAS,
       HZ_CUST_SITE_USES_ALL HCSU,
       HZ_CUST_ACCOUNTS HCA,
       HZ_PARTY_SITES HPS,
       WSH_LOCATIONS WL,
       WSH_NEW_DELIVERIES WND
      WHERE wnd.delivery_id = p_delivery_id
      AND wnd.ultimate_dropoff_location_id = wl.wsh_location_id
      AND wl.location_source_code = 'HZ'
      AND wl.source_location_id = hps.location_id
      AND  HCSU.CUST_ACCT_SITE_ID = HCAS.CUST_ACCT_SITE_ID
      AND  HCAS.PARTY_SITE_ID = HPS.PARTY_SITE_ID
      AND  HCAS.CUST_ACCOUNT_ID = HCA.CUST_ACCOUNT_ID
      AND  HCSU.SITE_USE_CODE = 'SHIP_TO'
      AND  HCSU.STATUS = 'A'
      AND  HCAS.STATUS = 'A'
      AND  HCA.STATUS = 'A'
      AND  HCAS.ORG_ID = HCSU.ORG_ID
      AND WND.CUSTOMER_ID=  HCAS.cust_account_id
      AND HCAS.ORG_ID = p_org_id;
Line: 1135

         SELECT wddi.item_number, wddi.customer_item_number, wddi.organization_code,
                wddi.ship_from_location_code, wddi.ship_to_location_code,
                wddi.deliver_to_location_code, wddi.customer_number, wddi.subinventory,
                wddi.revision, wddi.lot_number, wddi.locator_id,
                wddi.intmed_ship_to_location_code, wddi.delivery_detail_interface_id,
		wddi.customer_name, wddi.container_flag,
		-- TPW - Distributed changes
                wddi.locator_code
           FROM wsh_del_details_interface wddi, wsh_del_assgn_interface wdai
          WHERE wdai.delivery_interface_id = p_delivery_interface_id
            AND wddi.delivery_detail_interface_id =
                                             wdai.delivery_detail_interface_id
	    AND wddi.INTERFACE_ACTION_CODE = '94X_INBOUND'
            AND wdai.INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 1152

	SELECT delivery_id, ultimate_dropoff_location_id
	FROM wsh_new_deliveries
	WHERE name=l_del_name;
Line: 1158

      SELECT to_number(org_information3)
      FROM hr_organization_information
      WHERE organization_id = p_organization_id
      AND org_information_context = 'Accounting Information';
Line: 1167

      SELECT DECODE(msi.location_control_code, 1, 'N', 'Y') loc_control_flag,
             msi.restrict_locators_code,
             msi.restrict_subinventories_code,
             msi.location_control_code,
             msi.reservable_type,
             msi.MTL_TRANSACTIONS_ENABLED_FLAG  -- Bug 3599363
        FROM MTL_SYSTEM_ITEMS     msi
       WHERE msi.inventory_item_id = v_inventory_item_id
         AND msi.organization_id     = v_organization_id;
Line: 1267

      SELECT COUNT (delivery_interface_id)
        INTO l_del_count
        FROM wsh_new_del_interface
       WHERE delivery_interface_id = p_delivery_interface_id
	AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 1506

	-- Select the distinct customer_name from this delivery's delivery details
	-- If there is more than one distinct customer_name at the delivery detail level,
	-- Raise an exception because that is an invalid case

	IF(delivery_rec.customer_name IS NULL) THEN
               IF l_debug_on THEN
		wsh_debug_sv.log (l_module_name, 'Delivery Rec customer name is null');
Line: 1516

			SELECT DISTINCT customer_name
			INTO l_detail_customer_name
			FROM wsh_del_details_interface wddi, wsh_del_assgn_interface wdai
			WHERE wddi.delivery_detail_interface_id = wdai.delivery_detail_interface_id
			AND wddi.customer_name IS NOT NULL
			AND wdai.delivery_interface_id = p_delivery_interface_id
			AND wddi.INTERFACE_ACTION_CODE = '94X_INBOUND'
			AND wdai.INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 1602

         /* Update ID fields in interface table only if all the validations succeeded */

        IF l_debug_on THEN
	 wsh_debug_sv.log (l_module_name, 'l_d_temp_status',l_d_temp_status);
Line: 1610

            UPDATE wsh_new_del_interface
               SET delivery_id = decode(p_document_type, 'SA',l_dlvy_id,delivery_id),
		   customer_id = l_customer_id,
                   organization_id = l_org_id,
                   intmed_ship_to_location_id = l_intmed_ship_to_location_id,
                   initial_pickup_location_id = l_initial_pickup_location_id,
                   ultimate_dropoff_location_id = l_ultimate_dropoff_location_id
             WHERE delivery_interface_id = p_delivery_interface_id;
Line: 1621

                 UPDATE wsh_del_legs_interface
                 SET delivery_id = l_dlvy_id
                 WHERE delivery_interface_id = p_delivery_interface_id;
Line: 1929

         /* Update ID fields in interface table only if all the validations succeeded */
       IF l_debug_on THEN
	wsh_debug_sv.log (l_module_name, 'Delivery ID', l_dlvy_id);
Line: 1938

            UPDATE wsh_del_details_interface
               SET inventory_item_id = l_inventory_item_id,
                   customer_item_id = l_customer_item_id,
                   organization_id = l_det_org_id,
                   ship_from_location_id = l_ship_from_location_id,
                   ship_to_location_id = l_ship_to_location_id,
                   intmed_ship_to_location_id = l_det_intmed_shipto,
                   deliver_to_location_id = l_deliver_to_location_id,
                   customer_id = l_det_customer_id,
		   ship_to_site_use_id = l_ship_to_site_use_id,
		   deliver_to_site_use_id = l_deliver_to_site_use_id,
                   org_id                 = l_line_op_unit_id,
                   -- TPW - Distributed changes
                   locator_id = l_locator_id,
		   source_header_id = decode(p_document_type, 'SR', l_dlvy_id, source_header_id)
             WHERE delivery_detail_interface_id = delivery_detail_rec.delivery_detail_interface_id;
Line: 2055

PROCEDURE NAME : Delete_Interface_Records

This Procedure will be used to delete record in the different interface tables, after data
is populated in the base tables ????

=======================================================================================*/

   PROCEDURE delete_interface_records (
      p_delivery_interface_id   IN       NUMBER,
      x_return_status           OUT NOCOPY       VARCHAR2
   )
   IS
      l_transaction_status   wsh_transactions_history.transaction_status%TYPE;
Line: 2068

      invalid_delete         EXCEPTION;
Line: 2073

         SELECT delivery_detail_interface_id, del_assgn_interface_id
           FROM wsh_del_assgn_interface
          WHERE delivery_interface_id = p_delivery_interface_id
	  AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2080

         SELECT wdli.delivery_leg_interface_id,
                wdli.pick_up_stop_interface_id,
                wdli.drop_off_stop_interface_id, wtsi.trip_interface_id
           FROM wsh_del_legs_interface wdli, wsh_trip_stops_interface wtsi
          WHERE wdli.delivery_interface_id = p_delivery_interface_id
            AND wdli.pick_up_stop_interface_id = wtsi.stop_interface_id
 	    AND wdli.INTERFACE_ACTION_CODE = '94X_INBOUND'
	    AND wtsi.INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2093

      l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'DELETE_INTERFACE_RECORDS';
Line: 2105

      wsh_debug_sv.push (l_module_name, 'DELETE INTERFACE RECORDS');
Line: 2109

      SELECT COUNT (*)
        INTO l_del_count
        FROM wsh_new_del_interface
       WHERE delivery_interface_id = p_delivery_interface_id
	AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2120

            DELETE wsh_del_legs_interface
            WHERE  delivery_leg_interface_id = ids_rec.delivery_leg_interface_id
		AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2125

            DELETE  wsh_freight_costs_interface
            WHERE   delivery_leg_interface_id = ids_rec.delivery_leg_interface_id
                    AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2129

            DELETE wsh_trip_stops_interface
            WHERE stop_interface_id IN
                              (ids_rec.pick_up_stop_interface_id,
                               ids_rec.drop_off_stop_interface_id
                              )
		AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2137

            DELETE  wsh_freight_costs_interface
            WHERE   stop_interface_id IN
                              (ids_rec.pick_up_stop_interface_id,
                               ids_rec.drop_off_stop_interface_id
                              )
                    AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2144

            DELETE wsh_trips_interface
            WHERE trip_interface_id = ids_rec.trip_interface_id
		AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2149

            DELETE  wsh_freight_costs_interface
            WHERE   trip_interface_id = ids_rec.trip_interface_id
                    AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2157

            DELETE wsh_del_details_interface
             WHERE delivery_detail_interface_id = detail_interface_ids_rec.delivery_detail_interface_id
		AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2162

            DELETE  wsh_freight_costs_interface
            WHERE   delivery_detail_interface_id = detail_interface_ids_rec.delivery_detail_interface_id
                AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2166

            DELETE wsh_del_assgn_interface
             WHERE delivery_detail_interface_id = detail_interface_ids_rec.delivery_detail_interface_id
		AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2171

         DELETE wsh_new_del_interface
          WHERE delivery_interface_id = p_delivery_interface_id
		AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2176

         DELETE   wsh_freight_costs_interface
         WHERE    delivery_interface_id = p_delivery_interface_id
                  AND INTERFACE_ACTION_CODE = '94X_INBOUND';
Line: 2194

      WHEN invalid_delete
      THEN
         x_return_status := wsh_util_core.g_ret_sts_error;
Line: 2198

          WSH_DEBUG_SV.logmsg(l_module_name,'invalid_delete exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
Line: 2199

          WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:invalid_delete');
Line: 2209

   END delete_interface_records;
Line: 2214

PROCEDURE NAME : Delete_Interface_Records

This Procedure will be used to delete record in the different interface tables, after data
is populated in the base tables

=======================================================================================*/

   PROCEDURE delete_interface_records (
      p_del_interface_id_tbl       IN         WSH_UTIL_CORE.Id_Tab_Type,
      p_del_det_interface_id_tbl   IN         WSH_UTIL_CORE.Id_Tab_Type,
      p_del_assgn_interface_id_tbl IN         WSH_UTIL_CORE.Id_Tab_Type,
      p_del_error_interface_id_tbl IN         WSH_UTIL_CORE.Id_Tab_Type,
      p_det_error_interface_id_tbl IN         WSH_UTIL_CORE.Id_Tab_Type,
      x_return_status              OUT NOCOPY VARCHAR2
   )
   IS
      l_debug_on BOOLEAN;
Line: 2231

      l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'DELETE_INTERFACE_RECORDS';
Line: 2243

      wsh_debug_sv.push (l_module_name, 'DELETE INTERFACE RECORDS');
Line: 2255

         DELETE FROM wsh_interface_errors
         WHERE  interface_error_id = p_det_error_interface_id_tbl(i);
Line: 2259

        wsh_debug_sv.logmsg ( l_module_name, 'Deleted '||SQL%ROWCOUNT||' Records from wsh_interface_errors');
Line: 2266

         DELETE FROM wsh_interface_errors
         WHERE  interface_error_id = p_del_error_interface_id_tbl(i);
Line: 2270

         wsh_debug_sv.logmsg ( l_module_name, 'Deleted '||SQL%ROWCOUNT||' Records from wsh_interface_errors');
Line: 2277

         DELETE FROM wsh_del_assgn_interface
         WHERE  del_assgn_interface_id = p_del_assgn_interface_id_tbl(i);
Line: 2281

        wsh_debug_sv.logmsg ( l_module_name, 'Deleted '||SQL%ROWCOUNT||' Records from wsh_del_assgn_interface');
Line: 2288

         DELETE FROM wsh_del_details_interface
         WHERE  delivery_detail_interface_id = p_del_det_interface_id_tbl(i);
Line: 2292

        wsh_debug_sv.logmsg ( l_module_name, 'Deleted '||SQL%ROWCOUNT||' Records from wsh_del_details_interface');
Line: 2299

         DELETE FROM wsh_new_del_interface
         WHERE  delivery_interface_id = p_del_interface_id_tbl(i);
Line: 2303

        wsh_debug_sv.logmsg ( l_module_name, 'Deleted '||SQL%ROWCOUNT||' Records from wsh_new_del_interface');
Line: 2323

   END delete_interface_records;