DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_CLOSE_WF

Source


1 PACKAGE BODY OE_Close_WF as
2 /* $Header: OEXWCLOB.pls 120.1 2005/09/27 23:19:17 serla noship $ */
3 
4 PROCEDURE Close_Order(
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_header_id		NUMBER;
12 l_return_status	VARCHAR2(30);
13 l_msg_count		NUMBER;
14 l_msg_data		VARCHAR2(2000);
15 BEGIN
16 
17   --
18   -- RUN mode - normal process execution
19   --
20   if (funcmode = 'RUN') then
21 
22 	OE_STANDARD_WF.Set_Msg_Context(actid);
23 
24 	l_header_id	:= to_number(itemkey);
25 
26 	OE_ORDER_CLOSE_UTIL.Close_Order
27 			( p_api_version_number	=> 1.0
28 			, p_header_id			=> l_header_id
29 			, x_return_status		=> l_return_status
30 			, x_msg_count			=> l_msg_count
31 			, x_msg_data			=> l_msg_data
32 			);
33 
34 	IF l_return_status = FND_API.G_RET_STS_ERROR THEN
35 		resultout := 'COMPLETE:INCOMPLETE';
36 		OE_STANDARD_WF.Save_Messages;
37 		OE_STANDARD_WF.Clear_Msg_Context;
38 		return;
39 	ELSIF l_return_status = 'H' THEN
40 		resultout := 'COMPLETE:ON_HOLD';
41 		OE_STANDARD_WF.Save_Messages;
42 		OE_STANDARD_WF.Clear_Msg_Context;
43 		return;
44 	ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
45                 -- start data fix project
46 		-- OE_STANDARD_WF.Save_Messages;
47 		-- OE_STANDARD_WF.Clear_Msg_Context;
48                 -- end data fix project
49 		app_exception.raise_exception;
50      END IF;
51 
52     	resultout := 'COMPLETE:COMPLETE';
53 	OE_STANDARD_WF.Clear_Msg_Context;
54     	return;
55 
56   end if; -- End for 'RUN' mode
57 
58   --
59   -- CANCEL mode - activity 'compensation'
60   --
61   -- This is an event point is called with the effect of the activity must
62   -- be undone, for example when a process is reset to an earlier point
63   -- due to a loop back.
64   --
65   if (funcmode = 'CANCEL') then
66 
67     -- your cancel code goes here
68     null;
69 
70     -- no result needed
71     resultout := 'COMPLETE';
72     return;
73   end if;
74 
75 
76   --
77   -- Other execution modes may be created in the future.  Your
78   -- activity will indicate that it does not implement a mode
79   -- by returning null
80   --
81 --  resultout := '';
82 --  return;
83 
84 exception
85   when others then
86     -- The line below records this function call in the error system
87     -- in the case of an exception.
88     wf_core.context('OE_Close_WF', 'Close_Order',
89                     itemtype, itemkey, to_char(actid), funcmode);
90     -- start data fix project
91     OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
92                                           p_itemtype => itemtype,
93                                           p_itemkey => itemkey);
94     OE_STANDARD_WF.Save_Messages;
95     OE_STANDARD_WF.Clear_Msg_Context;
96     -- end data fix project
97     raise;
98 END Close_Order;
99 
100 PROCEDURE Close_Line(
101     itemtype  in varchar2,
102     itemkey   in varchar2,
103     actid     in number,
104     funcmode  in varchar2,
105     resultout in out NOCOPY /* file.sql.39 change */ varchar2)
106 IS
107 l_line_id		NUMBER;
108 l_return_status	VARCHAR2(30);
109 l_msg_count		NUMBER;
110 l_msg_data		VARCHAR2(2000);
111 BEGIN
112 
113   --
114   -- RUN mode - normal process execution
115   --
116   if (funcmode = 'RUN') then
117 
118 	OE_STANDARD_WF.Set_Msg_Context(actid);
119 
120 	l_line_id	:= to_number(itemkey);
121 
122 	OE_ORDER_CLOSE_UTIL.Close_Line
123 			( p_api_version_number	=> 1.0
124 			, p_line_id			=> l_line_id
125 			, x_return_status		=> l_return_status
126 			, x_msg_count			=> l_msg_count
127 			, x_msg_data			=> l_msg_data
128 			);
129 
130 	IF l_return_status = FND_API.G_RET_STS_ERROR THEN
131 		resultout := 'COMPLETE:INCOMPLETE';
132 		OE_STANDARD_WF.Save_Messages;
133 		OE_STANDARD_WF.Clear_Msg_Context;
134 		return;
135 	ELSIF l_return_status = 'H' THEN
136 		resultout := 'COMPLETE:ON_HOLD';
137 		OE_STANDARD_WF.Save_Messages;
138 		OE_STANDARD_WF.Clear_Msg_Context;
139 		return;
140 	ELSIF l_return_status = 'C' THEN
141                 resultout := OE_GLOBALS.G_WFR_COMPLETE || ':' || OE_GLOBALS.G_WFR_PENDING_ACCEPTANCE;
142 		OE_STANDARD_WF.Save_Messages;
143 		OE_STANDARD_WF.Clear_Msg_Context;
144 		return;
145 	ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
146                 -- start data fix project
147 		-- OE_STANDARD_WF.Save_Messages;
148 		-- OE_STANDARD_WF.Clear_Msg_Context;
149                 -- end data fix project
150 		app_exception.raise_exception;
151      END IF;
152 
153     	resultout := 'COMPLETE:COMPLETE';
154 	OE_STANDARD_WF.Clear_Msg_Context;
155     	return;
156 
157   end if; -- End for 'RUN' mode
158 
159   --
160   -- CANCEL mode - activity 'compensation'
161   --
162   -- This is an event point is called with the effect of the activity must
163   -- be undone, for example when a process is reset to an earlier point
164   -- due to a loop back.
165   --
166   if (funcmode = 'CANCEL') then
167 
168     -- your cancel code goes here
169     null;
170 
171     -- no result needed
172     resultout := 'COMPLETE';
173     return;
174   end if;
175 
176 
177   --
178   -- Other execution modes may be created in the future.  Your
179   -- activity will indicate that it does not implement a mode
180   -- by returning null
181   --
182 --  resultout := '';
183 --  return;
184 
185 exception
186   when others then
187     -- The line below records this function call in the error system
188     -- in the case of an exception.
189     wf_core.context('OE_Close_WF', 'Close_Line',
190                     itemtype, itemkey, to_char(actid), funcmode);
191     -- start data fix project
192     OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
193                                           p_itemtype => itemtype,
194                                           p_itemkey => itemkey);
195     OE_STANDARD_WF.Save_Messages;
196     OE_STANDARD_WF.Clear_Msg_Context;
197     -- end data fix project
198     raise;
199 END Close_Line;
200 
201 END OE_Close_WF;