Move order auto-approval without planner action
Basic business need
Move order line item will be sent for approvals to planner
Pain points from planner:
1. Receiving many notifications based on move order line items
2. If move order is having 100 of items for discard process, then manual approvals or rejections is pain for business stake holders
3. Requires automatic approval by the system and need FYI notification.
Consultant solution
Create a process to identify the following,
a. move order line items which is pending for approval
b. identify approval workflow engine which requires updating header and line status
c. write a custom plsql program to perform automatic approval process
Parameter design
Move order no - You can perform automatic approval for specific move order no.
Auto run mode - Auto approval / Initiate workflow approval process
- Auto approval - performs approval operation in systematic way for pending transactions
- Initiate workflow process - sends notification to planner seeking for approvals / rejections
Time out period
Days defined over here will be taken into consideration to perform automatic approval
Ex: If time out period = 2, then current date - 2 will be the move order date result.
Beyond this cut off date whatever transactions pending for approval will be taken into criteria and approve it off
You can set auto approvals criteria for specific or set of move order transaction types.
This is activated in custom application lookups and referred inside plsql block
PLSQL as Whole
create or replace PROCEDURE dcf_move_order_approval (errbuf IN varchar2,
retcode IN varchar2,
p_move_order_number IN varchar2,
p_auto_run_mode IN varchar2,
p_timeout_days IN number) AS
l_header_id NUMBER;
BEGIN
for mo in (
select hd.header_id , header_status_name
from MTL_TXN_REQUEST_HEADERS_V hd
where transaction_type_name in ( select trim(description)
from apps.fnd_lookup_values
where lookup_type = 'DCF_MO_WF_AUTO_APPROVAL_TYPES'
and enabled_flag = 'Y'
and start_date_active <= sysdate
and nvl(end_date_active,sysdate)>= sysdate )
and hd.request_number = nvl(p_move_order_number,hd.request_number)
and trunc(hd.date_required) <= trunc(sysdate) - p_timeout_days
and hd.header_status_name in ('Pending Approval', 'Incomplete') ) loop
if p_auto_run_mode = 'INITIATE APPROVAL' and mo.header_status_name = 'Incomplete' then
invtroap.start_to_approval (to_header_id => mo.header_id,
item_type => 'INVTROAP',
item_key => to_char(mo.header_id) );
elsif p_auto_run_mode = 'AUTO APPROVAL' and mo.header_status_name = 'Pending Approval' then
Inv_trohdr_Util.Update_Row_Status(mo.header_id,
Inv_Globals.G_TO_STATUS_APPROVED);
for i in (select line_id from mtl_txn_request_lines where header_id = mo.header_id ) loop
Inv_trolin_Util.Update_Row_Status(i.line_id ,
INV_Globals.G_TO_STATUS_APPROVED);
end loop;
end if;
end loop;
COMMIT;
END;
Comments
Post a Comment