Useful SQL Scripts
Useful SQL Scripts
Update aporeqheader
set status = '&Desired_Status'
where order_id = '&requisition_number';
Update aporeqdetail
set status = '&Desired_Status'
where order_id = '&requisition_number';
Commit;
Update apoheader
set status = '&Desired_Status'
where order_id like '&po_number';
Update apodetail
set status = '&Desired_Status'
where order_id = '&po_number';
Commit;
select distinct(col1_value)
FROM awftask WHERE wf_status='ACT' AND col1_Descr = 'TransNo' AND
col2_descr = 'SuppID'
and col1_value not in (select cast(voucher_no as char) from asuvicrtrans) and
element_type = 'IIN' order by 1
Begin transaction GT
UPDATE awftask SET wf_status='FIN' WHERE wf_status='ACT' AND col1_Descr =
'TransNo' AND col2_descr = 'SuppID'
AND col1_value NOT IN (SELECT cast(voucher_no as char) FROM asuvicrtrans)
and element_type ='IIN';
commit;
SELECT v.voucher_no,
v.account,
v.process,
v.step,
--t.role_id,
v.wf_state,
v.apar_id,
V.EXT_INV_REF,
V.ARRIVAL_DATE as REGISTRATION_DATE,
v.last_update as arrival_date,
V.DUE_DATE,
v.apar_name as supplier_name,
v.dim_1 AS costc,
v.amount,
v.dim_3,
v.dim_4,
v.version_no,
v.voucher_date,
(select wf_user_id from agresso.awfviiin where v.voucher_no = voucher_no and
ROWNUM <= 1) as User_Id
from AGRESSO.AWFVIIIN V
where v.account not in ('B611110', 'B531120') and v.process != 'Incoming Invoice
Approval'
order by 3,4,1, USER_ID desc;
SELECT v.voucher_no,
v.account,
v.process,
v.step,
v.wf_state,
v.apar_id,
V.EXT_INV_REF,
V.ARRIVAL_DATE as REGISTRATION_DATE,
v.last_update as arrival_date,
V.DUE_DATE,
v.apar_name as supplier_name,
v.dim_1 AS costc,
v.amount,
v.dim_3,
v.dim_4,
v.version_no,
v.voucher_date,
(select wf_user_id from agresso.awfviiin where v.voucher_no = voucher_no and
ROWNUM <= 1) as User_Id,
u.name,
t.role_id
from AGRESSO.AWFVIIIN V
inner join agresso.ahsresources u on v.client = u.client and v.wf_user_id =
u.resource_id
inner join agresso.awftask t on v.client = t.client and to_char (v.voucher_no) =
t.col1_value
order by 3,4, 1, USER_ID desc;
update aporeqheader
set resource_id = '&resource_id'
where order_id like '&order_id';
commit;
update aporeqheader
set resource_id2 = '&resource_id2'
where order_id like '&order_id';
commit;
update aporeqheader
set responsible2 = '&responsible2'
where order_id like '&order_id';
commit;
update aporeqheader
set user_id = '&user_id'
where order_id like '&order_id';
commit;
SQL Query for name and “ZZ” role value
Northgate Interface
update apodetail
set status = 'T'
where order_id like '&order_id';
commit;