DBA Data[Home] [Help]

APPS.OE_DELAYED_REQUESTS_UTIL SQL Statements

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

Line: 18

   Select sum(Percent) Per_total
   From oe_sales_credits sc,
	   oe_sales_credit_types sct
   Where line_id = p_line_id
   And sct.sales_credit_type_id = sc.sales_credit_type_id
   And sct.quota_flag = 'Y';
Line: 181

 SELECT Line_id, item_type_code,line_set_id,
	   Service_reference_line_id,
	   inventory_item_id,
	   service_reference_type_code --Bug 4946843
 FROM   OE_ORDER_LINES_ALL
 WHERE  Line_id = l_line_id;
Line: 189

 SELECT /* MOAC_SQL_CHANGE */ line_id, header_id
 FROM   OE_ORDER_LINES
 WHERE  service_reference_line_id
             in (SELECT line_id
                 FROM   oe_order_lines_all
                 WHERE top_model_line_id = l_line_id1)
 AND   line_id <> l_line_id and
 inventory_item_id = l_temp_inv_item_id;
Line: 261

       Select '1', sales_credit_id, nvl(percent,0)
       INTO    l_temp, l_sales_credit_id, l_q_percent
       from  oe_sales_credits
       Where header_id = i.header_id
       AND   line_id = i.line_id
       And   sales_credit_type_id = l_sales_credit_type_id
       AND   salesrep_id          = l_salesrep_id;
Line: 293

	   Select quota_flag
	   Into   l_new_quota_flag
	   From   oe_sales_credit_types
	   Where  sales_credit_type_id = l_new_sales_credit_type_id;
Line: 300

	     Select quota_flag
	     Into   l_old_quota_flag
	     From   oe_sales_credit_types
	     Where  sales_credit_type_id = l_old_sales_credit_type_id;
Line: 319

            Select nvl(sum(Percent),0) Per_total
            Into  l_per_total
            From  oe_sales_credits sc,
                  oe_sales_credit_types sct
            Where header_id = i.header_id
            AND   line_id = i.line_id
            And   sct.sales_credit_type_id = sc.sales_credit_type_id
            And   sct.quota_flag = 'Y';
Line: 358

        IF l_operation = OE_GLOBALS.G_OPR_UPDATE THEN

          oe_msg_pub.add('In Update');
Line: 364

            Select nvl(sum(Percent),0) Per_total
            Into  l_per_total
            From  oe_sales_credits sc,
                  oe_sales_credit_types sct
            Where header_id = i.header_id
            AND   line_id = i.line_id
            And   sct.sales_credit_type_id = sc.sales_credit_type_id
            And   sct.quota_flag = 'Y';
Line: 408

           l_Line_Scredit_tbl(l_count).Operation := OE_GLOBALS.G_OPR_UPDATE;
Line: 411

        ELSIF l_operation = OE_GLOBALS.G_OPR_DELETE
	   AND   l_percent = l_q_percent THEN

           l_count := l_count + 1;
Line: 419

           l_Line_Scredit_tbl(l_count).Operation := OE_GLOBALS.G_OPR_DELETE;
Line: 464

       l_Line_Scredit_tbl.DELETE;
Line: 497

PROCEDURE UPDATE_LINK_TO_LINE_ID
( x_return_status OUT NOCOPY Varchar2

                  ,p_top_model_line_id  IN NUMBER
                 )
IS
BEGIN

        null;
Line: 507

END UPDATE_LINK_TO_LINE_ID;
Line: 543

     SELECT  'DUPLICATE_DISCOUNT'
	INTO    l_duplicate
	FROM    oe_price_adjustments
	WHERE   header_id = l_header_id
	AND     discount_id = l_discount_id
	AND     price_adjustment_id <> Nvl(l_entity_id, -1)
	AND     line_id IS NULL;
Line: 572

      SELECT  'DUPLICATE_DISCOUNT'
	 INTO    l_duplicate
	 FROM    oe_price_adjustments
	 WHERE   header_id = l_header_id
	 AND     discount_id = l_discount_id
	 AND     line_id = l_line_id
	 AND     price_adjustment_id <> Nvl(l_entity_id, -1);
Line: 645

SELECT count(p.price_adjustment_id)
FROM   oe_price_adjustments p
WHERE  p.header_id = l_header_id
AND    (p.line_id = l_line_id
OR      p.line_id IS NULL) ;
Line: 652

SELECT p.line_id
FROM   oe_price_adjustments p
WHERE  p.header_id = l_header_id
AND    p.line_id IS NOT NULL
ORDER by p.line_id;
Line: 683

          SELECT  count(d.name)
	     INTO  l_count
	     FROM  oe_price_adjustments adj,
                oe_discount_lines dln,
	           oe_discounts d
	     WHERE adj.header_id = l_header_id
	     AND   Nvl(adj.line_id, l_line_id) = l_line_id
          AND   d.discount_id = adj.discount_id
	     AND   dln.discount_line_id = adj.discount_line_id
	     AND   dln.price IS NOT NULL
	     AND   ROWNUM = 1;
Line: 716

      SELECT  count(adj.price_adjustment_id)
	 INTO    l_count
	 FROM    oe_price_adjustments adj
	 WHERE   adj.header_id = l_header_id
	 AND     Nvl(adj.line_id, l_line_id) = l_line_id
	 AND     exists
		   (SELECT 'fixed_price'
		    FROM   oe_discount_lines dln
		    WHERE  dln.discount_line_id = l_discount_line_id
		    AND    dln.price IS NOT NULL)
	 AND ROWNUM = 1;
Line: 747

      SELECT  d.name
	 INTO    l_fixed_price
	 FROM    oe_price_adjustments adj,
              oe_discount_lines dln,
	         oe_discounts d
	 WHERE   adj.header_id = l_header_id
	 AND     Nvl(adj.line_id, l_line_id) = l_line_id
      AND     d.discount_id = adj.discount_id
	 AND     dln.discount_line_id = adj.discount_line_id
	 AND     dln.price IS NOT NULL
	 AND     ROWNUM = 1;
