DBA Data[Home] [Help]

APPS.WMS_RULES_WORKBENCH_PVT SQL Statements

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

Line: 106

g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 115

		 SELECT criterion_name
		    INTO l_return_type_name
		 FROM wms_crossdock_criteria_vl
		 WHERE  criterion_id=p_return_type_id
		 AND criterion_type = 1  ;
Line: 122

		 SELECT criterion_name
		    INTO l_return_type_name
		 FROM wms_crossdock_criteria_vl
		 WHERE  criterion_id=p_return_type_id
		 AND criterion_type = 2;
Line: 129

		SELECT cost_group
		INTO l_return_type_name
		FROM  CST_COST_GROUPS
		WHERE cost_group_id=p_return_type_id
		AND organization_id = p_org_id;
Line: 136

      SELECT meaning
      INTO l_return_type_name
      FROM mfg_lookups_v
      WHERE lookup_type = 'WMS_CARTONIZATION_ALGORITHMS'
      AND lookup_code = p_return_type_id;
Line: 146

      select distinct name into l_return_type_name
        from wms_strategies_vl
       where organization_id in (p_org_id, -1)
          and type_code   = p_rule_type_code
          and strategy_id = p_return_type_id;
Line: 153

        select name into l_return_type_name
        from wms_rules_vl
       where organization_id in (p_org_id, -1)
         and rule_id = p_return_type_id;
Line: 176

  g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 182

 /*select rc.customer_name
   into l_customer_name
        from ra_customers      rc
        where rc.customer_id  = p_customer_id;*/
Line: 187

/*   SELECT  distinct substrb ( PARTY.PARTY_NAME,  1,  50 )
     INTO l_customer_name
     FROM HZ_PARTIES PARTY,
          HZ_CUST_ACCOUNTS CUST_ACCT
   WHERE  CUST_ACCT.PARTY_ID = PARTY.PARTY_ID
    AND  PARTY.PARTY_ID = p_customer_id;   */
Line: 195

    SELECT  distinct substrb ( PARTY.PARTY_NAME,  1,  50 )
     INTO l_customer_name
     FROM HZ_PARTIES PARTY,
          HZ_CUST_ACCOUNTS CUST_ACCT
   WHERE  CUST_ACCT.PARTY_ID = PARTY.PARTY_ID
    AND CUST_ACCT.CUST_ACCOUNT_ID  = p_customer_id;
Line: 215

g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 222

select ood.organization_code
  into l_organization_code
          from org_organization_definitions ood
         where sysdate < nvl(ood.disable_date,sysdate+1)
           and ood.organization_id = p_organization_id ;
Line: 240

 g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 246

 select ofv.freight_code_tl
  into l_freight_code_name
   from org_freight ofv
  where ofv.organization_id = p_org_id
    and ofv.freight_code    = p_freight_code
    and sysdate < nvl(ofv.disable_date,sysdate+1);
Line: 266

 g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 273

select msik.concatenated_segments into l_item
from mtl_system_items_kfv msik
where msik.organization_id = p_org_id
  and msik.inventory_item_id = p_inventory_item_id;
Line: 291

  g_pkg_name constant 	VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 298

      select maag.assignment_group_name||' / '|| mac.abc_class_name
        into l_abc_group_class
      from mtl_abc_classes mac,
           mtl_abc_assignment_groups maag ,
           MTL_ABC_ASSGN_GROUP_CLASSES magc
      where  maag.organization_id 	= mac.organization_id
        and  magc.assignment_group_id 	= maag.assignment_group_id
        and  magc.abc_class_id 		= mac.abc_class_id
        and  mac.organization_id 	= p_org_id
        and  maag.assignment_group_id 	= p_assignment_group_id
        and  mac.abc_class_id 		= p_class_id ;
Line: 323

 g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 331

 Select mcs.category_set_name||' / '||mck.concatenated_segments into l_category_set_name
   From mtl_categories_kfv mck
       ,mtl_category_sets_vl mcs
       ,mtl_category_set_valid_cats mcsvc
  Where mcs.category_set_id = mcsvc.category_set_id
    and mck.category_id = mcsvc.category_id
    and mcsvc.category_set_id = p_category_set_id
    and mcsvc.category_id =  p_category_id; */
Line: 342

SELECT mcs.CATEGORY_SET_NAME||' / '|| mck.CONCATENATED_SEGMENTS  into l_category_set_name
    FROM MTL_CATEGORIES_KFV mck
    ,MTL_CATEGORIES_VL mc
    ,MTL_CATEGORY_SETS_VL mcs
    ,( SELECT mic.ORGANIZATION_ID
    ,mic.CATEGORY_SET_ID
    ,mic.CATEGORY_ID
    FROM MTL_ITEM_CATEGORIES mic
    WHERE mic.ORGANIZATION_ID = p_org_id
    GROUP BY mic.ORGANIZATION_ID
    ,mic.CATEGORY_SET_ID
    ,mic.CATEGORY_ID ) x
    WHERE mcs.CATEGORY_SET_ID = x.CATEGORY_SET_ID
    AND mc.CATEGORY_ID = mck.CATEGORY_ID
    AND mck.CATEGORY_ID = x.CATEGORY_ID
    AND x.CATEGORY_SET_ID = p_category_set_id
    AND x.CATEGORY_ID =  p_category_id;
