Launch Workflow

How to Launch Workflow?

Following APIs used to Launch Workflow


declare

cursor c1 is
select incident_no,CREATED_BY_USER_ID from org_sr_summary a
where trunc(create_dt) = trunc(sysdate) and incident_no = '1203950'
and not exists ( select 1 from org_incident_history b where a.incident_no = b.incident_id);


v_return_status varchar2(150);

v_msg_count number;
v_msg_data varchar2(150);
v_itemkey varchar2(150);
v_initiator_user_id number;
v_count number := 0;
v_null number:=0;

begin


For i in c1

Loop


begin

select workflow_process_id into v_null
from cs_incidents_all_b
where incident_number = TO_CHAR(i.incident_no)
and workflow_process_id is null ;
exception
when no_data_found then dbms_output.put_line('Exception');
end;

if v_null is null then


CS_WORKFLOW_PUB.LAUNCH_SERVEREQ_WORKFLOW(p_api_version => 1

,p_init_msg_list => FND_API.G_FALSE
,p_commit => FND_API.G_FALSE
,p_return_status => v_return_status
,p_msg_count => v_msg_count
,p_msg_data => v_msg_data
,p_request_number => i.incident_no
,p_initiator_user_id => i.CREATED_BY_USER_ID
,p_initiator_resp_id => NULL
,p_initiator_resp_appl_id => NULL
,p_itemkey => v_itemkey
, p_nowait => FND_API.G_FALSE);

v_count := v_count + 1;

end if;

END LOOP;

dbms_output.put_line('total count = '||v_count);
commit;
end;



SELECT b.process_name, b.instance_label, a.activity_result_code,

a.activity_status, a.item_key
FROM wf_item_activity_statuses a, wf_process_activities b
WHERE a.process_activity = b.instance_id
AND a.item_type = 'SERVEREQ'
AND a.item_key LIKE '1203968%'
AND a.activity_status = 'DEFERRED'

begin

wf_engine.handleerror(itemtype => 'SERVEREQ',
itemkey => '1203968-757581',
activity => 'XX_WF:STANDARDWAIT-1' ,
command => 'RETRY');
commit;
end;



declare

 cursor c1 is
 select incident_no,CREATED_BY_USER_ID from org_sr_summary a
 where trunc(create_dt) = trunc(sysdate) and incident_no = 1199236;
 --and not exists ( select 1 from org_incident_history b where a.incident_no = b.incident_id);
  v_return_status        varchar2(150);
  v_msg_count            number;
  v_msg_data            varchar2(150);
  v_itemkey                varchar2(150);
  v_initiator_user_id   number;
  v_count                number := 0;
  v_null                number:=0;
begin
     For i in c1
     Loop
      begin
      select workflow_process_id into v_null
      from      cs_incidents_all_b
      where  incident_number = TO_CHAR(i.incident_no)
      and  workflow_process_id is null ;
      exception
      when no_data_found then null;
      end;
      if v_null is null then
      CS_WORKFLOW_PUB.LAUNCH_SERVEREQ_WORKFLOW(p_api_version                    => 1
                                             ,p_init_msg_list                 => FND_API.G_FALSE
                                             ,p_commit                       => FND_API.G_FALSE
                                             ,p_return_status               => v_return_status
                                             ,p_msg_count                   => v_msg_count   
                                             ,p_msg_data                       => v_msg_data
                                             ,p_request_number               => i.incident_no
                                             ,p_initiator_user_id              => i.CREATED_BY_USER_ID
                                             ,p_initiator_resp_id              => NULL
                                             ,p_initiator_resp_appl_id        => NULL
                                             ,p_itemkey                       => v_itemkey
                                             , p_nowait                           => FND_API.G_FALSE);
    v_count := v_count + 1;
     IF v_msg_count > 0 THEN
        FOR I IN 1..v_msg_count LOOP
        dbms_output.put_line('I.'|| SUBSTR (FND_MSG_PUB.Get(p_encoded =>FND_API.G_FALSE ), 1, 255));
        END LOOP;
    END IF;
    end if;
   END LOOP;   
    dbms_output.put_line('total count = '||v_count);
    dbms_output.put_line('return status = '||v_return_status);
        dbms_output.put_line(' v_msg_data = '|| v_msg_data);
    dbms_output.put_line('  v_itemkey = '|| v_itemkey); 
commit;
end;




No comments:

ORA-01552: cannot use system rollback segment for non-system tablespace 'TEMP'

 ORA-01552: cannot use system rollback segment for non-system tablespace "string" Cause: Used the system rollback segment for non...