Line: 832

SELECT  p.price_adjustment_id, Nvl(p.line_id, -1) line_id
  FROM  oe_price_adjustments p,
        oe_order_lines o
 WHERE  p.header_id = l_header_id
  AND   o.header_id = l_header_id
  AND  (p.line_id = o.line_id
   OR   p.line_id IS NULL)
ORDER  BY p.line_id;
Line: 843

SELECT Nvl(SUM(percent), 0)
  FROM oe_price_adjustments p
 WHERE header_id = l_header_id
   AND  line_id IS NULL;
Line: 850

SELECT Nvl(SUM(percent), 0) + l_percent_total
  FROM oe_price_adjustments
 WHERE header_id = l_header_id
   AND  line_id = l_line_id;
Line: 858

SELECT NVL( MAX(SUM(PERCENT)), 0) + l_percent_total
  FROM OE_PRICE_ADJUSTMENTS P, OE_ORDER_LINES L
 WHERE P.HEADER_ID = l_header_id
   AND P.LINE_ID IS NOT NULL
   AND P.LINE_ID = L.LINE_ID
GROUP BY P.line_id;
Line: 1041

  l_api_name                  CONSTANT VARCHAR2(30) := 'Insert_Order';
Line: 1051

  l_select_flag			VARCHAR2(1);
Line: 1162

    OE_DEBUG_PUB.ADD('Inserting Included Items', 2);
Line: 1185

                             , p_calling_action => 'UPDATE'
                             , p_delayed_request=> FND_API.G_TRUE
                             , p_msg_count      => l_msg_count
                             , p_msg_data       => l_msg_data
                             , p_return_status  => l_return_status
                             );
Line: 1225

/* procedure insert_rma_scredit_adjustment
   To insert sales credit of corresponding RMA lines.
   if sales credit exists on the existing line, delete them first,
   then insert new ones taken from the referenced line.
   Price adjustments has been moved to apply change attributes
*/
Procedure INSERT_RMA_SCREDIT_ADJUSTMENT
(p_line_id       IN  NUMBER
,x_return_status OUT NOCOPY VARCHAR2

)
IS
l_Line_Scredit_tbl 	OE_Order_PUB.Line_Scredit_Tbl_Type;
Line: 1244

l_api_name 		CONSTANT VARCHAR(30) := 'INSERT_RMA_SCREDIT_ADJUSTMENT';
Line: 1254

  OE_DEBUG_PUB.ADD('RMA: In INSERT_RMA_SCREDIT_ADJUSTMENT',1);
Line: 1262

   SELECT header_id, reference_header_id, reference_line_id,split_by
         ,SOURCE_DOCUMENT_TYPE_ID --added source document id as a part of 6778016
     INTO l_header_id,l_ref_header_id, l_ref_line_id, l_split_by
          ,l_src_doc_type_id           --added l_src_doc_type_id as a part of 6778016
     FROM oe_order_lines
    WHERE line_id = p_line_id;
Line: 1292

          OE_DEBUG_PUB.ADD('There are no existing sales credits to delete',1);
Line: 1301

      l_x_Line_Scredit_tbl(I).operation := OE_GLOBALS.G_OPR_DELETE;
Line: 1306

    l_Line_Scredit_tbl.DELETE;
Line: 1308

  END IF; /* end delete existing sales credit */
Line: 1315

   SELECT header_id, reference_header_id, reference_line_id
     INTO l_header_id,l_ref_header_id, l_ref_line_id
     FROM oe_order_lines
    WHERE line_id = p_line_id;
Line: 1350

  END IF; /* end inserting sales credit */
Line: 1404

    l_Line_Scredit_tbl.DELETE;
Line: 1406

  END IF; /* end inserting sales credit */
Line: 1408

  oe_debug_pub.add('Exit INSERT_RMA_SCREDIT_ADJUSTMENT',1);
Line: 1428

            ,   'INSERT_RMA_SCREDIT_ADJUSTMENT'
            );
Line: 1432

END INSERT_RMA_SCREDIT_ADJUSTMENT;
Line: 1565

              l_Line_Adj_tbl(l_counter).operation := OE_GLOBALS.G_OPR_DELETE;
Line: 1624

            l_Line_Adj_tbl(l_counter+I).updated_flag                := NULL;
Line: 1625

            l_Line_Adj_tbl(l_counter+I).update_allowed	             := NULL;
Line: 1653

        l_Line_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
Line: 1716

    l_tax_rec_out_tbl.delete;
Line: 1912

      SELECT header_id
        INTO l_header_id
        FROM oe_order_lines
       WHERE line_id = l_request_rec.entity_id;
Line: 2075

      SELECT header_id
        INTO l_header_id
        FROM oe_order_lines
       WHERE line_id = l_request_rec.entity_id;
Line: 2255

PROCEDURE Insert_Set
  (p_request_rec	IN oe_order_pub.request_rec_type,
x_return_status OUT NOCOPY VARCHAR2)

  IS
l_return_status VARCHAR2(30);
Line: 2266

    OE_SET_UTIL.Insert_Into_Set
                 (p_set_request_tbl => p_set_request,
                  p_Push_Set_Date => 'N',
                  X_Return_Status  => l_return_status,
                  x_msg_count      => x_msg_count,
                  x_msg_data       => x_msg_data);
Line: 2311

            ,   'Insert_Set'
            );
Line: 2323

End Insert_Set;
Line: 2383

              SELECT header_id
              INTO   l_header_id
              FROM   oe_order_lines_all
              WHERE  line_id = p_entity_id;
Line: 2459

  l_selelect_line_tbl     OE_GLOBALS.Selected_Record_Tbl;
Line: 2466

              SELECT header_id
              INTO   l_header_id
              FROM   oe_order_lines_all
              WHERE  line_id = p_entity_id;
