The following lines contain the word 'select', 'insert', 'update' or 'delete':
Select MTL_KANBAN_REPLENISH_CYCLE_S.NextVal Into l_next_replenish_cycle_Id
From Dual;
SELECT NVL(project_reference_enabled,2)
INTO l_project_reference_enabled
FROM mtl_parameters
WHERE organization_id = l_Kanban_Card_Rec_Tbl(1).organization_id;
SELECT project_id
INTO l_project_id
FROM mtl_item_locations
WHERE inventory_location_id = l_Kanban_Card_Rec_Tbl(l_order_count).locator_id
AND organization_id = l_Kanban_Card_Rec_Tbl(l_order_count).organization_id;
SELECT task_id
INTO l_task_id
FROM mtl_item_locations
WHERE NVL(project_id,-999) = NVL(l_project_id, -111)
AND inventory_location_id =l_Kanban_Card_Rec_Tbl(l_order_count).locator_id
AND organization_id = l_Kanban_Card_Rec_Tbl(l_order_count).organization_id;
insert into po_requisitions_interface_all
(
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
PREPARER_ID,
INTERFACE_SOURCE_CODE,
REQUISITION_TYPE,
AUTHORIZATION_STATUS,
SOURCE_TYPE_CODE,
SOURCE_ORGANIZATION_ID,
SOURCE_SUBINVENTORY,
DESTINATION_ORGANIZATION_ID,
DESTINATION_SUBINVENTORY,
DELIVER_TO_REQUESTOR_ID,
DESTINATION_TYPE_CODE,
DELIVER_TO_LOCATION_ID,
ITEM_ID,
ITEM_REVISION,
ITEM_DESCRIPTION,
UOM_CODE,
QUANTITY,
NEED_BY_DATE,
GL_DATE,
CHARGE_ACCOUNT_ID,
ACCRUAL_ACCOUNT_ID,
VARIANCE_ACCOUNT_ID,
BUDGET_ACCOUNT_ID,
AUTOSOURCE_FLAG,
ORG_ID,
SUGGESTED_VENDOR_ID,
SUGGESTED_VENDOR_SITE_ID,
Kanban_card_Id,
Batch_Id,
PROJECT_ID,
TASK_ID,
PROJECT_ACCOUNTING_CONTEXT,
GROUP_CODE
)
Values
(
sysdate,
FND_GLOBAL.USER_ID,
sysdate,
FND_GLOBAL.USER_ID,
p_buyer_Id,
p_interface_Source_Code,
p_requisition_type,
p_approval,
p_source_type_code,
l_Kanban_Card_Rec_Tbl(l_order_count).Source_organization_Id,
l_Kanban_Card_Rec_Tbl(l_order_count).Source_Subinventory,
l_Kanban_Card_Rec_Tbl(l_order_count).organization_Id,
l_Kanban_Card_Rec_Tbl(l_order_count).Subinventory_Name,
p_buyer_Id,
p_destination_type_code,
p_deliver_location_id,
l_Kanban_Card_Rec_Tbl(l_order_count).Inventory_Item_Id,
p_revision,
p_Item_description,
p_Primary_uom_Code,
l_Kanban_Card_Rec_Tbl(l_order_count).kanban_size,
(trunc(p_need_by_date) + 1 - (1/(24*60*60))),
SYSDATE,
p_Charge_Account_Id,
p_Accrual_Account_Id,
p_Invoice_Var_Account_Id,
p_Budget_Account_Id,
p_autosource_flag,
p_po_org_id,
l_Kanban_Card_Rec_Tbl(l_order_count).Supplier_ID,
l_Kanban_Card_Rec_Tbl(l_order_count).Supplier_Site_ID,
l_Kanban_Card_Rec_Tbl(l_order_count).kanban_card_id,
l_Current_Replenish_Cycle_Id,
l_project_id,
l_task_id,
l_project_accounting_context,
l_group_code);
l_Kanban_Card_Rec_Tbl(l_order_count).Last_Update_Date := SYSDATE;
l_Kanban_Card_Rec_Tbl(l_order_count).Last_Updated_By := FND_GLOBAL.USER_ID;
Update Mtl_Kanban_Cards
Set Supply_Status = INV_Kanban_PVT.G_Supply_Status_Empty,
Current_Replnsh_Cycle_Id = l_Current_Replenish_Cycle_Id,
replenishment_count = nvl(replenishment_count,0)+1,
Last_Update_Date = SYSDATE,
Last_Updated_By = FND_GLOBAL.USER_ID
Where Kanban_Card_Id = l_Kanban_Card_Rec_Tbl(l_order_count).Kanban_card_Id;
INV_KanbanCard_PKG.Insert_Activity_For_Card(l_Kanban_Card_Rec_Tbl(l_order_count));
l_trohdr_rec.last_updated_by := FND_GLOBAL.USER_ID;
l_trohdr_rec.last_update_date := sysdate;
l_trohdr_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
select location_control_code,secondary_uom_code
into l_item_locator_control_code,l_secondary_uom_code
from mtl_system_items
where organization_id = l_Kanban_Card_Rec_Tbl(l_order_count).organization_id
and inventory_item_id = l_Kanban_Card_Rec_Tbl(l_order_count).inventory_item_id;
select locator_type
into l_from_sub_locator_type
from mtl_secondary_inventories
where organization_id = l_Kanban_Card_Rec_Tbl(l_order_count).organization_id
and secondary_inventory_name = l_Kanban_Card_Rec_Tbl(l_order_count).source_subinventory;
select locator_type
into l_to_sub_locator_type
from mtl_secondary_inventories
where organization_id = l_Kanban_Card_Rec_Tbl(l_order_count).organization_id
and secondary_inventory_name = l_Kanban_Card_Rec_Tbl(l_order_count).subinventory_name;
select stock_locator_control_code
into l_org_locator_control_code
from mtl_parameters
where organization_id = l_Kanban_Card_Rec_Tbl(l_order_count).organization_id;
l_trolin_tbl(l_order_count).last_updated_by := FND_GLOBAL.USER_ID;
l_trolin_tbl(l_order_count).last_update_date := sysdate;
l_trolin_tbl(l_order_count).last_update_login := FND_GLOBAL.LOGIN_ID;
SELECT project_id,task_id
INTO l_trolin_tbl(l_order_count).project_id,
l_trolin_tbl(l_order_count).task_id
FROM mtl_item_locations
WHERE inventory_location_id = l_Kanban_Card_Rec_Tbl(l_order_count).source_locator_id
and organization_id = l_Kanban_Card_Rec_Tbl(l_order_count).organization_id;
SELECT MKP.auto_allocate_flag INTO l_auto_Allocate_flag
FROM Mtl_Kanban_Pull_Sequences MKP
WHERE MKP.pull_sequence_id=l_Kanban_Card_Rec_Tbl(1).pull_sequence_id;
l_Kanban_Card_Rec_Tbl(l_order_count).Last_Update_Date := SYSDATE;
l_Kanban_Card_Rec_Tbl(l_order_count).Last_Updated_By := FND_GLOBAL.USER_ID;
Update Mtl_Kanban_Cards
Set Supply_Status = INV_Kanban_PVT.G_Supply_Status_InProcess,
Current_Replnsh_Cycle_Id = l_Current_Replenish_Cycle_Id,
replenishment_count = nvl(replenishment_count,0)+1,
Last_Update_Date = SYSDATE,
Last_Updated_By = FND_GLOBAL.USER_ID
Where Kanban_Card_Id = l_Kanban_Card_Rec_Tbl(l_order_count).Kanban_card_Id;
INV_KanbanCard_PKG.Insert_Activity_For_Card(l_Kanban_Card_Rec_Tbl(l_order_count));
SELECT MTRH.request_number INTO l_mo_request_number
FROM Mtl_Txn_Request_Headers MTRH
WHERE MTRH.Header_id = l_Kanban_Card_Rec_Tbl(1).document_header_id;
Select msi.Description,Primary_Uom_Code,Inventory_Asset_Flag,
nvl(mss.ENCUMBRANCE_ACCOUNT,nvl(msi.Encumbrance_Account,Org.Encumbrance_Account)),
decode(msi.inventory_asset_flag, 'Y', mss.material_account,nvl(mss.expense_account,nvl(msi.expense_account,org.expense_account))),
Org.Ap_accrual_account,Org.invoice_price_var_account,
nvl(mss.preprocessing_lead_time,nvl(msi.preprocessing_lead_time,0)),
nvl(mss.processing_lead_time,nvl(msi.full_lead_time,0)),
nvl(mss.postprocessing_lead_time,nvl(msi.postprocessing_lead_time,0)),
msi.revision_qty_control_code
Into l_Item_Description,l_Primary_Uom_Code,l_Inventory_Asset_Flag,
l_Encumb_Account_Id,
l_Charge_Account_Id,
l_Accrual_Account_Id,
l_Invoice_Var_Account_Id,
l_PreProcess_lead_Time,
l_Process_lead_Time,
l_PostProcess_lead_Time,
l_Revision_qty_control_code
From Mtl_System_Items msi,
mtl_Parameters org,
mtl_secondary_inventories mss
Where Msi.Organization_Id = l_kanban_card_Rec_Tbl(1).Organization_id
And Msi.Inventory_Item_Id = l_kanban_card_Rec_Tbl(1).Inventory_Item_Id
And org.Organization_Id = l_kanban_card_Rec_Tbl(1).Organization_Id
And mss.Organization_id = l_kanban_card_Rec_Tbl(1).Organization_id
And mss.secondary_inventory_name = l_kanban_card_Rec_Tbl(1).Subinventory_Name;
Select nvl(ENCUMBRANCE_ACCOUNT,l_Encumb_Account_Id),
nvl(preprocessing_lead_time,l_PreProcess_lead_Time)
+ nvl(processing_lead_time,l_Process_lead_Time)
+ nvl(postprocessing_lead_time,l_PostProcess_lead_Time)
Into l_budget_Account_Id,
l_need_by_time
From mtl_item_sub_inventories
Where Organization_id = l_kanban_card_Rec_Tbl(1).Organization_id
And Inventory_Item_Id = l_kanban_card_Rec_Tbl(1).Inventory_Item_Id
And secondary_inventory = l_kanban_card_Rec_Tbl(1).Subinventory_Name;
select nvl(f.req_encumbrance_flag,'N'),o.operating_unit
into l_encumb_flag,l_po_org_Id
from financials_system_params_all f,
org_organization_definitions o
where o.organization_id = l_kanban_card_Rec_Tbl(1).Organization_id
And nvl(f.org_id,-99) = nvl(o.operating_unit,-99);
select c1.calendar_date
into l_need_by_date
from mtl_parameters o,
bom_calendar_dates c1,
bom_calendar_dates c
where o.organization_id = l_kanban_card_Rec_Tbl(1).Organization_id
and c1.calendar_code = c.calendar_code
and c1.exception_set_id = c.exception_set_id
and c1.seq_num = (c.next_seq_num + trunc(nvl(p_lead_time,l_need_by_time)))
and c.calendar_code = o.CALENDAR_CODE
and c.exception_set_id = o.CALENDAR_EXCEPTION_SET_ID
and c.calendar_date = trunc(sysdate);
select distinct org.location_id
into l_deliver_location_id
from hr_organization_units org,
hr_locations loc,
po_location_associations_all pla
where org.organization_id =
l_kanban_card_Rec_Tbl(1).Organization_id
and org.location_id = loc.location_id
and pla.location_id = loc.location_id;
select org.location_id
into l_deliver_location_id
from hr_organization_units org,
hr_locations loc
where org.organization_id =
l_kanban_card_Rec_Tbl(1).Organization_id
and org.location_id = loc.location_id;
select MAX(revision)
into l_revision
from mtl_item_revisions mir
where inventory_item_id = l_kanban_card_Rec_Tbl(1).Inventory_Item_Id
and organization_id = l_kanban_card_Rec_Tbl(1).organization_Id
and effectivity_date < SYSDATE
and implementation_date is not null
and effectivity_date = ( select MAX(effectivity_date)
from mtl_item_revisions mir1
where mir1.inventory_item_id = mir.inventory_item_id
and mir1.organization_id = mir.organization_id
and implementation_date is not null
and effectivity_date < SYSDATE );
select employee_id
into l_buyer_id
from fnd_user
where user_id = FND_GLOBAL.USER_ID;
select mkc.kanban_card_id,mkc.kanban_card_number,mkc.pull_sequence_id,mkc.inventory_item_id,mkc.organization_id,mkc.subinventory_name,mkc.supply_status
,mkc.card_status,mkc.kanban_card_type,mkc.source_type,mkc.kanban_size,mkc.last_update_date,mkc.last_updated_by,mkc.creation_date,mkc.created_by
,mkc.locator_id,mkc.supplier_id,mkc.supplier_site_id,mkc.source_organization_id,mkc.source_subinventory,mkc.source_locator_id,mkc.wip_line_id
,mkc.current_replnsh_cycle_id,null,null,null,mkc.error_code,mkc.last_update_login,mkc.last_print_date,mkc.attribute_category,mkc.attribute1,
mkc.attribute2,mkc.attribute3,mkc.attribute4,mkc.attribute5,mkc.attribute6,mkc.attribute7,mkc.attribute8,mkc.attribute9,mkc.attribute10,mkc.attribute11,
mkc.attribute12,mkc.attribute13,mkc.attribute14,mkc.attribute15,mkc.request_id,mkc.program_application_id,mkc.program_id,mkc.program_update_date,null,
null,null,null,null,null,null,null,null,mkc.replenishment_count,mkc.max_replenishments,mkc.disable_date,mkc.replacement_flag
bulk collect into v_cards_to_consolidate
from
mtl_kanban_cards mkc,
mtl_kanban_pull_sequences mkps
where mkps.organization_id = p_organization_id
and nvl(mkps.consolidation_group,'####') = nvl(p_group_code,'####')
and mkps.pull_sequence_id = mkc.pull_sequence_id
and trunc(mkc.supply_status) = INV_Kanban_PVT.G_Supply_Status_Consolidate
and mkc.card_status = INV_Kanban_PVT.G_Card_Status_Active
order by mkc.source_type,mkc.pull_sequence_id,
mkc.supplier_id,mkc.supplier_site_id,
mkc.source_organization_id,mkc.source_subinventory,mkc.source_locator_id;
v_consolidated_card.delete;
select replenishment_lead_time into l_lead_time
from mtl_kanban_pull_sequences
where pull_sequence_id = v_cards_to_consolidate(l_card_counter).pull_sequence_id;
v_consolidated_card.delete;
select to_number(ORG_INFORMATION3) into l_ou_id
from HR_ORGANIZATION_INFORMATION
where ORGANIZATION_ID = p_organization_id
and ORG_INFORMATION_CONTEXT = 'Accounting Information';