1 PACKAGE BODY OE_Reprice_WF as
2 /* $Header: OEXWREPB.pls 120.0 2005/06/01 23:19:58 appldev noship $ */
3
4 PROCEDURE Start_Repricing(
5 itemtype in varchar2,
6 itemkey in varchar2,
7 actid in number,
8 funcmode in varchar2,
9 resultout in out NOCOPY /* file.sql.39 change */ varchar2)
10 IS
11 l_line_id NUMBER;
12 l_return_status VARCHAR2(30);
13 l_result_out VARCHAR2(240);
14 l_msg_count NUMBER;
15 l_msg_data VARCHAR2(2000);
16 --
17 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
18 --
19 BEGIN
20
21 --
22 -- RUN mode - normal process execution
23 --
24 IF l_debug_level > 0 THEN
25 oe_debug_pub.add( 'ENTERING OE_REPRICE_WF.START_REPRICING '||ITEMTYPE||'/'||ITEMKEY , 1 ) ;
26 END IF;
27 if (funcmode = 'RUN') then
28
29 OE_STANDARD_WF.Set_Msg_Context(actid);
30
31 l_line_id := to_number(itemkey);
32
33 IF l_debug_level > 0 THEN
34 oe_debug_pub.add( 'CALLING OE_LINE_REPRICE.PROCESS_REPRICING '||TO_CHAR ( L_LINE_ID ) , 2 ) ;
35 END IF;
36 OE_Line_Reprice.Process_Repricing
37 ( p_api_version_number => 1.0
38 , p_line_id => l_line_id
39 , p_activity_id => actid
40 , x_result_out => l_result_out
41 , x_return_status => l_return_status
42 , x_msg_count => l_msg_count
43 , x_msg_data => l_msg_data
44 );
45
46 IF l_debug_level > 0 THEN
47 oe_debug_pub.add( 'RETURNED FROM OE_LINE_REPRICE.PROCESS_REPRICING '||L_RETURN_STATUS , 2 ) ;
48 END IF;
49 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
50 OE_STANDARD_WF.Save_Messages;
51 OE_STANDARD_WF.Clear_Msg_Context;
52 -- app_exception.raise_exception;
53 END IF;
54
55 resultout := l_result_out;
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_Reprice_WF', 'Repricing',
93 itemtype, itemkey, to_char(actid), funcmode);
94 -- start data fix project
95 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
96 p_itemtype => itemtype,
97 p_itemkey => itemkey);
98 OE_STANDARD_WF.Save_Messages;
99 OE_STANDARD_WF.Clear_Msg_Context;
100 -- end data fix project
101 raise;
102 END Start_Repricing;
103
104 PROCEDURE Start_Repricing_Holds(
105 itemtype in varchar2,
106 itemkey in varchar2,
107 actid in number,
108 funcmode in varchar2,
109 resultout in out NOCOPY /* file.sql.39 change */ varchar2)
110 IS
111 l_line_id NUMBER;
112 l_return_status VARCHAR2(30);
113 l_result_out VARCHAR2(240);
114 l_msg_count NUMBER;
115 l_msg_data VARCHAR2(2000);
116 --
117 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
118 --
119 BEGIN
120
121 IF l_debug_level > 0 THEN
122 oe_debug_pub.add( 'ENTERING OE_REPRICE_WF.START_REPRICING_HOLDS '||ITEMTYPE||'/'||ITEMKEY , 1 ) ;
123 END IF;
124 if (funcmode = 'RUN') then
125
126 OE_STANDARD_WF.Set_Msg_Context(actid);
127
128 -- check activity specific hold only
129 OE_HOLDS_PUB.CHECK_HOLDS(p_api_version => 1.0,
130 p_line_id => to_number(itemkey),
131 p_wf_item => OE_GLOBALS.G_WFI_LIN,
132 p_wf_activity => 'REPRICE_LINE',
133 p_chk_act_hold_only => 'Y',
134 x_result_out => l_result_out,
135 x_return_status => l_return_status,
136 x_msg_count => l_msg_count,
137 x_msg_data => l_msg_data);
138
139 IF ( l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
140 OE_STANDARD_WF.Save_Messages;
141 OE_STANDARD_WF.Clear_Msg_Context;
142 resultout := 'INCOMPLETE';
143 RETURN;
144 ELSIF (l_result_out = FND_API.G_TRUE ) THEN
145 resultout := 'ON_HOLD';
146 oe_line_reprice.set_reprice_status('REPRICE_HOLD', to_number(itemkey));
147 OE_STANDARD_WF.Clear_Msg_Context;
148 RETURN;
149 END IF;
150
151 -- call start_repricing to minimize dual maitainance of code
152 Start_Repricing(itemtype,
153 itemkey,
154 actid,
155 funcmode,
156 resultout);
157
158 IF resultout ='COMPLETE' then
159 oe_line_reprice.set_reprice_status('REPRICE_COMPLETE', to_number(itemkey));
160 END IF;
161
162 return;
163
164 end if; -- End for 'RUN' mode
165
166 --
167 -- CANCEL mode - activity 'compensation'
168 --
169 -- This is an event point is called with the effect of the activity must
170 -- be undone, for example when a process is reset to an earlier point
171 -- due to a loop back.
172 --
173 if (funcmode = 'CANCEL') then
174
175 -- your cancel code goes here
176 null;
177
178 -- no result needed
179 resultout := 'COMPLETE';
180 return;
181 end if;
182
183
184 --
185 -- Other execution modes may be created in the future. Your
186 -- activity will indicate that it does not implement a mode
187 -- by returning null
188 --
189 -- resultout := '';
190 -- return;
191
192 exception
193 when others then
194 -- The line below records this function call in the error system
195 -- in the case of an exception.
196 wf_core.context('OE_Reprice_WF', 'Start_Repricing_Holds',
197 itemtype, itemkey, to_char(actid), funcmode);
198 -- start data fix project
199 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
200 p_itemtype => itemtype,
201 p_itemkey => itemkey);
202 OE_STANDARD_WF.Save_Messages;
203 OE_STANDARD_WF.Clear_Msg_Context;
204 -- end data fix project
205 raise;
206 END Start_Repricing_Holds;
207
208 END OE_Reprice_WF;