Line: 371

 g_pkg_name constant   VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 378

select ottv.name into l_order_type_name
  from oe_transaction_types_vl ottv
 where ottv.transaction_type_id = p_transaction_type_id;
Line: 392

 g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 399

 select  distinct ppov.project_name into l_project_name
  from pjm_projects_mtll_v ppov
 where ppov.project_id = p_project_id;
Line: 414

 g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 422

 SELECT  nvl(p.project_number, '') || ' / ' || nvl(ptev.TASK_NUMBER, '')   into l_task_name
 FROM  pjm_tasks_mtll_v  ptev,  pjm_projects_mtll_v p
 where p.project_id = ptev.project_id
   and ptev.project_id  =  p_project_id
   and ptev.task_id  = p_task_id;
Line: 428

/* select ppev.project_name||' / '||ptev.indented_task_name
  into l_task_name
  from pa_tasks_expend_v ptev
      ,pa_projects_expend_v ppev
 where ptev.project_id = ppev.project_id
   and ppev.project_id = p_project_id
   and ptev.task_id    = p_task_id; */
Line: 447

 g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 454

  SELECT  pv.vendor_name
    INTO  l_vendor_name
    FROM PO_VENDORS pv
	,PO_VENDOR_SITES_ALL pvsa
	,ORG_ORGANIZATION_DEFINITIONS ood
   WHERE ood.ORGANIZATION_ID =  p_org_id
     AND nvl(pvsa.ORG_ID,-99) = nvl(ood.OPERATING_UNIT,-99)
     AND pvsa.PURCHASING_SITE_FLAG = 'Y'
     AND sysdate < nvl(pvsa.INACTIVE_DATE, sysdate + 1)
     AND pv.VENDOR_ID = pvsa.VENDOR_ID
     AND pvsa.vendor_id  = p_vendor_id
   GROUP BY pv.VENDOR_NAME;
Line: 478

 g_pkg_name constant VARCHAR2(50)   := 'wms_selection_criteria_pvt';
Line: 485

  select fu.user_name
    into l_user_name
    from fnd_user fu
   where sysdate < nvl(fu.end_date,sysdate+1)
     and fu.user_id = p_user_id;
Line: 501

 g_pkg_name constant 		VARCHAR2(50)   	:= 'WMS_SELECTION_CRITERIA_PVT';
Line: 508

 select ml.meaning
   into l_transaction_action_name
   from mfg_lookups ml
  where ml.lookup_type = 'MTL_TRANSACTION_ACTION'
    and ml.lookup_code = p_transaction_action_id ;
Line: 525

 g_pkg_name constant 	VARCHAR2(50)   	:= 'WMS_SELECTION_CRITERIA_PVT';
Line: 532

  select mtr.reason_name
    into l_reason_name
  from mtl_transaction_reasons mtr
  where sysdate < nvl(mtr.disable_date,sysdate+1)
    and mtr.reason_id = p_reason_id;
Line: 548

 g_pkg_name constant 		VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 555

   select mtst.transaction_source_type_name
     into l_transaction_source_name
     from mtl_txn_source_types mtst
    where sysdate < nvl(mtst.disable_date,sysdate+1)
      and mtst.transaction_source_type_id =  p_transaction_source_type_id;
Line: 571

 g_pkg_name constant 		VARCHAR2(50)   	:= 'WMS_SELECTION_CRITERIA_PVT';
Line: 578

  select mtt.transaction_type_name
    into l_transaction_type_name
    from mtl_transaction_types mtt
   where sysdate < nvl(mtt.disable_date,sysdate+1)
     and mtt.transaction_type_id =  p_transaction_type_id;
Line: 595

 g_pkg_name constant 	VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 602

 select muom.unit_of_measure_tl
   into l_unit_of_measure
 from mtl_units_of_measure muom
where sysdate < nvl(muom.disable_date,sysdate+1)
  and muom.uom_code =  p_uom_code;
Line: 618

 g_pkg_name constant 	 VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 625

  select muc.uom_class_tl
    into l_uom_class_name
    from mtl_uom_classes muc
    where muc.uom_class = p_uom_class;
Line: 641

 g_pkg_name constant 	 VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 647

 select ml.meaning into l_item_type
   from fnd_common_lookups ml
where ml.lookup_type = 'ITEM_TYPE'
  and ml.lookup_code = p_item_type_code;
Line: 674

   g_pkg_name constant 	 VARCHAR2(50)    := 'WMS_SELECTION_CRITERIA_PVT';
Line: 681

   l_rec_wsct   WMS_SELECTION_CRITERIA_TXN%ROWTYPE;
Line: 685

   l_sequence_number 		wms_selection_criteria_txn.sequence_number%type;
Line: 686

   l_return_type_code		wms_selection_criteria_txn.return_type_code%type;
Line: 687

   l_return_type_id		wms_selection_criteria_txn.return_type_id%type;