Line: 2486

    ( p_selected_line_tbl => l_selelect_line_tbl,
      p_record_count      => 1,
      p_set_name          => p_fulfillment_set_name,
      p_set_type          => 'FULFILLMENT',
      p_operation         => l_action,
      p_header_id         => l_header_id,
      x_Set_Id            => l_set_id,
      x_return_status     => x_return_status,
      x_msg_count         => l_msg_count ,
      x_msg_data          => l_msg_data);
Line: 2524

PROCEDURE Update_shipping
-----------------------------------------------------------------------*/
PROCEDURE Update_shipping
( p_update_shipping_tbl     IN  OE_ORDER_PUB.request_tbl_type
, p_line_id                 IN  NUMBER
, p_operation               IN  VARCHAR2
, x_return_status OUT NOCOPY VARCHAR2)

IS
  l_update_shipping_index    NUMBER := 0;
Line: 2534

  l_update_lines_tbl         OE_ORDER_PUB.request_tbl_type;
Line: 2535

  l_update_lines_index       NUMBER := 0;
Line: 2538

  oe_debug_pub.add('Entering UTIL.Update_Shipping'||p_line_id, 1);
Line: 2544

  l_update_shipping_index := p_update_shipping_tbl.FIRST;
Line: 2546

  WHILE l_update_shipping_index IS NOT NULL
  LOOP

    IF  p_update_shipping_tbl(l_update_shipping_index).request_type
                                  = OE_GLOBALS.G_UPDATE_SHIPPING
    THEN

      l_update_lines_index := l_update_lines_index + 1;
Line: 2554

      l_update_lines_tbl(l_update_lines_index)
                                  := p_update_shipping_tbl(l_update_shipping_index);
Line: 2559

    l_update_shipping_index := p_update_shipping_tbl.NEXT(l_update_shipping_index);
Line: 2563

  OE_Shipping_Integration_PVT.Update_Shipping_From_OE
  ( p_update_lines_tbl    =>  l_update_lines_tbl,
    x_return_status       =>  x_return_status);
Line: 2570

    l_update_shipping_index := p_update_shipping_tbl.FIRST;
Line: 2571

    WHILE l_update_shipping_index IS NOT NULL
    LOOP

    IF  p_update_shipping_tbl(l_update_shipping_index).request_type
                                     = OE_GLOBALS.G_UPDATE_SHIPPING
    THEN

      IF  NOT(p_line_id = p_update_shipping_tbl(l_update_shipping_index).entity_id AND
              p_operation
          = p_update_shipping_tbl(l_update_shipping_index).request_unique_key1)
      THEN

        oe_debug_pub.add
        ('deleting req '|| p_update_shipping_tbl(l_update_shipping_index).entity_id);
Line: 2586

        OE_Delayed_Requests_PVT.Delete_Request
        (p_entity_code => p_update_shipping_tbl(l_update_shipping_index).entity_code
        ,p_entity_id   => p_update_shipping_tbl(l_update_shipping_index).entity_id
        ,p_request_Type => p_update_shipping_tbl(l_update_shipping_index).request_type
        ,p_request_unique_key1
               => p_update_shipping_tbl(l_update_shipping_index).request_unique_key1
        ,x_return_status => x_return_status);
Line: 2598

    l_update_shipping_index := p_update_shipping_tbl.NEXT(l_update_shipping_index);
Line: 2606

  OE_Debug_PUB.Add('Exiting OE_Delayed_Requests_Util.Update_Shipping',1);
Line: 2616

        , 'Update_Shipping'
        );
Line: 2620

END Update_Shipping;
Line: 2654

				OE_Delayed_Requests_PVT.Delete_Request
				(p_entity_code 	=> p_ship_confirmation_tbl(l_shipping_index).entity_code
                	,p_entity_id     	=> p_ship_confirmation_tbl(l_shipping_index).entity_id
                	,p_request_Type    	=> p_ship_confirmation_tbl(l_shipping_index).request_type
                	,p_request_unique_key1	=> p_ship_confirmation_tbl(l_shipping_index).request_unique_key1
			 	,x_return_status   	=> x_return_status);
Line: 2747

, p_deleted_options_tbl IN OE_Order_PUB.request_tbl_type
, p_updated_options_tbl IN OE_Order_PUB.request_tbl_type
, x_return_status OUT NOCOPY VARCHAR2

)
IS
l_return_status       VARCHAR2(1);
Line: 2763

   select booked_flag
   into l_complete_flag
   from oe_order_lines
   where line_id = p_top_model_line_id;
Line: 2773

             p_deleted_options_tbl => p_deleted_options_tbl,
             p_updated_options_tbl => p_updated_options_tbl,
             p_validate_flag       => 'Y',
             p_complete_flag       => l_complete_flag,
             x_valid_config        => l_valid_config,
             x_complete_config     => l_complete_config,
             x_return_status       => l_return_status);
Line: 2970

/* procedure insert_rma_options_included
   to insert options and included items
   for the corresponding RMA lines.
*/
Procedure INSERT_RMA_OPTIONS_INCLUDED
(p_line_id IN NUMBER
,x_return_status OUT NOCOPY VARCHAR2

)
IS

l_number               	     NUMBER := 0;
Line: 2982

l_api_name 		          CONSTANT VARCHAR(30) := 'INSERT_RMA_OPTIONS_INCLUDED';
Line: 3002

     SELECT l.header_id, l.line_id, l.ordered_quantity
	 FROM oe_order_lines l,mtl_system_items m
     WHERE l.top_model_line_id = l_top_model_line_id
     AND nvl(l.ato_line_id,1) 	= nvl(l_ato_line_id,nvl(l.ato_line_id,1))
     AND l.link_to_line_id = nvl(l_link_to_line_id,l.link_to_line_id)
	 AND line_id <> l_reference_line_id
     AND l.header_id 	= l_header_id
	 AND l.inventory_item_id = m.inventory_item_id
	 AND nvl(m.returnable_flag,'Y') = 'Y'
     AND nvl(l.cancelled_flag,'N') = 'N'
	 AND m.organization_id =
        OE_Sys_Parameters.VALUE_WNPS('MASTER_ORGANIZATION_ID')
        ORDER BY LINE_NUMBER , SHIPMENT_NUMBER ,NVL(OPTION_NUMBER, -1),
        NVL(COMPONENT_NUMBER,-1),NVL(SERVICE_NUMBER,-1);
