1 Package body OE_SERVICE_WF As
2 /* $Header: OEXSVWFB.pls 120.0 2005/06/01 01:30:46 appldev noship $ */
3
4
5 PROCEDURE Set_Line_Service_Credit(
6 itemtype in varchar2,
7 itemkey in varchar2,
8 actid in number,
9 funcmode in varchar2,
10 resultout in out NOCOPY /* file.sql.39 change */ varchar2)
11 IS
12
13 l_line_id NUMBER;
14 l_return_status VARCHAR2(30);
15 l_result_out VARCHAR2(240);
16 l_msg_count NUMBER;
17 l_msg_data VARCHAR2(2000);
18 l_credit_type VARCHAR2(30);
19 l_serviceable_flag VARCHAR2(30);
20
21 BEGIN
22
23 --
24 -- RUN mode - normal process execution
25 --
26
27 if (funcmode = 'RUN') then
28
29 OE_STANDARD_WF.Set_Msg_Context(actid);
30
31 l_line_id := to_number(itemkey);
32
33 -- Get Workflow Activity Attribute Service Credit Type.
34 l_credit_type := wf_engine.GetActivityAttrText(itemtype,itemkey, actid,'SERVICE_CREDIT_TYPE');
35
36 SELECT NVL(m.serviceable_product_flag, 'N')
37 INTO l_serviceable_flag
38 FROM oe_order_lines l,
39 mtl_system_items m
40 WHERE l.line_id = l_line_id
41 AND l.inventory_item_id = m.inventory_item_id
42 AND m.organization_id = to_number(OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID'));
43
44 If NVL(l_serviceable_flag, 'N')= 'Y' Then
45 Update oe_order_lines_all
46 Set service_credit_eligible_code = l_credit_type
47 Where line_id=l_line_id;
48
49 Else
50 Update oe_order_lines_all
51 Set service_credit_eligible_code = 'NONE'
52 Where line_id=l_line_id;
53
54 End If;
55
56 resultout := 'COMPLETE';
57 OE_STANDARD_WF.Clear_Msg_Context;
58 return;
59
60 end if; -- End for 'RUN' mode
61
62 --
63 -- CANCEL mode - activity 'compensation'
64 --
65 -- This is an event point is called with the effect of the activity must
66 -- be undone, for example when a process is reset to an earlier point
67 -- due to a loop back.
68 --
69 if (funcmode = 'CANCEL') then
70
71 -- your cancel code goes here
72 null;
73
74 -- no result needed
75 resultout := 'COMPLETE';
76 return;
77 end if;
78
79
80 --
81 -- Other execution modes may be created in the future. Your
82 -- activity will indicate that it does not implement a mode
83 -- by returning null
84 --
85 -- resultout := '';
86 -- return;
87
88 exception
89 when others then
90 -- The line below records this function call in the error system
91 -- in the case of an exception.
92 wf_core.context('OE_Service_WF', ' Set_Line_Service_Credit',
93 itemtype, itemkey, to_char(actid), funcmode);
94 raise;
95 END Set_Line_Service_Credit;
96
97 END OE_SERVICE_WF;