Line: 688

   l_from_organization_id	wms_selection_criteria_txn.from_organization_id%type;
Line: 689

   l_from_subinventory_name	wms_selection_criteria_txn.from_subinventory_name%type default null;
Line: 690

   l_to_organization_id      	wms_selection_criteria_txn.to_organization_id%type;
Line: 691

   l_to_subinventory_name	wms_selection_criteria_txn.to_subinventory_name%type;
Line: 692

   l_customer_id 		wms_selection_criteria_txn.customer_id%type;
Line: 693

   l_freight_code 		wms_selection_criteria_txn.freight_code%type;
Line: 694

   l_inventory_item_id 		wms_selection_criteria_txn.inventory_item_id%type;
Line: 695

   l_item_type 			wms_selection_criteria_txn.item_type%type;
Line: 696

   l_order_type_id		wms_selection_criteria_txn.order_type_id%type;
Line: 697

   l_vendor_id			wms_selection_criteria_txn.vendor_id%type;
Line: 698

   l_project_id			wms_selection_criteria_txn.project_id%type;
Line: 699

   l_task_id			wms_selection_criteria_txn.task_id%type;
Line: 700

   l_user_id			wms_selection_criteria_txn.user_id%type;
Line: 701

   l_transaction_action_id	wms_selection_criteria_txn.transaction_action_id%type;
Line: 702

   l_reason_id 			wms_selection_criteria_txn.reason_id%type;
Line: 703

   l_transaction_source_type_id wms_selection_criteria_txn.transaction_source_type_id%type;
Line: 704

   l_transaction_type_id	wms_selection_criteria_txn.transaction_type_id%type;
Line: 705

   l_uom_code 			wms_selection_criteria_txn.uom_code%type;
Line: 706

   l_uom_class			wms_selection_criteria_txn.uom_class%type default null;
Line: 711

   l_category_id    wms_selection_criteria_txn.category_id%type;
Line: 712

   l_category_set_id  wms_selection_criteria_txn.category_set_id%type;
Line: 713

   l_assignment_group_id  wms_selection_criteria_txn.assignment_group_id%type;
Line: 714

   l_abc_class_id  wms_selection_criteria_txn.abc_class_id%type;
Line: 723

      SELECT line_id FROM (
            select mtrl.line_id,
                   mtrl.organization_id,
                   mtrl.inventory_item_id,
                   mtrl.transaction_source_type_id,
                   mtrl.reference_id,
                   mtrl.reference,
                   mtrl.uom_code
              from mtl_txn_request_lines mtrl
              where mtrl.header_id                        = l_rec_mtrl.header_id
               AND mtrl.organization_id                   = l_from_organization_id
               AND mtrl.line_status                       <> 5
               AND NVL(mtrl.from_subinventory_code,'###') = NVL(l_from_subinventory_name,NVL(mtrl.from_subinventory_code,'###'))
               AND NVL(mtrl.to_organization_id ,-999)     = NVL(l_to_organization_id, NVL(mtrl.to_organization_id,-999))
               AND NVL(mtrl.to_subinventory_code, '###')  = NVL(l_to_subinventory_name, NVL(mtrl.to_subinventory_code,'###'))
               AND mtrl.inventory_item_id                 = NVL(l_inventory_item_id , mtrl.inventory_item_id )
               AND NVL(mtrl.project_id ,-999)             = NVL(l_project_id , NVL(mtrl.project_id ,-999) )
               AND NVL(mtrl.task_id  ,-999)               = NVL(l_task_id , NVL(mtrl.task_id  ,-999) )
               AND NVL(mtrl.reason_id ,-999)              = NVL(l_reason_id ,NVL(mtrl.reason_id ,-999)  )
               AND mtrl.transaction_source_type_id        = NVL(l_transaction_source_type_id,mtrl.transaction_source_type_id)
               AND mtrl.transaction_type_id               = NVL(l_transaction_type_id,mtrl.transaction_type_id)
               AND NVL(mtrl.uom_code,'##')                = NVL(l_uom_code ,nvl(mtrl.uom_code,'##'))
               AND mtrl.last_updated_by	                  = NVL(l_user_id, mtrl.last_updated_by)
               AND (  (p_type_code=2 AND mtrl.pick_strategy_id IS NULL) OR
                      (p_type_code=1 AND mtrl.put_away_strategy_id IS NULL)   ) /*10371674*/
             ) mtrl1
    WHERE ( NVL(l_freight_code,'AAA') = 'AAA' OR
            EXISTS (SELECT  1
                           FROM wsh_delivery_details wdd,
                            wsh_carriers wc,
                            wsh_carrier_services wcs
                            WHERE wdd.move_order_line_id = mtrl1.line_id
                            AND   wdd.ship_method_code = wcs.ship_method_code (+)
                            AND   wcs.carrier_id       = wc.carrier_id (+)
                            AND   wc.freight_code      = l_freight_code
                     )
          )
      AND ( Nvl(l_customer_id, -999) = -999 OR
            EXISTS (SELECT  1  FROM wsh_delivery_details wdd
                               WHERE wdd.move_order_line_id = mtrl1.line_id
                               AND   wdd.customer_id    = l_customer_id
                    )
          )
      AND ( NVL(l_item_type,'1') = '1' OR
            WMS_RULES_WORKBENCH_PVT.get_item_type(mtrl1.organization_id,mtrl1.inventory_item_id) = l_item_type
          )
      AND ( NVL(l_uom_class,'aaa') = 'aaa' OR
            WMS_RULES_WORKBENCH_PVT.get_uom_class(mtrl1.uom_code) = l_uom_class
          )
      AND ( NVL(l_order_type_id,-999)= -999 OR
            WMS_RULES_WORKBENCH_PVT.get_order_type_id(mtrl1.line_id,mtrl1.transaction_source_type_id,mtrl1.reference_id) = l_order_type_id
          )
      AND ( mtrl1.transaction_source_type_id <> 1 OR
            NVL(l_vendor_id,-999) = -999 OR
     	    WMS_RULES_WORKBENCH_PVT.get_vendor_id(mtrl1.reference,mtrl1.reference_id) = l_vendor_id
          )
      AND (l_category_id IS NULL  OR WMS_RULES_WORKBENCH_PVT.get_Item_Cat(mtrl1.organization_id,
									              mtrl1.inventory_item_id,
									              l_category_set_id,
									              l_category_id )='Y'
          )
      AND (l_abc_class_id IS NULL OR WMS_RULES_WORKBENCH_PVT.get_group_class(mtrl1.inventory_item_id,
									              l_assignment_group_id,
									              l_abc_class_id)='Y'
           );