Line: 3022

  OE_DEBUG_PUB.ADD('Entering INSERT_RMA_OPTIONS_INCLUDED',1);
Line: 3076

	  select oe_sets_s.nextval into l_fulfillment_set_id from dual;
Line: 3078

       insert into oe_sets
          ( SET_ID, SET_NAME, SET_TYPE, HEADER_ID, SHIP_FROM_ORG_ID,
               SHIP_TO_ORG_ID,SCHEDULE_SHIP_DATE, SCHEDULE_ARRIVAL_DATE,
               FREIGHT_CARRIER_CODE, SHIPPING_METHOD_CODE,
               SHIPMENT_PRIORITY_CODE, SET_STATUS,
               CREATED_BY, CREATION_DATE, UPDATED_BY, UPDATE_DATE,
               UPDATE_LOGIN, INVENTORY_ITEM_ID,ORDERED_QUANTITY_UOM,
               LINE_TYPE_ID,SHIP_TOLERANCE_ABOVE, SHIP_TOLERANCE_BELOW)
       values
          ( l_fulfillment_set_id, to_char(l_fulfillment_set_id),
               'FULFILLMENT_SET',l_orig_line_rec.header_id,
			null,null, null,null,null,
               null,null,null, 0,sysdate,0, sysdate,
               0,null,null,null,null,null
          );
Line: 3094

        Insert into oe_line_sets(Line_id, Set_id, SYSTEM_REQUIRED_FLAG)
        Values (p_line_id, l_fulfillment_set_id, 'Y');
Line: 3201

   	     -- Insert into Fulfillment set
          Insert into oe_line_sets(Line_id, Set_id, SYSTEM_REQUIRED_FLAG)
          Values (l_line_tbl(I).line_id, l_fulfillment_set_id, 'Y');
Line: 3205

   		-- Insert RMA Sales Credits and Adjustments
		INSERT_RMA_SCREDIT_ADJUSTMENT
                 ( x_return_status      => l_return_status
                  ,p_line_id            => l_line_tbl(I).line_id
                 );
Line: 3211

   		-- Insert RMA Lot and Serial Numbers
		INSERT_RMA_LOT_SERIAL
                 ( x_return_status      => l_return_status
                  ,p_line_id            => l_line_tbl(I).line_id
                 );
Line: 3222

  END IF; /* end inserting lines */
Line: 3224

  OE_DEBUG_PUB.ADD(' Exiting INSERT_RMA_OPTIONS_INCLUDED',1);
Line: 3243

            ,   'INSERT_RMA_OPTIONS_INCLUDED'
            );
Line: 3247

END INSERT_RMA_OPTIONS_INCLUDED;
Line: 3249

/* procedure insert_rma_lot_serial
   to insert lot and serial numbers
   for the corresponding RMA lines.
*/
Procedure INSERT_RMA_LOT_SERIAL
(p_line_id        IN NUMBER
,x_return_status OUT NOCOPY VARCHAR2

)
IS

l_number               	     NUMBER := 0;
Line: 3261

l_api_name 		          CONSTANT VARCHAR(30) := 'INSERT_RMA_LOT_SERIAL';
Line: 3287

SELECT decode(msi.lot_control_code,2,'Y','N'),
       decode(msi.serial_number_control_code,2,'Y',5,'Y',6,'Y','N'),
       primary_uom_code
  FROM mtl_system_items msi
 WHERE msi.inventory_item_id = l_inventory_item_id
   AND msi.organization_id =
              OE_Sys_Parameters.VALUE_WNPS('MASTER_ORGANIZATION_ID');
Line: 3299

SELECT u.lot_number,
       ABS(SUM(u.transaction_quantity)) transaction_quantity,
       ABS(SUM(u.secondary_transaction_quantity)) secondary_transaction_quantity -- INVCONV
 FROM  mtl_transaction_lot_numbers u,
       mtl_lot_numbers l,
       mtl_material_transactions m
WHERE  m.transaction_id = u.transaction_id
  AND  u.inventory_item_id = l_inventory_item_id
  AND  m.transaction_source_type_id = 2
  AND  m.trx_source_line_id = l_reference_line_id
  AND  m.ORGANIZATION_ID = l_ship_from_org_id
  AND  m.INVENTORY_ITEM_ID = l_inventory_item_id
  and  u.organization_id=l.organization_id
  and  u.inventory_item_id=l.inventory_item_id
  and  u.lot_number = l.lot_number
GROUP  BY u.lot_number;
Line: 3318

SELECT DISTINCT u.serial_number
  FROM mtl_unit_transactions_all_v u,
       mtl_material_transactions m
 WHERE m.transaction_id = u.transaction_id
   AND m.INVENTORY_ITEM_ID = l_inventory_item_id
   AND u.serial_number = NVL(l_serial_number,u.serial_number)
   AND u.inventory_item_id = l_inventory_item_id
   AND m.transaction_source_type_id = 2
   AND m.trx_source_line_id = l_reference_line_id
   AND m.organization_id = l_ship_from_org_id
   AND m.transaction_action_id = 1
   AND m.transaction_type_id = 33;
Line: 3332

SELECT DISTINCT t.lot_number,
        u.serial_number
 FROM mtl_unit_transactions_all_v u,
      mtl_material_transactions m,
      mtl_transaction_lot_val_v t
