DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_OEOL_GSA

Source


1 PACKAGE BODY OE_OEOL_GSA AS
2 /* $Header: OEXWGSAB.pls 120.0 2005/06/04 11:12:19 appldev noship $ */
3 
4 PROCEDURE OE_GSA_CHECK(
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_rec                    OE_Order_PUB.Line_Rec_Type;
12 BEGIN
13   -- start data fix project
14   OE_STANDARD_WF.Set_Msg_Context(actid);
15   -- end data fix project
16   --
17   -- RUN mode - normal process execution
18   --
19 
20   OE_Line_Util.Query_Row(p_line_id=>to_number(itemkey), x_line_rec=>l_line_rec);
21 
22    OE_MSG_PUB.set_msg_context(
23       p_entity_code                => 'LINE'
24      ,p_entity_id                  => l_line_rec.line_id
25      ,p_header_id                  => l_line_rec.header_id
26      ,p_line_id                    => l_line_rec.line_id
27      ,p_orig_sys_document_ref      => l_line_rec.orig_sys_document_ref
28      ,p_orig_sys_document_line_ref => l_line_rec.orig_sys_line_ref
29      ,p_orig_sys_shipment_ref      => l_line_rec.orig_sys_shipment_ref
30      ,p_change_sequence            => l_line_rec.change_sequence
31      ,p_source_document_id         => l_line_rec.source_document_id
32      ,p_source_document_line_id    => l_line_rec.source_document_line_id
33      ,p_order_source_id            => l_line_rec.order_source_id
34      ,p_source_document_type_id    => l_line_rec.source_document_type_id);
35 
36   if (funcmode = 'RUN') then
37      resultout := OE_GSA_UTIL.Check_GSA_Main(l_line_rec,resultout);
38     return;
39   end if;
40 
41 
42   IF (funcmode = 'CANCEL') THEN
43     null;
44     resultout := 'COMPLETE';
45     return;
46   END IF;
47 
48 
49 EXCEPTION
50   WHEN OTHERS THEN
51     wf_core.context('OE_GSA_CHECK', 'OE_GSA_CHECK',
52 		    itemtype, itemkey, to_char(actid), funcmode);
53     -- start data fix project
54     OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
55                                           p_itemtype => itemtype,
56                                           p_itemkey => itemkey);
57     OE_STANDARD_WF.Save_Messages;
58     OE_STANDARD_WF.Clear_Msg_Context;
59     -- end data fix project
60     raise;
61 END OE_GSA_CHECK;
62 
63 
64 PROCEDURE OE_GSA_HOLD(
65     itemtype  in varchar2,
66     itemkey   in varchar2,
67     actid     in number,
68     funcmode  in varchar2,
69     resultout in out NOCOPY /* file.sql.39 change */ varchar2)
70 IS
71     l_line_rec                    OE_Order_PUB.Line_Rec_Type;
72     l_hold_source_rec             OE_Hold_Sources_Pvt.Hold_Source_REC
73                         DEFAULT OE_Hold_Sources_Pvt.G_MISS_Hold_Source_REC;
74     l_return_status               VARCHAR2(30);
75     l_msg_count                   number;
76     l_msg_data                    VARCHAR2(240);
77 BEGIN
78   -- start data fix project
79   OE_STANDARD_WF.Set_Msg_Context(actid);
80   -- end data fix project
81   --
82   -- RUN mode - normal process execution
83   --
84 
85   OE_Line_Util.Query_Row(p_line_id=>to_number(itemkey),x_line_rec=>l_line_rec);
86 
87    OE_MSG_PUB.set_msg_context(
88       p_entity_code                => 'LINE'
89      ,p_entity_id                  => l_line_rec.line_id
90      ,p_header_id                  => l_line_rec.header_id
91      ,p_line_id                    => l_line_rec.line_id
92      ,p_orig_sys_document_ref      => l_line_rec.orig_sys_document_ref
93      ,p_orig_sys_document_line_ref => l_line_rec.orig_sys_line_ref
94      ,p_orig_sys_shipment_ref      => l_line_rec.orig_sys_shipment_ref
95      ,p_change_sequence            => l_line_rec.change_sequence
96      ,p_source_document_id         => l_line_rec.source_document_id
97      ,p_source_document_line_id    => l_line_rec.source_document_line_id
98      ,p_order_source_id            => l_line_rec.order_source_id
99      ,p_source_document_type_id    => l_line_rec.source_document_type_id);
100 
101   IF (funcmode = 'RUN') THEN
102 /* -----------------------------------------------------------------------
103    Old version being commented out. Parameters to Apply_Holds have changed.
104    -----------------------------------------------------------------------
105      OE_HOLDS_PUB.Apply_Holds(p_line_id=>l_line_rec.line_id,
106 			     p_return_status => l_return_status,
107                              p_hold_id => OE_GSA_UTIL.Get_Hold_id(0),
108 			     p_entity_id =>l_line_rec.line_id,
109 			     p_entity_code => 'O');
110 */
111      l_hold_source_rec.hold_id := OE_GSA_UTIL.Get_Hold_id(0);
112      l_hold_source_rec.hold_entity_id := l_line_rec.line_id;
113      l_hold_source_rec.hold_entity_code := 'O';
114 
115      OE_HOLDS_PUB.Apply_Holds(
116 		  p_api_version         => 1.0
117 		, p_line_id             => l_line_rec.line_id
118                 , p_hold_source_rec    	=> l_hold_source_rec
119 		, x_return_status       => l_return_status
120 		, x_msg_count 		=> l_msg_count
121 		, x_msg_data		=> l_msg_data
122 );
123 
124      IF l_return_status = FND_API.g_ret_sts_success THEN
125         resultout := 'COMPLETE:AP_PASS';
126      ELSE
127         resultout := 'COMPLETE:AP_FAIL';
128         -- start data fix project
129         OE_STANDARD_WF.Save_Messages;
130         OE_STANDARD_WF.Clear_Msg_Context;
131         -- end data fix project
132      END IF;
133 
134      return;
135   END IF;
136 
137 
138   IF (funcmode = 'CANCEL') THEN
139     null;
140     resultout := 'COMPLETE';
141     return;
142   END IF;
143 
144 
145 EXCEPTION
146   WHEN OTHERS THEN
147     wf_core.context('OE_GSA_HOLD', 'OE_GSA_HOLD',
148 		    itemtype, itemkey, to_char(actid), funcmode);
149     -- start data fix project
150     OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
151                                           p_itemtype => itemtype,
152                                           p_itemkey => itemkey);
153     OE_STANDARD_WF.Save_Messages;
154     OE_STANDARD_WF.Clear_Msg_Context;
155     -- end data fix project
156     raise;
157 END OE_GSA_HOLD;
158 
159 
160 PROCEDURE OE_GSA_RELEASE_HOLD(
161     itemtype  in varchar2,
162     itemkey   in varchar2,
163     actid     in number,
164     funcmode  in varchar2,
165     resultout in out NOCOPY /* file.sql.39 change */ varchar2)
166 IS
167     l_line_rec                    OE_Order_PUB.Line_Rec_Type;
168 BEGIN
169   -- start data fix project
170   OE_STANDARD_WF.Set_Msg_Context(actid);
171   -- end data fix project
172   --
173   -- RUN mode - normal process execution
174   --
175 
176   OE_Line_Util.Query_Row(p_line_id=>to_number(itemkey),x_line_rec=>l_line_rec);
177 
178    OE_MSG_PUB.set_msg_context(
179       p_entity_code                => 'LINE'
180      ,p_entity_id                  => l_line_rec.line_id
181      ,p_header_id                  => l_line_rec.header_id
182      ,p_line_id                    => l_line_rec.line_id
183      ,p_orig_sys_document_ref      => l_line_rec.orig_sys_document_ref
184      ,p_orig_sys_document_line_ref => l_line_rec.orig_sys_line_ref
185      ,p_orig_sys_shipment_ref      => l_line_rec.orig_sys_shipment_ref
186      ,p_change_sequence            => l_line_rec.change_sequence
187      ,p_source_document_id         => l_line_rec.source_document_id
188      ,p_source_document_line_id    => l_line_rec.source_document_line_id
189      ,p_order_source_id            => l_line_rec.order_source_id
190      ,p_source_document_type_id    => l_line_rec.source_document_type_id);
191 
192   IF (funcmode = 'RUN') THEN
193      resultout := OE_GSA_UTIL.Release_Hold(l_line_rec,resultout);
194     return;
195   END IF;
196 
197   IF (funcmode = 'CANCEL') THEN
198     null;
199     resultout := 'COMPLETE';
200     return;
201   END IF;
202 
203 EXCEPTION
204   WHEN OTHERS THEN
205     wf_core.context('OE_GSA_HOLD_RELEASE', 'OE_GSA_HOLD_RELEASE',
206 		    itemtype, itemkey, to_char(actid), funcmode);
207     -- start data fix project
208     OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
209                                           p_itemtype => itemtype,
210                                           p_itemkey => itemkey);
211     OE_STANDARD_WF.Save_Messages;
212     OE_STANDARD_WF.Clear_Msg_Context;
213     -- end data fix project
214     raise;
215 
216 END OE_GSA_RELEASE_HOLD;
217 
218 END OE_OEOL_GSA;