Line: 793

    cursor cur_stg_selection is
      select return_type_code
      ,return_type_id
      ,sequence_number
      ,from_subinventory_name
      ,	to_organization_id
      ,	to_subinventory_name
      ,	Nvl(customer_id,l_customer_id)    --8809951
      ,	Nvl(freight_code,l_freight_code)   --8809951
      , inventory_item_id
      , Nvl(item_type,l_item_type)     --8809951
      , Nvl(order_type_id,l_order_type_id)   --8809951
      , Nvl(vendor_id, l_vendor_id)   --8809951
      ,	project_id
      ,	task_id
      ,	user_id
      ,	transaction_action_id
      ,	reason_id
      ,	transaction_source_type_id
      ,	transaction_type_id
      ,	uom_code
      , Nvl(uom_class, l_uom_class) --8809951
      ,	category_id
      ,	category_set_id
      , assignment_group_id
      ,	abc_class_id
      from wms_selection_criteria_txn
     where  from_organization_id = l_from_organization_id
       	and rule_type_code = p_type_code
       	and enabled_flag = 1
       	and nvl(from_subinventory_name, l_from_subinventory_name) 	= l_from_subinventory_name
 	and nvl(to_organization_id, 	l_to_organization_id) 		= l_to_organization_id
 	and nvl(to_subinventory_name,	l_to_subinventory_name ) 	= l_to_subinventory_name
 	and nvl(customer_id,		l_customer_id) 			= l_customer_id
 	and nvl(freight_code,		l_freight_code) 		= l_freight_code
 	and nvl(inventory_item_id, 	l_inventory_item_id) 		= l_inventory_item_id
 	and nvl(item_type, 		l_item_type) 			= l_item_type
 	and nvl(order_type_id, 		l_order_type_id) 		= l_order_type_id
 	and nvl(vendor_id, 		l_vendor_id) 			= l_vendor_id
 	and nvl(project_id, 		l_project_id) 			= l_project_id
 	and nvl(task_id, 		l_task_id )			= l_task_id
 	and nvl(user_id, 		l_user_id ) 			= l_user_id
 	and nvl(transaction_action_id, 	l_transaction_action_id ) 	= l_transaction_action_id
 	and nvl(reason_id , 		l_reason_id ) 			= l_reason_id
 	and nvl(transaction_source_type_id, l_transaction_source_type_id) = l_transaction_source_type_id
 	and nvl(transaction_type_id, 	l_transaction_type_id) 		= l_transaction_type_id
 	and nvl(uom_code, 		l_uom_code) 			= l_uom_code
	and nvl(uom_class, 		l_uom_class) 			= l_uom_class
	and nvl(effective_from,to_date('01011900','ddmmyyyy')) 		<= trunc(sysdate)
        and nvl(effective_to,to_date('31124000','ddmmyyyy')) 		>= trunc(sysdate)
	and wms_datecheck_pvt.date_valid(l_from_organization_id,date_type_code,date_type_from,date_type_to,effective_from,effective_to) = 'Y' --Added bug 4081657
        and decode(category_id,null,'N', 'Y') =   decode(category_id,null,'N', WMS_RULES_WORKBENCH_PVT.get_Item_Cat(l_rec_mtrl.organization_id,
	                                                                                                            l_rec_mtrl.inventory_item_id,
	                              	                                                                            category_set_id,
	                              	                                                                            category_id )
	                              	                                                                            )
        and decode(abc_class_id,null,'N', 'Y') =  decode(abc_class_id,null,'N', WMS_RULES_WORKBENCH_PVT.get_group_class(l_rec_mtrl.inventory_item_id,
		                              	                                                 assignment_group_id,
		                              	                                                 abc_class_id)
		                              	                                                  )

	order by sequence_number;
