0% found this document useful (0 votes)
15 views

Skip Script

This script loops through order lines that need to be processed by an interface and retries the workflow activity. It sets the correct organization context, retries the activity, and counts the number of successful retries.

Uploaded by

Shaikh Yasin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Skip Script

This script loops through order lines that need to be processed by an interface and retries the workflow activity. It sets the correct organization context, retries the activity, and counts the number of successful retries.

Uploaded by

Shaikh Yasin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

SET serveroutput ON;

DECLARE

CURSOR stuck
IS
SELECT ol.line_id,
ol.org_id
FROM oe_order_lines_all ol
WHERE ol.header_id in('16133224')
and ol.line_id in ('65034720')
AND NVL(ol.open_flag, 'Y') = 'Y'
AND NVL(ol.INVOICE_INTERFACE_STATUS_CODE,'N') <> 'YES';
l_file_val VARCHAR2(1000);
l_count NUMBER := 0;
err_msg VARCHAR2(240);
l_result VARCHAR2(30);

BEGIN
oe_debug_pub.debug_on;
oe_debug_pub.initialize;
l_file_val := OE_DEBUG_PUB.Set_Debug_Mode('FILE');
oe_Debug_pub.setdebuglevel(5);
dbms_output.put_line(' Inside the script');
dbms_output.put_line('file path is:'||l_file_val);

FOR I IN stuck
LOOP

IF NVL(MO_GLOBAL.get_current_org_id,-100) <> i.org_id THEN


OE_DEBUG_PUB.add('Setting Org Context to - ' || i.org_id );
Dbms_Output.put_line('Setting Org Context to - ' || i.org_id );
MO_GLOBAL.set_policy_context('S',i.org_id);
END IF;

BEGIN
OE_Standard_WF.OEOL_SELECTOR (p_itemtype => 'OEOL' ,p_itemkey =>
TO_CHAR(i.line_id) ,p_actid => 12345 ,p_funcmode => 'SET_CTX' ,p_result => l_result
);
EXCEPTION
WHEN OTHERS THEN
oe_Debug_pub.add('failed in selector call for line:'||i.line_id);
END;

BEGIN
oe_Debug_pub.add('retrying the Line Flow - Generic - Install Base Interface
activity for line:'||i.line_id);
wf_engine.handleerror('OEOL', TO_CHAR(i.line_id),
'FULFILL_LINE','SKIP',NULL);
oe_Debug_pub.add('Line Flow - Generic - Install Base Interface activity has
been Skip for line:'||i.line_id);
l_count:=l_count+1;
EXCEPTION
WHEN OTHERS THEN
oe_Debug_pub.add('Skip activity failed for line:'||i.line_id);
END;

END LOOP;

dbms_output.put_line('Number of lines processed successfully is:'||l_count);


oe_debug_pub.add('Script succesfully executed.');
dbms_output.put_line('Script succesfully executed.');
oe_debug_pub.debug_off;

EXCEPTION
WHEN OTHERS THEN
OE_DEBUG_PUB.ADD(' Script has an error : '||sqlerrm);
dbms_output.put_line(' Script has an error : '||sqlerrm);
ROLLBACK;
END;
/
COMMIT;

SPOOL OFF;

You might also like