1.5.1.5. WF leri PL/SQL kodu ile çalıştırma
WF ler PL/SQL tarafında procedure ile de çalıştırılabilir...
Bu tür procedure lerin saklandığı package
APPS.WF_ENGINE
dir. Bu package in kullandigi diger package ise
APPS.WF_STANDARD
tir.
PL/SQL tarafında çalıştırmak için
BEGIN
wf_engine.launchprocess ('XXYSMMRC', '13', 'BASLA', '', 'SYSADMIN');
commit;
END;
Şeklinde yazabiliriz.
Fakat
Yukarıdaki gibi takılıp kalacaktır.Çünkü değişkenlerimizi tanımlamadık...
Onu yerine...
DECLARE
itemtype VARCHAR2 (200);
itemkey VARCHAR2 (200);
process VARCHAR2 (200);
user_key VARCHAR2 (200);
owner_role VARCHAR2 (200);
aname VARCHAR2 (200);
avalue VARCHAR2 (200);
BEGIN
itemtype := 'XXYSMMRC';
itemkey := '17';
process := 'BASLA';
user_key := '';
owner_role := 'SYSADMIN';
aname := 'ONAYLAYAN';
avalue := 'SYSADMIN';
apps.wf_engine.createprocess (itemtype,
itemkey,
process,
user_key,
owner_role
);
apps.wf_engine.setitemattrtext (itemtype, itemkey, aname, avalue);
apps.wf_engine.startprocess (itemtype, itemkey);
commit;
END;
Şeklinde tanımlanıp yeniden çalıştırılabilir…
Gerekli onaylamalar yapıldıktan sonra yukarıdaki gibi şekillenir...
Procedure ler içerisine exception kısımlarında raise olarak hata vermesini istiyorsak mutlaka eklememiz gerekmektedir...
Procedure yüzünden hata ile biten WF ler procedure duzenlendikten sonra yeniden çalıştırılabilir...
1.5.1.6. Sistem Yönetimi Kısmı
Sistem yönetimi kullanıcısı ile giriş yaptıktan sonra
İş akışı ekranına girilir...
Burada ilgili düzenlemeler yapılabilir...
Submit Request For aşamasında yazılan
Background Engines : Eş zamanlı taleplerle beraber çalışan procedure lerdir... Bunların düzenlenmesi yapılabilir...
İş akışı arkaplan işlemcisi concurrentu normalde çizelgelenir ve yarım kalan (ertelenen, kesilen,takılan) WF leri belirli zamanlarda tekrar çalıştırılabilir.. Bu conc. sadece belirli WF ler içinde çizelgelenebilir...
Purge : Bu fonk. ile tamamlanmış wf leri silebiliyoruz. Pruge paramatreleri önemli.... kaç günde bir , kaç gün öncesi için vs.vs.
Kuyrukta hatalı kayıtların kalmaması için
Job_queue_processes parametresinin 0 a alınıp WF lerin bitmesini bekleyip tekrar eski değerine getirmek gerekir...
1.5.1.7. WF leri PL/SQL ile takip etme
WorkFlow takibini yapabilmek için kullanılabilecek sorgular aşağıdadır...
-- Work Flowların durumlarının sorgulanması
SELECT wi.item_type, wi.item_key, wi.root_activity,
wa.display_name process_name, wi.root_activity_version,
wi.owner_role, wi.parent_item_type, wi.parent_item_key,
wi.parent_context, wi.begin_date, wi.end_date, wi.user_key, wit.NAME,
wit.display_name,
wf_directory.getroledisplayname (wi.owner_role) role_name,
wf_fwkmon.getitemstatus (wi.item_type,
wi.item_key,
wi.end_date,
wi.root_activity,
wi.root_activity_version
) status_code,
wf_fwkmon.getroleemailaddress (wi.owner_role) role_email,
DECODE ((SELECT COUNT (0)
FROM wf_items wi2
WHERE wi.item_type = wi2.parent_item_type
AND wi.item_key = wi2.parent_item_key),
0, 'WfMonNoChildren',
'WfMonChildrenExist'
) child_switcher
FROM applsys.wf_items wi, wf_item_types_vl wit, wf_activities_vl wa
WHERE wi.item_type = wit.NAME(+)
AND wa.item_type(+) = wi.item_type
AND wa.NAME(+) = wi.root_activity
AND wa.VERSION(+) = wi.root_activity_version
AND wi.item_type = 'XXYSMMRC'
ORDER BY wi.begin_date DESC;
-- Activity Detail Full
SELECT wias.process_activity AS process_activity,
wias.activity_status AS activity_status, wa.TYPE AS activity_type,
wa.display_name AS activity_display_name,
wa2.display_name AS parent_activity_display,
wpa.activity_name AS activity_name,
wpa.process_name AS parent_activity, wias.item_type AS item_type,
wias.item_key AS item_key, wi.user_key AS user_key,
wias.notification_id AS notification_id,
wias.assigned_user AS assigned_user,
wf_notification.getsubject (wias.notification_id) AS subject,
wf_fwkmon.getroleemailaddress
(wias.assigned_user)
AS role_email_address,
wf_directory.getroledisplayname
(wias.assigned_user)
AS role_display_name,
wl.meaning AS activity_status_display,
wl2.meaning AS activity_type_display, wa.result_type AS result_type,
wpa.default_result AS default_result, wias.due_date AS due_date,
wpa.instance_label AS instance_label, wias.begin_date AS begin_date,
wias.end_date AS end_date, wa.description AS description,
wa.VERSION AS VERSION, wa.rerun AS rerun,
wa.expand_role AS expand_role, wa.FUNCTION AS FUNCTION,
wa.COST AS COST, wa.function_type AS function_type,
wa.runnable_flag AS runnable_flag, wa.MESSAGE AS MESSAGE,
wa.error_item_type AS error_item_type,
wit.display_name AS error_item_type_display,
wa.error_process AS error_process,
wpa.perform_role_type AS perform_role_type,
wpa.perform_role AS perform_role, wpa.user_comment AS user_comment,
wias.activity_result_code AS activity_status_result_code,
wf_core.activity_result
(wa.result_type,
DECODE (wias.activity_result_code,
'#NULL', 'NULL',
wias.activity_result_code
)
) AS act_stat_result_disp,
wf_core.activity_result
(wa.result_type,
DECODE (wpa.default_result,
'#NULL', 'NULL',
wpa.default_result
)
) AS act_usage_result_disp,
fl.meaning AS expand_role_display,
fl3.meaning AS function_type_display,
wlt.display_name AS result_type_display, fl2.meaning AS rerun_display,
fl4.meaning AS perform_role_type_display, wpa.start_end AS start_end,
fl5.meaning AS start_end_display,
DECODE (waav.value_type,
'CONSTANT', TO_CHAR (waav.number_value),
waav.text_value
) AS TIMEOUT
FROM wf_item_activity_statuses wias,
wf_process_activities wpa,
wf_activities_vl wa,
wf_activities_vl wa2,
wf_items wi,
wf_lookups wl,
wf_lookups wl2,
fnd_lookups fl,
fnd_lookups fl2,
fnd_lookups fl3,
fnd_lookups fl4,
fnd_lookups fl5,
wf_item_types_vl wit,
wf_lookup_types wlt,
wf_activity_attr_values waav
WHERE wias.item_type = wi.item_type
AND wias.item_key = wi.item_key
AND wias.process_activity = wpa.instance_id
AND wpa.activity_name = wa.NAME
AND wpa.activity_item_type = wa.item_type
AND wi.begin_date BETWEEN wa.begin_date AND NVL (wa.end_date,
wi.begin_date)
AND wpa.process_name = wa2.NAME
AND wpa.process_item_type = wa2.item_type
AND wpa.process_version = wa2.VERSION
AND wias.activity_status = wl.lookup_code
AND wl.lookup_type = 'WFENG_STATUS'
AND wa.TYPE = wl2.lookup_code
AND wl2.lookup_type = 'WFENG_ACTIVITY_TYPE'
AND wa.error_item_type = wit.NAME
AND wa.expand_role = fl.lookup_code
AND fl.lookup_type = 'YES_NO'
AND wa.result_type = wlt.lookup_type(+)
AND wa.rerun = fl2.lookup_code
AND fl2.lookup_type = 'FND_WF_ON_REVISIT'
AND DECODE (wa.TYPE,
'FUNCTION', NVL (wa.function_type, 'PLSQL'),
wa.function_type
) = fl3.lookup_code(+)
AND 'FND_WF_FUNCTION_TYPE' = fl3.lookup_type(+)
AND wpa.start_end = fl5.lookup_code(+)
AND 'FND_WF_START_END' = fl5.lookup_type(+)
AND wpa.perform_role_type = fl4.lookup_code
AND fl4.lookup_type = 'FND_WF_VALUE_SOURCE'
AND wias.process_activity = waav.process_activity_id(+)
AND '#TIMEOUT' = waav.NAME(+)
AND wias.item_type = 'XXYSMMRC'
AND wias.item_key = '17';
-- Activity Detail
SELECT wias.process_activity AS process_activity,
wias.activity_status AS activity_status, wa.TYPE AS activity_type,
wa.display_name AS activity_display_name,
wa2.display_name AS parent_activity_display,
wpa.activity_name AS activity_name,
wpa.process_name AS parent_activity, wias.item_type AS item_type,
wias.item_key AS item_key, wi.user_key AS user_key,
wias.notification_id AS notification_id,
wias.assigned_user AS assigned_user,
wf_notification.getsubject (wias.notification_id) AS subject,
wf_fwkmon.getroleemailaddress
(wias.assigned_user)
AS role_email_address,
wf_directory.getroledisplayname
(wias.assigned_user)
AS role_display_name,
wl.meaning AS activity_status_display,
wl2.meaning AS activity_type_display, wa.result_type AS result_type,
wpa.default_result AS default_result, wias.due_date AS due_date,
wpa.instance_label AS instance_label,
wi.root_activity AS root_activity, wit.display_name AS display_name
FROM wf_item_activity_statuses wias,
wf_process_activities wpa,
wf_activities_vl wa,
wf_activities_vl wa2,
wf_items wi,
wf_lookups wl,
wf_lookups wl2,
wf_item_types_vl wit
WHERE wias.item_type = wi.item_type
AND wias.item_key = wi.item_key
AND wias.process_activity = wpa.instance_id
AND wpa.activity_name = wa.NAME
AND wpa.activity_item_type = wa.item_type
AND wi.begin_date BETWEEN wa.begin_date AND NVL (wa.end_date,
wi.begin_date)
AND wpa.process_name = wa2.NAME
AND wpa.process_item_type = wa2.item_type
AND wpa.process_version = wa2.VERSION
AND wias.activity_status = wl.lookup_code
AND wl.lookup_type = 'WFENG_STATUS'
AND wa.TYPE = wl2.lookup_code
AND wl2.lookup_type = 'WFENG_ACTIVITY_TYPE'
AND wit.NAME = wias.item_type
AND wias.item_type = 'XXYSMMRC'
AND wias.item_key = '1';
-- Activity Detail Error
SELECT wias.process_activity AS process_activity,
wias.error_name AS error_name, wias.error_message AS error_message,
wias.error_stack AS error_stack,
wa.display_name AS activity_display_name, wa.TYPE AS activity_type,
wl.meaning AS activity_type_display, wias.item_type AS item_type,
wias.item_key AS item_key, wi.user_key AS user_key,
wias.begin_date AS begin_date, wias.execution_time AS execution_time
FROM wf_item_activity_statuses wias,
wf_activities_vl wa,
wf_process_activities wpa,
wf_lookups wl,
wf_items wi
WHERE wias.activity_status = 'ERROR'
AND wias.item_type = wi.item_type
AND wias.item_key = wi.item_key
AND wi.begin_date BETWEEN wa.begin_date AND NVL (wa.end_date,
wi.begin_date)
AND wias.process_activity = wpa.instance_id
AND wpa.activity_name = wa.NAME
AND wpa.activity_item_type = wa.item_type
AND wa.TYPE = wl.lookup_code
AND wl.lookup_type = 'WFENG_ACTIVITY_TYPE'
AND wias.item_type = 'XXYSMMRC'
AND wias.item_key = '1';
SELECT meaning AS meaning, lookup_code AS lookup_code
FROM wf_lookups
WHERE lookup_type = :1
UNION ALL
SELECT meaning AS meaning, lookup_code AS lookup_code
FROM wf_lookups
WHERE lookup_type = 'WFENG_RESULT' AND lookup_code = '#TIMEOUT';
--Activity Statuler
SELECT lookup_code, meaning
FROM fnd_lookups
WHERE lookup_type = 'FND_WF_ACTIVITY_STATUS_LIST';
--Workflow status
SELECT lookup_code, meaning
FROM fnd_lookups
WHERE lookup_type = 'FND_WF_PROCESS_STATUS_LIST'
AND lookup_code IN ('ANY', 'IN_PROCESS', 'ERROR', 'COMPLETE');
--Child Workflows
SELECT workflowitemeo.item_type, workflowitemeo.item_key,
workflowitemeo.root_activity, workflowitemeo.root_activity_version,
workflowitemeo.owner_role, workflowitemeo.parent_item_type,
workflowitemeo.parent_item_key, workflowitemeo.parent_context,
workflowitemeo.begin_date, workflowitemeo.end_date,
workflowitemeo.user_key, workflowitemtypeeo.NAME,
workflowitemtypeeo.display_name,
wf_directory.getroledisplayname
(workflowitemeo.owner_role)
AS role_name,
wf_fwkmon.getitemstatus
(workflowitemeo.item_type,
workflowitemeo.item_key,
workflowitemeo.end_date,
workflowitemeo.root_activity,
workflowitemeo.root_activity_version
) AS status_code,
wf_fwkmon.getroleemailaddress (workflowitemeo.owner_role)
AS role_email,
DECODE
(wf_fwkmon.getitemstatus (workflowitemeo.item_type,
workflowitemeo.item_key,
workflowitemeo.end_date,
workflowitemeo.root_activity,
workflowitemeo.root_activity_version
),
'FORCE', 'WfStatusAborted',
'ERROR', 'WfStatusError',
'COMPLETE', 'WfStatusComplete',
'COMPLETE_WITH_ERRORS', 'WfStatusCompleteError',
'SUSPEND', 'WfStatusSuspended',
'SUSPEND_WITH_ERRORS', 'WfStatusError',
'WfStatusActive'
) AS status_image,
DECODE
(wf_fwkmon.getitemstatus (workflowitemeo.item_type,
workflowitemeo.item_key,
workflowitemeo.end_date,
workflowitemeo.root_activity,
workflowitemeo.root_activity_version
),
'ERROR', 'WfStatusErrorText',
'COMPLETE_WITH_ERRORS', 'WfStatusErrorText',
'SUSPEND_WITH_ERRORS', 'WfStatusErrorText',
'WfStatusNoterrText'
) AS status_text,
fl.meaning AS status, wit.display_name AS parent_item_display_name,
wa.display_name AS root_activity_display_name
FROM wf_items workflowitemeo,
wf_item_types_vl workflowitemtypeeo,
fnd_lookups fl,
wf_item_types_vl wit,
wf_activities_vl wa
WHERE workflowitemeo.item_type = workflowitemtypeeo.NAME
AND fl.lookup_type = 'FND_WF_PROCESS_STATUS_LIST'
AND fl.lookup_code =
wf_fwkmon.getitemstatus (workflowitemeo.item_type,
workflowitemeo.item_key,
workflowitemeo.end_date,
workflowitemeo.root_activity,
workflowitemeo.root_activity_version
)
AND workflowitemeo.parent_item_type = wit.NAME(+)
AND workflowitemeo.root_activity = wa.NAME
AND workflowitemeo.root_activity_version = wa.VERSION
AND workflowitemeo.item_type = wa.item_type
AND wias.item_type = 'XXYSMMRC'
AND wias.item_key = '1';
SELECT workflowitemeo.item_type, workflowitemeo.item_key,
workflowitemeo.root_activity, activityeo.display_name process_name,
workflowitemeo.root_activity_version, workflowitemeo.owner_role,
workflowitemeo.parent_item_type, workflowitemeo.parent_item_key,
workflowitemeo.parent_context, workflowitemeo.begin_date,
workflowitemeo.end_date, workflowitemeo.user_key,
workflowitemtypeeo.NAME, workflowitemtypeeo.display_name,
wf_directory.getroledisplayname
(workflowitemeo.owner_role)
AS role_name,
wf_fwkmon.getitemstatus
(workflowitemeo.item_type,
workflowitemeo.item_key,
workflowitemeo.end_date,
workflowitemeo.root_activity,
workflowitemeo.root_activity_version
) AS status_code,
wf_fwkmon.getroleemailaddress (workflowitemeo.owner_role)
AS role_email,
DECODE ((SELECT COUNT (0)
FROM wf_items wi2
WHERE workflowitemeo.item_type = wi2.parent_item_type
AND workflowitemeo.item_key = wi2.parent_item_key),
0, 'WfMonNoChildren',
'WfMonChildrenExist'
) AS child_switcher
FROM wf_items workflowitemeo,
wf_item_types_vl workflowitemtypeeo,
wf_activities_vl activityeo
WHERE workflowitemeo.item_type = workflowitemtypeeo.NAME
AND activityeo.item_type = workflowitemeo.item_type
AND activityeo.NAME = workflowitemeo.root_activity
AND activityeo.VERSION = workflowitemeo.root_activity_version;
--MsgRespAttributesVO.xml
SELECT m.NAME AS NAME, m.display_name AS display_name,
m.description AS description, m.TYPE AS TYPE, m.format AS format,
m.MESSAGE_TYPE AS MESSAGE_TYPE, m.message_name AS message_name,
wna.text_value AS text_value, wna.number_value AS number_value,
wna.date_value AS date_value, wna.notification_id AS notification_id,
wna.NAME AS attribute_name, m.SEQUENCE AS SEQUENCE
FROM wf_notification_attributes wna,
wf_message_attributes_vl m,
wf_notifications wn
WHERE wn.notification_id = :1
AND wn.notification_id = wna.notification_id
AND m.message_name = wn.message_name
AND m.MESSAGE_TYPE = wn.MESSAGE_TYPE
AND m.NAME = wna.NAME
AND m.SUBTYPE = 'RESPOND'
AND m.TYPE NOT IN ('FORM', 'URL', 'DOCUMENT')
AND wna.NAME <> 'RESULT'
AND SUBSTR (wna.NAME, 1, 1) <> '#';
--NotificationDetailsVO.xml
SELECT wn.notification_id AS notification_id, wn.GROUP_ID AS GROUP_ID,
wn.recipient_role AS recipient_role,
wn.original_recipient AS original_recipient,
wn.mail_status AS mail_status, wn.due_date AS due_date,
wn.begin_date AS begin_date, wn.end_date AS end_date,
wn.status AS status, wn.priority AS priority,
wn.user_comment AS user_comment,
wf_notification.getsubject (wn.notification_id) AS subject,
NVL
(wf_directory.getroledisplayname2 (wn.recipient_role),
NVL (wn.to_user, wn.recipient_role)
) AS recipient_display,
NVL
(wf_directory.getroledisplayname2 (wn.original_recipient),
DECODE (wn.original_recipient,
wn.recipient_role, wn.to_user,
wn.original_recipient
)
) AS orig_recipient_display,
wf_fwkmon.getroleemailaddress (wn.recipient_role) AS recipient_email,
wf_fwkmon.getroleemailaddress
(wn.original_recipient)
AS orig_recipient_email,
NVL
(wf_fwkmon.getntfrespondername (wn.notification_id),
wn.responder
) AS responder_display
FROM wf_notifications wn
WHERE notification_id = :1;
1.5.1.8. Event Oluşturma
WF_EVENT package ile kontrol yapılabilir...
Dış sistemlerden gelen bilgiler veya iç sistemde oluşan olayların başında sonunda gibi durumlarda ilgili procedureler çalıştırılabilir...
Node Attribute değerleri atanabilir...
XXYSM_DENEME_WF2 fonksiyonuna gelindiginde MAIL_CONTENTS değişkenine bir değer atayabiliriz... Onun için önce değişkeni fonksiyona atariz...
MAIL_CONTENTS değişkeni sürükle bırak yöntemi ile XXYSM_DENEME_WF2 functionunun altıan bırakılır...Ardından
Değişken Node Attributes kısmında tanımlanır...
Body kısmında değişken &MAIL_CONTENT2 şeklinde eklenebilir...
Görüldüğü gibi mail_content bizim yaptığımız şekilde gelmiş...
XXYSMNOTIFY1 kısmına gelip orada düzenleyerek tekrar bu değişkenin kullanılmasını sağlayabiliriz...
1.6. Notlar
İş akışlarını takip edebilmek için kullanicilara menu yetkisi verilir... Sadece bildirimleri gorebilmek için ayar yapılabiliyor...
Loglari alabiliyoruz.. Ama belirli surelerde siliniyor.. Onun ayarını biz yapiyoruz... Bu ayar çok detaylı olabilir...
Function :
On revisit hata oldugunda neler yapacagini soyler...
Her function bir start ile başlar bir end ile biter...
Cost tahmini calisma süresini verir..
Node kisminda:
Nereye dogru yonlenecegi belirlenir...
Start / End kismindaki degerleri bunlarin
Performer : Bir onaylayıcı tarafından oanyalanacak ise secilmeli..
Node Attribute : Bu aşamaya gelindiginde sunun degeri su olsun seklinde ise onun ayarlari yapılır...
ItemType : InternalName
Actid her bir asamaya numara veriliyor onun nosu
Funcmode : run , debug, cancel gibi değerler alır..
ReseultOut procedure den dönen değeri temsil eder...
Log almak için
WF_CORE.CONTEXT
Procedure u çalıştırılır...
1 yorum:
Güzel bir çalışma olmuş tebrikler...
Yorum Gönder