Line: 902

          log_procedure(l_api_name,'','Start selection Criteria ');
Line: 953

     	l_user_id			:= nvl(l_rec_mtrl.last_updated_by, -999);
Line: 1007

	OPEN cur_stg_selection;
Line: 1008

        FETCH cur_stg_selection
        INTO
	l_return_type_code,
        l_return_type_id,
        l_sequence_number,
        l_from_subinventory_name,
        l_to_organization_id,
        l_to_subinventory_name,
        l_customer_id,
        l_freight_code,
        l_inventory_item_id,
        l_item_type,
        l_order_type_id,
        l_vendor_id,
        l_project_id,
        l_task_id,
        l_user_id,
        l_transaction_action_id,
        l_reason_id,
        l_transaction_source_type_id,
        l_transaction_type_id,
        l_uom_code,
        l_uom_class,
        l_category_id,
        l_category_set_id,
        l_assignment_group_id,
        l_abc_class_id;
Line: 1036

        If (cur_stg_selection%NOTFOUND) Then
            --3224420close cur_stg_selection;
Line: 1039

               log_event(l_api_name,'','stg_selection cursor not found ');
Line: 1086

         If (cur_stg_selection%FOUND) Then

             if l_debug =1 then
                log_event(l_api_name,'',' Open/fetching stg_selection cursor');
Line: 1101

                 mtrl_line_tab.delete;
Line: 1112

                    UPDATE mtl_txn_request_lines
                    SET put_away_strategy_id = l_return_type_id
                    WHERE line_id = mtrl_line_tab(i);
Line: 1118

			       log_event(l_api_name,'msg:','Updated '||mtrl_line_tab.count||' mtrl lines with strategy_id ' ||l_return_type_id);
Line: 1134

                    UPDATE mtl_txn_request_lines
                    SET pick_strategy_id = l_return_type_id
                    WHERE line_id = mtrl_line_tab(i);
Line: 1139

                               log_event(l_api_name,'msg:','Updated '||mtrl_line_tab.count||' mtrl lines with strategy_id ' ||l_return_type_id);
Line: 1190

             If cur_stg_selection%ISOPEN then
                CLOSE cur_stg_selection;
Line: 1194

       If cur_stg_selection%ISOPEN then
                 CLOSE cur_stg_selection;
Line: 1203

          If cur_stg_selection%ISOPEN then
              CLOSE cur_stg_selection;
Line: 1211

               log_error(l_api_name, 'error', 'Error in selection Criteria - ' ||
      		x_msg_data);
Line: 1217

         If cur_stg_selection%ISOPEN then
              CLOSE cur_stg_selection;
Line: 1225

		'in selection Criteria - ' || x_msg_data);
Line: 1228

               log_event(l_api_name,'',' Exception in selection Criteria');
Line: 1232

         If cur_stg_selection%ISOPEN then
              CLOSE cur_stg_selection;
Line: 1257

     g_pkg_name constant 	 VARCHAR2(50)    := 'WMS_SELECTION_CRITERIA_PVT';
Line: 1263

     l_rec_wsct   WMS_SELECTION_CRITERIA_TXN%ROWTYPE;
Line: 1283

        last_updated_by          mtl_material_transactions_temp.last_updated_by%TYPE
      );
Line: 1288

     l_sequence_number 		wms_selection_criteria_txn.sequence_number%type;
Line: 1289

     l_return_type_code		wms_selection_criteria_txn.return_type_code%type;
Line: 1290

     l_return_type_id		wms_selection_criteria_txn.return_type_id%type;
Line: 1291

     l_from_organization_id	wms_selection_criteria_txn.from_organization_id%type;
Line: 1292

     l_from_subinventory_name	wms_selection_criteria_txn.from_subinventory_name%type default null;
Line: 1293

     l_to_organization_id      	wms_selection_criteria_txn.to_organization_id%type;
Line: 1294

     l_to_subinventory_name	wms_selection_criteria_txn.to_subinventory_name%type;
Line: 1295

     l_customer_id 		wms_selection_criteria_txn.customer_id%type;
Line: 1296

     l_freight_code 		wms_selection_criteria_txn.freight_code%type;
Line: 1297

     l_inventory_item_id 	wms_selection_criteria_txn.inventory_item_id%type;
Line: 1298

     l_item_type 		wms_selection_criteria_txn.item_type%type;
Line: 1299

     l_order_type_id		wms_selection_criteria_txn.order_type_id%type;
Line: 1300

     l_vendor_id		wms_selection_criteria_txn.vendor_id%type;
Line: 1301

     l_project_id		wms_selection_criteria_txn.project_id%type;
Line: 1302

     l_task_id			wms_selection_criteria_txn.task_id%type;
Line: 1303

     l_user_id			wms_selection_criteria_txn.user_id%type;
Line: 1304

     l_transaction_action_id	wms_selection_criteria_txn.transaction_action_id%type;