WHERE u.serial_number = NVL(l_serial_number,u.serial_number)
  AND u.INVENTORY_ITEM_ID = t.inventory_item_id
  AND t.serial_transaction_id = u.transaction_id
  AND t.INVENTORY_ITEM_ID = m.INVENTORY_ITEM_ID
  AND m.transaction_id = t.transaction_id
  AND m.transaction_source_type_id = 2
  AND m.trx_source_line_id = l_reference_line_id
  AND m.ORGANIZATION_ID = l_ship_from_org_id
  AND m.INVENTORY_ITEM_ID = l_inventory_item_id;
Line: 3353

  OE_DEBUG_PUB.ADD(' Entering INSERT_RMA_LOT_SERIAL',1);
Line: 3399

    oe_debug_pub.add('RMA: rma_lot_serial.DELETE_ROW', 2);
Line: 3404

      l_x_Lot_Serial_tbl(I).operation := OE_GLOBALS.G_OPR_DELETE;
Line: 3409

    l_Lot_serial_tbl.DELETE;
Line: 3411

  END IF; /* end delete existing lot serial numbers */
Line: 3551

  END IF; /* end inserting lot serial numbers */
Line: 3592

    l_Lot_serial_tbl.DELETE;
Line: 3594

  OE_DEBUG_PUB.ADD(' Exiting INSERT_RMA_LOT_SERIAL',1);
Line: 3615

            ,   'INSERT_RMA_LOT_SERIAL'
            );
Line: 3619

END INSERT_RMA_LOT_SERIAL;
Line: 3645

       l_line_tbl.DELETE(I);
Line: 3820

         Select list_line_type_code
         Into   l_list_line_type_code
         From   qp_list_lines
         Where  list_line_id = to_number(p_adjust_tbl(I).param3);
Line: 3946

PROCEDURE INSERT_SERVICE_FOR_OPTIONS
(p_serviced_line_id  IN NUMBER
,x_return_status OUT NOCOPY VARCHAR2

)

IS

l_number                      NUMBER := 0;
Line: 3955

l_api_name                    CONSTANT VARCHAR(30) := 'INSERT_SERVICE_FOR_OPTIONS';
Line: 4004

     SELECT max(l.service_number) service_number
	FROM   oe_order_lines l
     WHERE  l.header_id = l_header_id
     AND    l.line_number   = l_line_number
     AND    l.shipment_number = l_shipment_number
     AND    nvl(l.option_number,0) = nvl(l_option_number,0)
     AND    nvl(l.component_number,0) = nvl(l_component_number,0);
Line: 4014

  OE_DEBUG_PUB.ADD('Entering INSERT_SERVICE_FOR_OPTIONS',1);
Line: 4028

     SELECT /* MOAC_SQL_CHANGE */ h.order_number
     INTO   l_order_number
     FROM   oe_order_headers_all h, oe_order_lines l
     WHERE  h.header_id = l.header_id
     AND    h.header_id = l_orig_line_rec.header_id
	AND    rownum = 1;
Line: 4055

	  SELECT l.header_id,
		  l.line_id,
		  l.shipment_number,
		  l.line_number,
		  l.option_number,
                  l.component_number,
		  l.service_txn_reason_code,
		  l.service_txn_comments,
		  l.service_duration,
		  l.service_period,
		  l.service_start_date,
		  l.service_end_date,
		  l.service_coterminate_flag,
		  l.ordered_quantity
	  FROM   oe_order_lines l
	  WHERE  l.top_model_line_id = l_service_reference_line_id
	  AND    l.item_type_code = 'INCLUDED'
	  AND    exists (select null from mtl_system_items mtl where
		    mtl.inventory_item_id = l.inventory_item_id and
		    mtl.serviceable_product_flag = 'Y' and
			 mtl.organization_id=OE_SYS_PARAMETERS.VALUE('MASTER_ORGANIZATION_ID') );
Line: 4079

	  SELECT l.header_id,
		  l.line_id,
		  l.shipment_number,
		  l.line_number,
		  l.option_number,
                  l.component_number,
		  l.service_txn_reason_code,
		  l.service_txn_comments,
		  l.service_duration,
		  l.service_period,
		  l.service_start_date,
		  l.service_end_date,
		  l.service_coterminate_flag,
		  l.ordered_quantity
	  FROM   oe_order_lines l
	  WHERE  l.top_model_line_id = l_service_reference_line_id
          AND    l.top_model_line_id <> l.line_id     -- For bug 2938790
	  AND    l.item_type_code in ('INCLUDED','CLASS','OPTION', 'KIT') -- For bug 2447402
	  AND    exists (select null from mtl_system_items mtl where
			 mtl.inventory_item_id = l.inventory_item_id and
			 mtl.serviceable_product_flag = 'Y' and
			 mtl.organization_id=OE_SYS_PARAMETERS.VALUE('MASTER_ORGANIZATION_ID') );
Line: 4246

	l_line_tbl.DELETE;
Line: 4247

   END IF;  /* End inserting lines */
Line: 4248

  OE_DEBUG_PUB.ADD('Exiting INSERT_SERVICE_FOR_OPTIONS',1);
Line: 4269

            ,  'INSERT_SERVICE_FOR_OPTIONS'
            );
Line: 4273

END INSERT_SERVICE_FOR_OPTIONS;
Line: 4305

   SELECT l.header_id,
          l.line_id,
          l.service_txn_reason_code,
          l.service_txn_comments,
          l.service_duration,
          l.service_period,
          l.service_start_date,
	  l.service_end_date,
	  l.service_coterminate_flag,
          l.order_quantity_uom,
          l.inventory_item_id
   FROM oe_order_lines l
   where l.service_reference_line_id=l_top_model_line_id
   and l.item_type_code = 'SERVICE'
   and l.service_reference_type_code = 'ORDER';
Line: 4322

     SELECT max(l.service_number) service_number
	FROM   oe_order_lines l
     WHERE  l.header_id = l_header_id
     AND    l.line_number   = l_line_number
     AND    l.shipment_number = l_shipment_number
     AND    nvl(l.option_number,0) = nvl(l_option_number,0)
     AND    nvl(l.component_number,0) = nvl(l_component_number,0);    --bug 2447402
