Oracle EBS – Workflow Basics – Hello World Workflow

--PLSQL Code Snippet to Invoke Workflow

--Create sequence XXLT_WF_S ; 

DECLARE
  p_x_item_type VARCHAR2(100);
  P_X_PROC_INT_NAME VARCHAR2(100);
  P_X_ATTRIBUTE1 VARCHAR2(100) ;
  x_itemkey number; 
  P_USER_NAME VARCHAR2(100) ; 

BEGIN
P_x_item_type :='XXSNWF'; --Item Internal Name 
P_X_PROC_INT_NAME := 'XXSN_FIRST_PROC'; --Process Name 
P_USER_NAME :='OPERATIONS' ; 

SELECT XXLT_WF_S.NEXTVAL INTO x_itemkey FROM DUAL;

  -- API used to create a Process.
  wf_engine.createprocess ( itemtype => p_x_item_type ,itemkey => x_itemkey ,
     process => p_x_proc_int_name);
  -- API used to set the userkey for the Workflow.
  wf_engine.setitemuserkey ( itemtype => p_x_item_type ,itemkey => x_itemkey ,
    userkey => x_itemkey);
  --  -- API used to set the Attribute value in a Workflow.
  WF_ENGINE.SETITEMATTRTEXT ( ITEMTYPE => P_X_ITEM_TYPE ,itemkey => x_itemkey,
      aname => 'XXPONUM' ,avalue => 'PO-ABC-123');
  -- API used to set the Item Owner for the Workflow.
  wf_engine.setitemowner ( itemtype => p_x_item_type ,ITEMKEY => X_ITEMKEY ,owner => P_USER_NAME);
  -- API used to Start Process, here Main Process.
  wf_engine.startprocess (p_x_item_type, x_itemkey);
  
  dbms_output.put_line( 'workflow completed successfully');
  COMMIT;
EXCEPTION
WHEN OTHERS THEN
  dbms_output.put_line( 'Exception Raised while Calling the Workflow... ' || SQLCODE || ' - ' || SQLERRM);
END;

Workfow Source Code – WFT File : https://drive.google.com/file/d/1OdmA488B6kuWxwwj_EujZLdxi6oJ9iEt/view?usp=sharing

Leave a Reply

Your email address will not be published.