[Home] [Help]
PACKAGE BODY: APPS.OE_PORTAL_ORDER
Source
1 PACKAGE BODY Oe_Portal_Order AS
2 /* $Header: OEXPOBKB.pls 120.0 2005/06/01 00:01:18 appldev noship $ */
3 -- Procedure Submit_Order
4 --
5
6
7 -- Global constant holding the package name
8
9 G_PKG_NAME CONSTANT VARCHAR2(30) := 'Oe_Portal_Order';
10
11 PROCEDURE Submit_Order
12 ( x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2
13 , x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER
14 , x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2
15 , p_header_id IN NUMBER
16 , p_book_flag IN VARCHAR2 := 'N'
17 )
18 IS
19 l_atp_tbl OE_ATP.Atp_Tbl_Type;
20 l_return_status VARCHAR2(1);
21 l_control_rec OE_GLOBALS.Control_Rec_Type;
22 l_line_tbl OE_ORDER_PUB.LINE_TBL_TYPE;
23 --
24 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
25 --
26 BEGIN
27
28 IF l_debug_level > 0 THEN
29 oe_debug_pub.add( 'ENTERING OE_OE_FORM_HEADER.PROCESS_OBJECT' , 1 ) ;
30 END IF;
31 /* For submitted orders, first schedule the order*/
32 if p_book_flag = 'Y' Then
33 OE_GRP_SCH_UTIL.Schedule_Order
34 (p_header_id => p_header_id,
35 p_sch_action => OE_ORDER_SCH_UTIL.OESCH_ACT_RESERVE,
36 p_entity_type => 'ORDER',
37 p_line_id => '',
38 x_atp_tbl => l_atp_tbl,
39 x_return_status => l_return_status,
40 x_msg_count => x_msg_count,
41 x_msg_data => x_msg_data);
42
43 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
44 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
45 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
46 RAISE FND_API.G_EXC_ERROR;
47 END IF;
48
49 END IF;
50
51
52
53 -- we are using this flag to selectively requery the block,
54 -- if any of the delayed req. get executed changing rows.
55 -- currently all the work done in post line process will
56 -- eventually set the global cascading flag to TRUE.
57 -- if some one adds code to post lines, whcih does not
58 -- set cascadinf flga to TURE and still modifes records,
59 -- that will be incorrect.
60 -- this flag helps to requery the block if any thing changed
61 -- after validate and write.
62
63 OE_GLOBALS.G_PROCESS_OBJECTS_FLAG := TRUE;
64
65 l_control_rec.controlled_operation := TRUE;
66 l_control_rec.process := TRUE;
67 l_control_rec.process_entity := OE_GLOBALS.G_ENTITY_ALL;
68
69 l_control_rec.check_security := FALSE;
70 l_control_rec.clear_dependents := FALSE;
71 l_control_rec.default_attributes := FALSE;
72 l_control_rec.change_attributes := FALSE;
73 l_control_rec.validate_entity := FALSE;
74 l_control_rec.write_to_DB := FALSE;
75
76 -- Instruct API to clear its request table
77
78 l_control_rec.clear_api_cache := FALSE;
79 l_control_rec.clear_api_requests := TRUE;
80
81 -- Set the UI flag
82 OE_GLOBALS.G_UI_FLAG := TRUE;
83
84 oe_line_util.Post_Line_Process
85 ( p_control_rec => l_control_rec
86 , p_x_line_tbl => l_line_tbl );
87
88 Oe_Order_Pvt.Process_Requests_And_Notify
89 ( p_process_requests => TRUE
90 , p_init_msg_list => FND_API.G_TRUE
91 , p_notify => TRUE
92 , x_return_status => l_return_status
93 );
94
95
96 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
97 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
98 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
99 RAISE FND_API.G_EXC_ERROR;
100 END IF;
101
102 -- x_cascade_flag := OE_GLOBALS.G_CASCADING_REQUEST_LOGGED;
103 -- Re-set the UI flag to FALSE
104 OE_GLOBALS.G_UI_FLAG := FALSE;
105
106 -- Set return status.
107
108 x_return_status := FND_API.G_RET_STS_SUCCESS;
109
110 -- Get message count and data
111
112 OE_MSG_PUB.Count_And_Get
113 ( p_count => x_msg_count
114 , p_data => x_msg_data
115 );
116
117 OE_GLOBALS.G_UI_FLAG := FALSE;
118 OE_GLOBALS.G_PROCESS_OBJECTS_FLAG := FALSE;
119
120 IF (p_book_flag = 'Y') Then
121 -- Progress the workflow so that booking process is kicked off.
122 -- This call should come back with a message OE_ORDER_BOOKED
123 -- if booking completed successfully and if booking was deferred,
124 -- message OE_ORDER_BOOK_DEFERRED is added to the stack.
125 -- If booking was not successful, it should come back with a
126 -- return status of FND_API.G_RET_STS_ERROR or
127 -- FND_API.G_RET_STS_UNEXP_ERROR
128 OE_Order_Book_Util.Complete_Book_Eligible
129 ( p_api_version_number => 1.0
130 , p_init_msg_list => FND_API.G_TRUE
131 , p_header_id => p_header_id
132 , x_return_status => l_return_status
133 , x_msg_count => x_msg_count
134 , x_msg_data => x_msg_data);
135
136 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
137 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
138 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
139 RAISE FND_API.G_EXC_ERROR;
140 END IF;
141
142 -- Set return status.
143
144 x_return_status := FND_API.G_RET_STS_SUCCESS;
145
146 /* -- Get message count and data
147
148 OE_MSG_PUB.Count_And_Get
149 ( p_count => x_msg_count
150 , p_data => x_msg_data
151 );*/
152 END IF;
153 IF l_debug_level > 0 THEN
154 oe_debug_pub.add( 'EXITING OE_OE_FORM_HEADER.PROCESS_OBJECT' , 1 ) ;
155 END IF;
156
157
158 commit;
159
160
161 EXCEPTION
162
163 WHEN FND_API.G_EXC_ERROR THEN
164 OE_GLOBALS.G_PROCESS_OBJECTS_FLAG := FALSE;
165 OE_GLOBALS.G_UI_FLAG := FALSE;
166
167 x_return_status := FND_API.G_RET_STS_ERROR;
168
169 -- Get message count and data
170
171 OE_MSG_PUB.Count_And_Get
172 ( p_count => x_msg_count
173 , p_data => x_msg_data
174 );
175
176 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
177 OE_GLOBALS.G_PROCESS_OBJECTS_FLAG := FALSE;
178 OE_GLOBALS.G_UI_FLAG := FALSE;
179
180 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
181
182 -- Get message count and data
183
184 OE_MSG_PUB.Count_And_Get
185 ( p_count => x_msg_count
186 , p_data => x_msg_data
187 );
188
189 WHEN OTHERS THEN
190 OE_GLOBALS.G_PROCESS_OBJECTS_FLAG := FALSE;
191 OE_GLOBALS.G_UI_FLAG := FALSE;
192
193 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
194
195 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
196 THEN
197 OE_MSG_PUB.Add_Exc_Msg
198 ( G_PKG_NAME
199 , 'Process_Object'
200 );
201 END IF;
202
203 -- Get message count and data
204
205 OE_MSG_PUB.Count_And_Get
206 ( p_count => x_msg_count
207 , p_data => x_msg_data
208 );
209
210 END;
211
212 END Oe_Portal_Order;