Line: 4345

     SELECT /* MOAC_SQL_CHANGE */ h.order_number
     INTO   l_order_number
     FROM   oe_order_headers_all h, oe_order_lines l
     WHERE  h.header_id = l.header_id
     AND    h.header_id = l_orig_line_rec.header_id
	AND    rownum = 1;
Line: 4463

	l_line_tbl.DELETE;
Line: 4464

   END IF;  /* End inserting lines */
Line: 4593

             when new lines are inserted to a SCHEDULE SET. A set being
             a user defined ship or arrival set, or a system defined
             ATO or SMC PTO model. When multiple lines are inserted
             to the same set, this procedure is called once for all the
             lines of the set.
-------------------------------------------------------------------*/
Procedure Schedule_Line
( p_sch_set_tbl     IN  OE_ORDER_PUB.request_tbl_type
, x_return_status OUT NOCOPY VARCHAR2)

IS
l_ship_set_id        NUMBER := null;
Line: 4645

      l_line_rec.operation             :=  OE_GLOBALS.G_OPR_UPDATE;
Line: 4685

                     SELECT ship_set_id,arrival_set_id
                     INTO l_ship_set_id,l_arrival_set_id
                     FROM oe_order_lines_all
                     WHERE line_id = l_line_rec.ato_line_id;
Line: 4883

                 UPDATE OE_ORDER_LINES_ALL
                 SET
                     (SCHEDULE_SHIP_DATE,
                      SCHEDULE_ARRIVAL_DATE,
                      SHIP_FROM_ORG_ID,
                      SHIP_SET_ID,
                      ARRIVAL_SET_ID) =
                     (SELECT null,
                             null,
                             decode(re_source_flag,'Y',ship_from_org_id,null),
                             null,
                             null
                      FROM OE_ORDER_LINES_ALL
                      WHERE line_id=l_line_rec.line_id)
                 WHERE line_id = l_line_rec.line_id;
Line: 4900

                 UPDATE OE_ORDER_LINES_ALL
                 SET
                     SCHEDULE_SHIP_DATE    = l_old_line_rec.schedule_ship_date,
                     SCHEDULE_ARRIVAL_DATE = l_old_line_rec.schedule_arrival_date,
                     SHIP_FROM_ORG_ID      = l_old_line_rec.ship_from_org_id,
                     SHIP_SET_ID           = null,
                     ARRIVAL_SET_ID        = null
                 WHERE line_id = l_line_rec.line_id;
Line: 5071

	   SELECT /* MOAC_SQL_CHANGE */ l.header_id,
	       l.tax_value,
	       l.ship_to_org_id,
	       l.unit_selling_price,
               l.tax_date,
               l.inventory_item_id,
               l.tax_exempt_flag,
               l.tax_exempt_number,
               l.tax_exempt_reason_code,
               l.invoicing_rule_id,
               l.fob_point_code,
               l.ordered_quantity,
               l.ship_from_org_id,
               l.payment_term_id,
               l.tax_code,
               l.salesrep_id,
               l.invoice_to_org_id,
               l.line_type_id,
               l.request_date,
               l.org_id,
               h.conversion_rate,
               h.transactional_curr_code,
               l.global_attribute5,
               l.global_attribute6,
               l.commitment_id,
               l.line_category_code,
               l.shipped_quantity,
	       h.payment_type_code,
               h.booked_flag,
               l.orig_sys_document_ref,
               l.orig_sys_line_ref,
               l.order_source_id,
               l.orig_sys_shipment_ref,
               l.change_sequence,
               l.source_document_type_id,
               l.source_document_id,
               l.source_document_line_id,
               l.actual_shipment_date,
               l.schedule_ship_date,
               l.pricing_quantity_uom,
               l.order_quantity_uom,
               l.user_item_description,
               l.global_attribute_category
	   INTO   l_header_id,
	       l_tax_value,
	       l_ship_to_org_id,
	       l_unit_selling_price,
               l_tax_date,
               l_inventory_item_id,
               l_tax_exempt_flag,
               l_tax_exempt_number,
               l_tax_exempt_reason_code,
               l_invoicing_rule_id,
               l_fob_point_code,
               l_ordered_quantity,
               l_ship_from_org_id,
               l_payment_term_id,
               l_tax_classification_code,
               l_salesrep_id,
               l_invoice_to_org_id,
               l_line_type_id,
               l_request_date,
               l_org_id,
               l_conversion_rate,
               l_currency_code,
               l_global_attribute5,
               l_global_attribute6,
               l_commitment_id,
               l_line_category_code,
               l_shipped_quantity,
	       l_payment_type_code,
               l_booked_flag,
               l_orig_sys_doc_ref,
               l_orig_sys_line_ref,
               l_order_src_id,
               l_orig_sys_shipment_ref,
               l_change_sequence,
               l_source_document_type_id,
               l_source_document_id,
               l_source_document_line_id,
               l_actual_shipment_date,
               l_schedule_ship_date,
               l_pricing_quantity_uom,
               l_order_quantity_uom,
               l_user_item_description,
               l_global_attribute_category
	   FROM OE_ORDER_HEADERS h,
		   OE_ORDER_LINES_all l
	   WHERE l.HEADER_ID = h.HEADER_ID
	   AND l.LINE_ID = l_line_id;
Line: 5239

        l_tax_rec_out_tbl.delete; /* initializing the l_tax_rec_out_tbl */
Line: 5278

            oe_debug_pub.add('Updateing tax value from '||to_char(l_tax_value)|| ' To ' ||to_char(new_tax_value) ,2);
Line: 5280

		  UPDATE OE_ORDER_LINES_ALL
		  SET TAX_VALUE = new_tax_value
		  WHERE line_id = l_line_id;
Line: 5413

            l_l_line_adj_tbl.delete; /* initializing l_l_line_adj_tbl */
Line: 5427

                   l_l_line_adj_tbl.delete;
