The following lines contain the word 'select', 'insert', 'update' or 'delete':
/* Bug#2718220 Added the REJECTED status also so that the Program will update
** all the Documents with REJECTED also apart from APPROVED,REQUIRES REAPPROVAL
** and INCOMPLETE statuses.
*/
cursor c_rel is
select por.rowid,
poh.segment1,
por.release_num,
pdt.type_name,
por.po_release_id--8551445
from po_releases por,
po_headers poh,
po_document_types_vl pdt
where por.po_header_id = poh.po_header_id
and por.agent_id = x_old_buyer_id
and nvl(por.authorization_status,'INCOMPLETE') in ('APPROVED','REQUIRES REAPPROVAL','INCOMPLETE','REJECTED')
and nvl(por.closed_code,'OPEN') not in ('CLOSED','FINALLY CLOSED')
and nvl(por.cancel_flag,'N') = 'N'
and nvl(por.frozen_flag,'N') = 'N'
and pdt.document_type_code ='RELEASE'
and pdt.document_subtype = por.release_type
order by poh.segment1,por.release_num;
l_api_name VARCHAR2(30) := 'po_update_buyer';
select org_id
into x_org_id
from po_system_parameters;
select hou.name
into x_org_name
from hr_all_organization_units hou,
hr_all_organization_units_tl hout
where hou.organization_id = hout.organization_id
and hout.language = userenv('LANG')
and hou.organization_id = x_org_id;
* Mass Update of Buyer Name on Purchasing Documents Report *
* *
* DATE : DD-MON-YYYY *
* OPERATING UNIT : Vision Operations *
* OLD BUYER : Green, Terry *
* NEW BUYER : Stock, Pat *
* *
* The Buyer was updated on the following Documents. *
* Document Number Document Type *
* ------------------------------------------------ *
* 1234 Standard Purchase Order *
* 1222 Blanket Agreement *
* 1222-1 Blanket Release *
* ..... ...... *
*--------------------------------------------------------------*/
fnd_file.put_line(fnd_file.output, x_msg1);
/* Update all the fetched PO documents with the new buyer */
x_progress := '003';
/* Bug#3082301 Added the WHO columns to the below update statement so that
** Mass Update Buyer Name Program will update the WHO columns also on all
** Purchasing Documents(POs) which are effected by the program.
*/
update po_headers_all
set agent_id = x_new_buyer_id,
last_update_date = sysdate,
last_updated_by = fnd_global.user_id,
last_update_login = fnd_global.login_id
where rowid = x_po_rowid;
UPDATE po_headers_archive_all
SET agent_id = x_new_buyer_id,
last_update_date = sysdate,
last_updated_by = fnd_global.user_id,
last_update_login = fnd_global.login_id
WHERE po_header_id=l_document_id
AND latest_external_flag= 'Y';
okc_manage_deliverables_grp.updateIntContactOnDeliverables (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_FALSE,
p_bus_docs_tbl => l_busdocs_tbl,
p_original_internal_contact_id => x_old_buyer_id,
p_new_internal_contact_id => x_new_buyer_id,
x_msg_data => l_msg_data,
x_msg_count => l_msg_count,
x_return_status => l_return_status);
okc_manage_deliverables_grp.updateIntContactOnDeliverables (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_FALSE,
p_bus_docs_tbl => l_busdocs_tbl,
p_original_internal_contact_id => x_old_buyer_id,
p_new_internal_contact_id => x_new_buyer_id,
x_msg_data => l_msg_data,
x_msg_count => l_msg_count,
x_return_status => l_return_status);
/* Update all the fetched PO Release documents with the new buyer */
x_progress := '006';
/* Bug#3082301 Added the WHO columns to the below update statement so that
** Mass Update Buyer Name Program will update the WHO columns also on all
** Purchasing Documents(Releases) which are effected by the program.
*/
update po_releases_all
set agent_id = x_new_buyer_id,
last_update_date = sysdate,
last_updated_by = fnd_global.user_id,
last_update_login = fnd_global.login_id
where rowid = x_rel_rowid;
UPDATE po_releases_archive_all
SET agent_id = x_new_buyer_id,
last_update_date = sysdate,
last_updated_by = fnd_global.user_id,
last_update_login = fnd_global.login_id
WHERE po_release_id=l_document_id
AND latest_external_flag= 'Y';
po_message_s.sql_error('po_update_buyer', x_progress, sqlcode);