Line: 1305

     l_reason_id 		wms_selection_criteria_txn.reason_id%type;
Line: 1306

     l_transaction_source_type_id wms_selection_criteria_txn.transaction_source_type_id%type;
Line: 1307

     l_transaction_type_id	wms_selection_criteria_txn.transaction_type_id%type;
Line: 1308

     l_uom_code 		wms_selection_criteria_txn.uom_code%type;
Line: 1309

     l_uom_class		wms_selection_criteria_txn.uom_class%type default null;
Line: 1313

      cursor cur_stg_selection is
        select return_type_code, return_type_id, sequence_number
        from wms_selection_criteria_txn
      where  from_organization_id = l_from_organization_id
       	and rule_type_code = p_type_code
       	and enabled_flag = 1
   	and nvl(from_subinventory_name, l_from_subinventory_name) 	= l_from_subinventory_name
   	and nvl(to_organization_id, 	l_to_organization_id) 		= l_to_organization_id
   	and nvl(to_subinventory_name,	l_to_subinventory_name ) 	= l_to_subinventory_name
   	and nvl(customer_id,		l_customer_id) 			= l_customer_id
   	and nvl(freight_code,		l_freight_code) 		= l_freight_code
   	and nvl(inventory_item_id, 	l_inventory_item_id) 		= l_inventory_item_id
   	and nvl(item_type, 		l_item_type) 			= l_item_type
     	and nvl(order_type_id, 		l_order_type_id) 		= l_order_type_id
   	and nvl(vendor_id, 		l_vendor_id) 			= l_vendor_id
   	and nvl(project_id, 		l_project_id) 			= l_project_id
   	and nvl(task_id, 		l_task_id )			= l_task_id
   	and nvl(user_id, 		l_user_id ) 			= l_user_id
   	and nvl(transaction_action_id, 	l_transaction_action_id ) 	= l_transaction_action_id
   	and nvl(reason_id , 		l_reason_id ) 			= l_reason_id
   	and nvl(transaction_source_type_id, l_transaction_source_type_id) = l_transaction_source_type_id
   	and nvl(transaction_type_id, 	l_transaction_type_id) 		= l_transaction_type_id
   	and nvl(uom_code, 		l_uom_code) 			= l_uom_code
  	and nvl(uom_class, 		l_uom_class) 			= l_uom_class
  	and nvl(effective_from,to_date('01011900','ddmmyyyy')) 		<= trunc(sysdate)
        and nvl(effective_to,to_date('31124000','ddmmyyyy')) 		>= trunc(sysdate)
	and wms_datecheck_pvt.date_valid(l_from_organization_id,date_type_code,date_type_from,date_type_to,effective_from,effective_to) = 'Y' --Added bug 4081657
        and decode(category_id,null, 'N', 'Y') =   decode(category_id, null, 'N', WMS_RULES_WORKBENCH_PVT.get_Item_Cat(l_from_organization_id, -- 14071820
	                                                                                                              l_rec_mtrl.inventory_item_id ,
	                              	                                                                              category_set_id,
	                              	                                                                              category_id ))
  	and decode(abc_class_id,null,'N', 'Y') =   decode(abc_class_id,null,'N',  WMS_RULES_WORKBENCH_PVT.get_group_class(l_rec_mtrl.inventory_item_id,
												                          assignment_group_id,
												                          abc_class_id))
  	order by sequence_number;
Line: 1351

           SELECT
  	    mmtt.transaction_temp_id ,
            mmtt.organization_id,
  	    mmtt.inventory_item_id,
  	    mmtt.revision,
  	    decode(  mmtt.transaction_action_id,
  	           1,mmtt.subinventory_code,
  	           2,mmtt.subinventory_code,
  	           3,mmtt.subinventory_code,
  	           21,mmtt.subinventory_code,
  	           28,mmtt.subinventory_code,
  	           29,mmtt.subinventory_code,
  	           32,mmtt.subinventory_code,
  	           34,mmtt.subinventory_code,
                   NULL),
   	    decode(transaction_action_id, 1,
                                    NULL, 2,
                   transfer_subinventory, 3,
                   transfer_subinventory, 21,
                                NULL, 28,
                   transfer_subinventory,
                                      29, NULL, 32, NULL,34, NULL, subinventory_code),
  	    mmtt.transaction_uom,
  	    mmtt.reason_id,
  	    mmtt.project_id,
  	    mmtt.task_id,
  	    mmtt.transaction_type_id,
  	    mmtt.transaction_source_type_id,
  	    decode(mmtt.transaction_action_id, 3, mmtt.transfer_organization, 21, mmtt.transfer_organization, mmtt.organization_id),
  	    mmtt.transaction_reference,
	    decode(mmtt.source_code,'RCV', mmtt.rcv_transaction_id,to_number(NULL)),
	    mmtt.transaction_action_id,
  	    mmtt.last_updated_by
  	    from mtl_material_transactions_temp mmtt
  	    where mmtt.transaction_temp_id  = p_transaction_temp_id;
Line: 1470

       	l_user_id			:= nvl(l_rec_mtrl.last_updated_by, -999);