Line: 5462

				   l_l_line_adj_tbl(J).OPERATION <> OE_GLOBALS.G_OPR_UPDATE
	               THEN
				  -- Set the Match flag
                      l_match_flag := 'Y';
Line: 5467

                             l_l_line_adj_tbl(J).OPERATION :=OE_GLOBALS.G_OPR_UPDATE;
Line: 5479

				      UPDATE OE_PRICE_ADJUSTMENTS
				      SET ADJUSTED_AMOUNT =
						    l_tax_rec_out_tbl(I).tax_amount,
                               OPERAND = l_tax_rec_out_tbl(I).tax_rate,
                               tax_Rate_id = l_tax_rec_out_tbl(I).tax_rate_id,
						 LAST_UPDATE_DATE  = sysdate,
					      LAST_UPDATED_BY   = FND_GLOBAL.USER_ID,
					      LAST_UPDATE_LOGIN = FND_GLOBAL.LOGIN_ID

                          WHERE price_adjustment_id =
						    l_l_line_adj_tbl(J).price_adjustment_id;
Line: 5492

										  OE_GLOBALS.G_OPR_UPDATE;
Line: 5501

			   select OE_PRICE_ADJUSTMENTS_S.nextval
			   INTO l_price_adjustment_id
			   FROM DUAL;
Line: 5507

                  l_Line_adj_rec.last_update_date := SYSDATE;
Line: 5508

                  l_Line_adj_rec.last_updated_by := FND_GLOBAL.USER_ID;
Line: 5509

                  l_Line_adj_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
Line: 5516

                    oe_debug_pub.add('Inserting the Adj record '||
					   to_char(l_line_adj_rec.price_adjustment_id),2);
Line: 5526

                  OE_LINE_ADJ_UTIL.INSERT_ROW(p_Line_Adj_rec =>
										  l_line_adj_rec);
Line: 5553

				DELETE FROM OE_PRICE_ADJUSTMENTS
				WHERE PRICE_ADJUSTMENT_ID =
					l_l_line_adj_tbl(J).price_adjustment_id;
Line: 5564

        l_tax_rec_out_tbl.delete;
Line: 5565

        l_l_line_adj_tbl.delete;
Line: 5583

    l_tax_rec_out_tbl.delete;
Line: 5584

    l_l_line_adj_tbl.delete;
Line: 5593

          l_tax_rec_out_tbl.delete;
Line: 5594

          l_l_line_adj_tbl.delete;
Line: 5598

          l_tax_rec_out_tbl.delete;
Line: 5599

          l_l_line_adj_tbl.delete;
Line: 5603

          l_tax_rec_out_tbl.delete;
Line: 5604

          l_l_line_adj_tbl.delete;
Line: 5620

        l_tax_rec_out_tbl.delete;
Line: 5621

        l_l_line_adj_tbl.delete;
Line: 5641

**--Update the Internal Sales Order with the Req header id, Req line Ids, Req number and line numbers.
**--Check for return status
**--Handle Exceptions
 */
l_int_req_Ret_sts varchar2(1);
Line: 5659

SELECT  created_by
       ,org_id
FROM    OE_ORDER_HEADERS
WHERE   header_id = p_header_id;
Line: 5665

SELECT  line_id
        ,order_quantity_uom
        ,ordered_quantity
        ,sold_to_org_id
        ,inventory_item_id
        ,schedule_ship_date
        ,org_id
        ,ship_from_org_id
        ,subinventory
        ,source_document_id
        ,source_document_line_id
        ,item_type_code
FROM    OE_ORDER_LINES
WHERE   header_id = p_header_id;
Line: 5681

SELECT employee_id
FROM fnd_user
WHERE user_id = p_user_id;
Line: 5686

SELECT b.location_id,
       b.organization_id
FROM hz_party_sites_V a
    ,PO_LOCATION_ASSOCIATIONS b
WHERE a.party_site_use_id =  b.SITE_USE_ID
and b.customer_id = p_cust_id
and primary_per_type = 'Y'
and site_use_type = 'SHIP_TO';
Line: 5794

        Update OE_Order_Headers
        set source_document_Id = l_req_header_rec.requisition_header_id
            ,orig_sys_document_ref = l_req_header_rec.segment1
            ,source_document_type_id = OE_GLOBALS.G_ORDER_SOURCE_INTERNAL -- i.e 10  for internal
            ,order_source_id         = OE_GLOBALS.G_ORDER_SOURCE_INTERNAL --i.e 10 for internal
        Where header_id = p_ord_header_id;
Line: 5800

        oe_debug_pub.add('auto_create_internal_req after hdr update ',2);
Line: 5807

                Update Oe_Order_lines
                Set    source_document_id = l_req_header_rec.requisition_header_id
                       ,source_document_line_id = l_req_line_tbl(k).requisition_line_id
                       ,source_document_type_id = OE_GLOBALS.G_ORDER_SOURCE_INTERNAL -- i.e 10  for internal
                       ,orig_sys_document_ref=  l_req_header_rec.segment1
                       ,orig_sys_line_ref = l_req_line_tbl(k).line_num
                where oe_order_lines.line_id = l_req_line_tbl(k).source_doc_line_reference;
Line: 5817

       oe_debug_pub.add('auto_create_internal_req after line update ',2);
Line: 5874

     SELECT return.price_request_code,
            referenced.pricing_quantity,
            referenced.price_request_code
     FROM   OE_ORDER_LINES_ALL return , OE_ORDER_LINES_ALL referenced
     WHERE  return.line_id = p_line_id
            and referenced.line_id = return.reference_line_id;
Line: 5883

     SELECT parent.header_id,
            parent.pricing_quantity,
            parent.line_id
     FROM   OE_ORDER_LINES_ALL child, OE_ORDER_LINES_ALL parent
     WHERE  child.line_id = p_line_id
        and parent.line_id = child.split_from_line_id;
Line: 5984

       update oe_order_lines_All
       set price_request_code = l_ret_price_request_code
       where line_id = p_line_id;
Line: 6058

