1 PACKAGE BODY OE_Inv_Iface_WF AS
2 /* $Header: OEXWIIFB.pls 120.0 2005/06/01 23:12:20 appldev noship $ */
3 PROCEDURE Inventory_Interface
4 ( itemtype IN VARCHAR2
5 , itemkey IN VARCHAR2
6 , actid IN NUMBER
7 , funcmode IN VARCHAR2
8 , resultout IN OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9 ) IS
10 l_result_out VARCHAR2(30);
11 l_return_status VARCHAR2(30);
12 l_line_id NUMBER;
13 BEGIN
14
15 --
16 -- RUN mode - normal process execution
17 --
18 IF (funcmode = 'RUN') THEN
19
20 OE_STANDARD_WF.Set_Msg_Context(actid);
21
22 IF itemtype = OE_GLOBALS.G_WFI_LIN THEN
23 l_line_id := to_number(itemkey);
24 ELSE
25 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
26 END IF;
27
28
29 OE_Inv_Iface_PVT.Inventory_Interface(p_line_id => l_line_id,
30 x_return_status => l_return_status,
31 x_result_out => l_result_out);
32
33
34 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
35 IF l_result_out = OE_GLOBALS.G_WFR_COMPLETE THEN
36 resultout := OE_GLOBALS.G_WFR_COMPLETE|| ':' ||OE_GLOBALS.G_WFR_COMPLETE;
37 OE_STANDARD_WF.Clear_Msg_Context;
38 RETURN;
39 ELSIF l_result_out = OE_GLOBALS.G_WFR_NOT_ELIGIBLE THEN
40 resultout := OE_GLOBALS.G_WFR_COMPLETE ||':' || OE_GLOBALS.G_WFR_NOT_ELIGIBLE ;
41 OE_STANDARD_WF.Clear_Msg_Context;
42 RETURN;
43 END IF;
44 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
45 IF l_result_out = OE_GLOBALS.G_WFR_INCOMPLETE THEN
46 resultout := OE_GLOBALS.G_WFR_COMPLETE || ':' || OE_GLOBALS.G_WFR_INCOMPLETE;
47 OE_STANDARD_WF.Save_Messages(p_instance_id => actid);
48 OE_STANDARD_WF.Clear_Msg_Context;
49 RETURN;
50 ELSIF l_result_out = OE_GLOBALS.G_WFR_ON_HOLD THEN
51 resultout := OE_GLOBALS.G_WFR_COMPLETE || ':' || OE_GLOBALS.G_WFR_ON_HOLD;
52 OE_STANDARD_WF.Save_Messages(p_instance_id => actid);
53 OE_STANDARD_WF.Clear_Msg_Context;
54 RETURN;
55 ELSE -- STS_ERROR but not INCOMPLETE or ON_HOLD
56 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
57 END IF;
58 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
59 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
60 END IF;
61 END IF;
62
63 --
64 -- CANCEL mode
65 --
66 -- This is an event point is called with the effect of the activity must
67 -- be undone, for example when a process is reset to an earlier point
68 -- due to a loop back. OM does not use CANCEL MODE
69 --
70 IF (funcmode = 'CANCEL') THEN
71
72 -- your cancel code goes here
73 null;
74
75 -- no result needed
76 resultout := 'COMPLETE';
77 return;
78 END IF;
79
80
81 --
82 -- Other execution modes may be created in the future. Your
83 -- activity will indicate that it does not implement a mode
84 -- by returning null
85 --
86
87 EXCEPTION
88 WHEN OTHERS THEN
89 -- The line below records this function call in the error system
90 -- in the case of an exception.
91 wf_core.context('OE_Inv_Iface_WF', 'Inventory_Interface',
92 itemtype, itemkey, to_char(actid), funcmode);
93 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
94 p_itemtype => itemtype,
95 p_itemkey => itemkey);
96 OE_STANDARD_WF.Save_Messages(p_instance_id => actid);
97 OE_STANDARD_WF.Clear_Msg_Context;
98 RAISE;
99
100 END Inventory_Interface;
101
102 END OE_Inv_Iface_WF;