Line: 1516

           OPEN cur_stg_selection;
Line: 1517

           FETCH cur_stg_selection INTO  l_return_type_code, l_return_type_id, l_sequence_number;
Line: 1519

            If (cur_stg_selection%NOTFOUND) Then
               --commenting out for 3224420 close cur_stg_selection;
Line: 1522

                  log_event(l_api_name,'','stg_selection cursor not found ');
Line: 1535

            If (cur_stg_selection%FOUND) Then
               x_return_type      := l_return_type_code;
Line: 1542

                  log_event(l_api_name, '',' Open/fetching  stg_selection cursor');
Line: 1562

               IF cur_stg_selection%ISOPEN then
                  CLOSE cur_stg_selection;
Line: 1569

	    IF (cur_stg_selection%ISOPEN) then
	     CLOSE cur_stg_selection;
Line: 1580

              IF cur_stg_selection%ISOPEN then
                 CLOSE cur_stg_selection;
Line: 1586

              log_error(l_api_name, 'error', 'Error in selection Criteria - ' ||
        		x_msg_data);
Line: 1594

             IF cur_stg_selection%ISOPEN then
                 CLOSE cur_stg_selection;
Line: 1605

              IF cur_stg_selection%ISOPEN then
                 CLOSE cur_stg_selection;
Line: 1610

             log_event(l_api_name,'',' Exception in selection Criteria');
Line: 1623

        g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 1662

    g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 1690

   	      select 'Y' INTO l_category_exist
	          from mtl_item_categories mic
                    where mic.organization_id       = p_org_id
	              and mic.inventory_item_id = p_inventory_item_id
	              and mic.category_set_id   = p_category_set_id
	              and mic.category_id       = p_category_id
                and rownum<2;
Line: 1712

    g_pkg_name constant VARCHAR2(50)    := 'WMS_SELECTION_CRITERIA_PVT';
Line: 1727

      select 'Y' INTO l_group_class_exist FROM mtl_abc_assignments
	     where inventory_item_id    = p_inventory_item_id
	       and assignment_group_id  = p_assignment_group_id
	       and abc_class_id         = p_class_id;
Line: 1745

            g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 1767

	           select  muom.uom_class  into l_uom_class
	             from MTL_UNITS_OF_MEASURE muom
	            where  muom.uom_code = p_uom_code;
Line: 1785

     g_pkg_name constant VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 1799

	    select   poh.vendor_id  into l_vendor_id
	     from po_headers_all poh,
	          po_lines_all pol,
	          po_line_locations_all pll
	              where poh.po_header_id = pol.po_header_id
	              and pll.po_header_id = pol.po_header_id
	              and pll.po_line_id   = pol.po_line_id
	              and pll.shipment_type = 'STANDARD'
                      and pll.line_location_id = p_reference_id ;
Line: 1810

           select  poh.vendor_id  into l_vendor_id
	     from po_headers_all poh,
	          po_lines_all pol,
	          po_distributions_all pod,
	          po_line_locations_all pll
	              where poh.po_header_id = pol.po_header_id
	              and pll.po_header_id = pol.po_header_id
	              and pll.po_line_id   = pol.po_line_id
	              and pod.po_header_id = pll.po_header_id
	              and pod.po_line_id   = pll.po_line_id
	              and pod.line_location_id = pll.line_location_id
	              and pll.shipment_type = 'STANDARD'
                      and pod.po_distribution_id = p_reference_id;
Line: 1824

             select  poh.vendor_id  into l_vendor_id
	       from po_headers_all poh,
	            po_lines_all pol,
	            rcv_transactions rct,
	            po_line_locations_all pll
	                where poh.po_header_id = pol.po_header_id
	                and pll.po_header_id = pol.po_header_id
	                and pll.po_line_id   = pol.po_line_id
	                and rct.po_header_id = pll.po_header_id
	                and rct.po_line_id   = pll.po_line_id
	                and rct.po_line_location_id = pll.line_location_id
	                and pll.shipment_type = 'STANDARD'
                        and rct.transaction_id  = p_reference_id;
Line: 1848

            g_pkg_name constant 	VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 1872

      	        select nvl(mtrl.transaction_source_type_id,0) , nvl(mtrl.reference_id, 0)
      	            into  l_transaction_source_type_id, l_reference_id
	            from mtl_txn_request_lines  mtrl
	            where mtrl.line_id = p_move_order_line_id;  */
Line: 1891

               select /*+index (WDD WSH_DELIVERY_DETAILS_N7)*/ oh.order_type_id  into l_order_type_id
	         from oe_order_headers_all oh,
	              wsh_delivery_details wdd
	         where oh.header_id = wdd.source_header_id
	           and wdd.released_status = 'S'
	           and wdd.source_code = 'OE'
                   and wdd.move_order_line_id = p_move_order_line_id;
Line: 1906

                 select oh.order_type_id  into l_order_type_id
		   from oe_order_headers_all oh ,
		        oe_order_lines_all ol
		         where oh.header_id = ol.header_id
		         and ol.line_id =  l_reference_id ;