SELECT order_source_id, orig_sys_document_ref, sold_to_org_id, change_sequence
INTO l_order_source_id, l_orig_sys_document_ref, l_sold_to_org_id, l_change_sequence
FROM oe_order_headers
WHERE header_id=l_header_id;
Line: 6182

      select OE_XML_MESSAGE_SEQ_S.nextval
      into l_itemkey
      from dual;
Line: 6197

   Insert Into OE_HEADER_ACKS (header_id, acknowledgment_type, last_ack_code, request_id, sold_to_org_id, change_sequence)
   Values (l_header_id, l_acknowledgment_type, l_flow_status_code, l_itemkey,
           l_sold_to_org_id, l_change_sequence);
Line: 6202

          oe_debug_pub.add(  'AFTER HEADER INSERT') ;
Line: 6268

      OE_Delayed_Requests_PVT.G_Delayed_Requests.Delete(l_count_old);
Line: 6286

       oe_debug_pub.add(  'BEFORE BULK INSERT OF LINES') ;
Line: 6290

        INSERT INTO OE_LINE_ACKS
            (header_id
            ,line_id
            ,acknowledgment_type
            ,last_ack_code
            ,request_id
            ,sold_to_org_id
            ,change_sequence)
        VALUES
            (l_bulk_line_rec.header_id(j)
            ,l_bulk_line_rec.line_id(j)
            ,l_acknowledgment_type
            ,l_bulk_line_rec.last_ack_code(j)
            ,l_bulk_line_rec.request_id(j)
            ,l_bulk_line_rec.sold_to_org_id(j)
            ,l_bulk_line_rec.change_sequence(j)
            );
Line: 6309

       oe_debug_pub.add(  'AFTER BULK INSERT OF LINES') ;
Line: 6467

Procedure Name : Update_Requisition_Info
Input Params   : P_Header_id - Primary key of the order header
                 P_Line_id - Primary key of the order line. This parameter
                             will be null for order header cancellation
                 P_Requisition_Header_id - Primary key of the requisition
                                           header
                 P_Requisition_Line_id - Primary key of the requisition line
                 p_Line_ids - String variable containing line_ids delimited
                              by comma ?Q,?R. Will be populated only if it is
                              a partial order cancellation
                 p_num_records - Number of total order line records cancelled
                                 while processing partial order cancellation
                 P_Quantity_Change - It will denote net change in order quantity
                                     with respective single requisition line.
                                     If it is greater than 0 then it is an
                                     increment in the quantity, while if it is
                                     less than 0 then it is a decrement in the
                                     ordered quantity. If it is 0 then it
                                     indicates there is no change in ordered
                                     quantity value
                 P_New_Schedule_Ship_Date - It will denote the change in
                                            Schedule Ship Date
                 P_Cancel_Order - It will denote whether internal sales order
                                  is cancelled or not. If it is cancelled then
                                  respective Purchasing api will be called to
                                  trigger the requisition header cancellation.
Output Params  : X_Return_Status - The return status of the API
                                   (Expected/Unexpected/Success)
Brief Description : This program unit is added for IR ISO Change
                    management project, so as to trigger the new
                    program unit OE_Process_Requisition_Pvt.Updat
                    e_Internal_Requisition introduced as part of
                    this project, and responsible for calling several
                    Purchasing APIs based on the action performed
                    on the internal sales order header/line.

                    Possible actions can be:
                       Header Level FULL Cancellation
                       Header Level PARTIAL Cancellation
                       Line Level Cancellation
                       Line Ordered Quantity update
                       Line Schedule Ship/Arrival Date update
                       Line Ordered Quantity and Schedule Ship/Arrival
                       Date update

-- For details on IR ISO CMS project, please refer to FOL >
-- OM Development > OM GM > 12.1.1 > TDD > IR_ISO_CMS_TDD.doc
*/

Procedure Update_Requisition_Info -- Package Body
( p_header_id              IN NUMBER    -- Param5 or Entity id
, p_line_id                IN NUMBER   -- Entity id
, P_Line_ids               IN VARCHAR2 -- Long_Param1
, P_num_records            IN NUMBER   -- Param6
, P_Requisition_Header_id  IN NUMBER    -- Param3
, P_Requisition_Line_id    IN NUMBER DEFAULT NULL   -- Param4
, P_Quantity_Change        IN NUMBER DEFAULT NULL   -- Param1
, P_New_Schedule_Ship_Date IN DATE -- Date_Param1
, P_Cancel_order           IN BOOLEAN -- Param2
, x_return_status OUT NOCOPY varchar2
)
IS
--
l_return_status       VARCHAR2(30);
Line: 6541

    oe_debug_pub.ADD('Entering delayed request utility for Update_Requisition_Info',1);
Line: 6544

    oe_debug_pub.ADD(' Number of shipment Lines updated '||p_num_records,5);
Line: 6567

      select nvl(ordered_quantity,0)
      into   l_new_ord_quantity
      from   oe_order_lines_all
      where  line_id = p_line_id;
Line: 6580

  OE_Process_Requisition_Pvt.Update_Internal_Requisition
  ( P_Header_id               => p_header_id
  , P_Line_id                 => p_line_id
  , p_line_ids                => p_line_ids
  , p_num_records             => p_num_records
  , P_Req_Header_id           => P_Requisition_Header_id
  , P_Req_Line_id             => P_Requisition_Line_id
  , P_Quantity_Change         => P_Quantity_Change
  , P_New_Schedule_Ship_Date  => l_New_Schedule_Ship_Date
  , P_Cancel_Order            => P_Cancel_order
  , P_Cancel_line             => l_cancel_line
  , X_msg_count               => l_msg_count
  , X_msg_data                => l_msg_data
  , X_return_status           => l_return_status
  );
Line: 6605

    oe_debug_pub.ADD('Exiting delayed request utility for Update_Requisition_Info',1);
Line: 6617

      , 'Update_Requisition_Info'
      );
Line: 6620

END Update_Requisition_Info;