Line: 1928

            g_pkg_name constant 	VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 1945

               select /*+index (WDD WSH_DELIVERY_DETAILS_N7)*/ oh.order_type_id  into l_order_type_id
	         from oe_order_headers_all oh,
	              wsh_delivery_details wdd
	         where oh.header_id = wdd.source_header_id
	           and wdd.released_status = 'S'
	           and wdd.source_code = 'OE'
                   and wdd.move_order_line_id = p_move_order_line_id;
Line: 1960

                 select oh.order_type_id  into l_order_type_id
		   from oe_order_headers_all oh ,
		        oe_order_lines_all ol
		         where oh.header_id = ol.header_id
		         and ol.line_id =  p_reference_id ;
Line: 1979

        g_pkg_name constant 	VARCHAR2(50)   := 'WMS_SELECTION_CRITERIA_PVT';
Line: 1993

             SELECT nvl(trx_source_line_id, -999)
             INTO l_trx_source_line_id
             FROM mtl_material_Transactions_temp
             WHERE transaction_temp_id = p_transaction_temp_id
             AND transaction_source_type_id = INV_GLOBALS.G_SOURCETYPE_RMA
             AND transaction_action_id = INV_GLOBALS.G_ACTION_RECEIPT;
Line: 2009

             select customer_id, freight_carrier_code into l_customer_id, l_freight_code
             from WMS_TXN_CONTEXT_TEMP
             where line_id = p_transaction_temp_id;
Line: 2028

		 SELECT
		  hz.PARTY_ID,
		  oola.freight_carrier_code
	        INTO  l_customer_id,
	             l_freight_code
	        FROM  oe_order_lines_all oola,
		HZ_PARTIES hz
		WHERE oola.line_id = l_trx_source_line_id
		AND hz.party_id = oola.sold_to_org_id;
Line: 2071

	select location_code into l_location_code
	 from hr_locations
	 where location_id=p_location_id;
Line: 2114

	l_sequence_number 		wms_selection_criteria_txn.sequence_number%type;
Line: 2115

	l_return_type_code		wms_selection_criteria_txn.return_type_code%type;
Line: 2116

	l_return_type_id		wms_selection_criteria_txn.return_type_id%type;
Line: 2120

	CURSOR cur_crossdock_value_selection IS
	   SELECT return_type_code, return_type_id, sequence_number
	     FROM wms_selection_criteria_txn
           WHERE from_organization_id = p_organization_id
       	     AND rule_type_code = p_rule_type_code
       	     AND enabled_flag = 1
	     AND NVL(customer_id, NVL(p_customer_id, -9))     = NVL(p_customer_id, -9)
	     AND NVL(inventory_item_id, p_inventory_item_id)  = p_inventory_item_id
	     AND NVL(item_type, NVL(p_item_type, '#'))	      = NVL(p_item_type, '#')
	     AND NVL(vendor_id, NVL(p_vendor_id, -9))         = NVL(p_vendor_id, -9)
	     AND NVL(location_id, NVL(p_location_id, -9))     = NVL(p_location_id, -9)
	     AND NVL(project_id, NVL(p_project_id, -9))       = NVL(p_project_id, -9)
	     AND NVL(task_id, NVL(p_task_id, -9))             = NVL(p_task_id, -9)
	     AND NVL(user_id, NVL(p_user_id, -9))             = NVL(p_user_id, -9)
	     AND NVL(uom_code, NVL(p_uom_code, '#'))          = NVL(p_uom_code, '#')
	     AND NVL(uom_class, NVL(p_uom_class, '#'))        = NVL(p_uom_class, '#')
	     AND DECODE(abc_class_id, NULL, 'N', 'Y')         = DECODE(abc_class_id, NULL,'N',
		    WMS_RULES_WORKBENCH_PVT.get_group_class(p_inventory_item_id,
							    assignment_group_id,
							    abc_class_id))
	     ORDER BY sequence_number;
Line: 2146

      OPEN cur_crossdock_value_selection;
Line: 2147

      FETCH cur_crossdock_value_selection INTO l_return_type_code, l_return_type_id, l_sequence_number;
Line: 2149

      IF (cur_crossdock_value_selection%NOTFOUND) THEN
	 l_return_type_code := NULL;
Line: 2159

      IF cur_crossdock_value_selection%ISOPEN THEN
	 CLOSE cur_crossdock_value_selection;
Line: 2172

	 If cur_crossdock_value_selection%ISOPEN then
	    CLOSE cur_crossdock_value_selection;
Line: 2179

	 log_error(l_api_name, 'error', 'Error in Cross selection Criteria - ' ||l_msg_data);
Line: 2183

   	   If cur_crossdock_value_selection%ISOPEN then
	      CLOSE cur_crossdock_value_selection;
Line: 2189

	    log_error(l_api_name, 'unexp_error', 'Unexpected error ' ||' in selection Criteria - ' || l_msg_data);
Line: 2193

		      log_event(l_api_name,'',' Exception in cross selection Criteria');
Line: 2197

	    If cur_crossdock_value_selection%ISOPEN then
	       CLOSE cur_crossdock_value_selection;