DBA Data[Home] [Help]

PACKAGE BODY: APPS.GMI_MOVE_ORDER_LINES_PUB

Source


1 PACKAGE BODY GMI_Move_Order_lines_PUB AS
2 /*  $Header: GMIPMOLB.pls 120.2 2008/01/10 17:35:49 plowe ship $
3  +=========================================================================+
4  |                Copyright (c) 2000 Oracle Corporation                    |
5  |                        TVP, Reading, England                            |
6  |                         All rights reserved                             |
7  +=========================================================================+
8  | FILENAME                                                                |
9  |    GMIPMOLB.pls                                                         |
10  |                                                                         |
11  | DESCRIPTION                                                             |
12  |     This package contains public procedures relating to GMI             |
13  |     Move Order line .                                                  |
14  |                                                                         |
15  |                                                                         |
16  |                                                                         |
17  | HISTORY                                                                 |
18  |     03-MAY-2000  hverddin        Created                                |
19  |     02-AUG-2000  jdiiorio        Commented out dbms_output              |
20  |     14-Sep-2000  odaboval  Removed dummy calls.                         |
21  |     29-Apr-2005  methomas  B4276612 Added Code for 3rd Party Integration|
22  |                            to initiate Sales Order XML Outbound.        |
23  |     25-Aug-2005  nchekuri  Bug#4500071. Added NOCOPY for OUT Variables  |
24  |     10-Jan-2007  plowe     Bug 6733409. New parameter added to call to  |
25  |                            GR_WF_UTIL_PUB.INITIATE_PROCESS_SALES_ORDER	to
26  |                            ensure that this package is not invalid
27  |                            PLEASE NOTE  - THIS CODE IS NOT EXECUTED IN
28  |                            R12  as call is now in INV code
29  |                            INV_Move_Order_PUB after Inventory Convergence
30  +=========================================================================+
31   API Name  : GMI_Move_Order_lines_PUB
32   Type      : Global
33  -
34   Pre-reqs  : N/A
35   Parameters: Per function
36 
37   Current Vers  : 1.0
38 */
39 /*
40   Global variables
41 */
42 G_PKG_NAME  CONSTANT  VARCHAR2(30):='GMI_MOVE_ORDER_LINES_PUB';
43 
44 PROCEDURE Process_Move_Order_lines
45   (
46      p_api_version_number    IN  NUMBER
47    , p_init_msg_lst          IN  VARCHAR2 DEFAULT fnd_api.g_false
48    , p_validation_flag       IN  NUMBER   DEFAULT FND_API.G_VALID_LEVEL_FULL
49    , p_commit                IN  VARCHAR2 DEFAULT FND_API.G_FALSE
50    , p_mo_LINE_tbl           IN  GMI_Move_Order_GLOBAL.mo_line_tbl
51    , x_mo_LINE_tbl           OUT NOCOPY GMI_Move_Order_GLOBAL.mo_line_tbl
52    , x_return_status         OUT NOCOPY VARCHAR2
53    , x_msg_count             OUT NOCOPY NUMBER
54    , x_msg_data              OUT NOCOPY VARCHAR2
55   )
56  IS
57  l_api_name           CONSTANT VARCHAR2 (30) := 'PROCESS_MOVE_ORDER_LINES';
58  l_api_version_number CONSTANT NUMBER        := 1.0;
59  l_msg_count          NUMBER  :=0;
60  l_msg_data           VARCHAR2(2000);
61  l_return_status      VARCHAR2(1):=FND_API.G_RET_STS_SUCCESS;
62  l_mo_line_rec       GMI_MOVE_ORDER_GLOBAL.mo_line_rec;
63  l_mo_line_tbl       GMI_MOVE_ORDER_GLOBAL.mo_line_tbl;
64 
65  CURSOR get_sales_order (V_line_id NUMBER) IS
66  select h.order_number
67  from oe_order_headers_all h
68      ,oe_order_lines_all l
69  where l.header_id = h.header_id
70  and l.line_id = V_line_id;
71  l_source_line_id     NUMBER;
72  l_error_code         NUMBER;
73 
74 
75  BEGIN
76 /*  DBMS_OUTPUT.PUT_line('IN MOVE ORDER line');
77      ************ DO I NEED SAVE POINT FOR PUBLIC DECLARATION *******
78      Standard call to check for call compatibility.
79 */
80 
81    IF NOT FND_API.Compatible_API_CALL ( l_api_version_number
82         				 , p_api_version_number
83                                          , l_api_name
84 				         , G_PKG_NAME
85 				       )
86      THEN
87      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
88    END IF;
89 
90 /*    Initialize message list if p_int_msg_lst is set TRUE.   */
91    IF FND_API.to_boolean(p_init_msg_lst)
92      THEN
93      FND_MSG_PUB.Initialize;
94    END IF;
95 
96 /*    Initialize API return status to sucess   */
97   x_return_status := FND_API.G_RET_STS_SUCCESS;
98 
99 
100 
101   WSH_Util_Core.PrintLn('Call Convert Missing To Null');
102 
103   FOR I in 1..p_mo_line_tbl.COUNT LOOP
104 
105     l_mo_line_rec := p_mo_line_tbl(I);
106 
107     WSH_Util_Core.PrintLn('_Move_Order_line => '||l_mo_line_rec.operation);
108 
109 -- HW BUG#:2643440 No need to call Convert_Miss_To_Null since
110 -- the record is set to NULL already
111     l_mo_line_rec := GMI_MOVE_ORDER_line_UTIL.Convert_Miss_To_Null
112 	     		 ( p_mo_line_rec => l_mo_line_rec);
113 
114     l_mo_line_tbl(I) := l_mo_line_rec;
115 
116   END LOOP;
117 
118   WSH_Util_Core.PrintLn('CAlling Move order Lines PVT');
119 
120   GMI_Move_Order_lines_PVT.Process_Move_Order_lines
121   (
122      p_api_version_number  => l_api_version_number
123    , p_init_msg_lst        => p_init_msg_lst
124    , p_validation_flag     => p_validation_flag
125    , p_commit              => p_commit
126    , p_mo_LINE_tbl         => l_mo_line_tbl
127    , x_mo_LINE_tbl         => l_mo_line_tbl
128    , x_return_status       => l_return_status
129    , x_msg_count           => l_msg_count
130    , x_msg_data            => l_msg_data
131   );
132 
133 /*    Return Output Variables   */
134 
135   x_mo_line_tbl := l_mo_line_tbl;
136   WSH_Util_Core.PrintLn('Count MOL table => ' || x_mo_line_tbl.count);
137 
138   /* Bug 4276612 Added the following to initate the Outbound for Third Party Integration */
139   OPEN get_sales_order(l_mo_line_rec.txn_source_line_id);
140   FETCH get_sales_order INTO l_source_line_id;
141   CLOSE get_sales_order;
142 
143 -- new parameter added to call to GR_WF_UTIL_PUB.INITIATE_PROCESS_SALES_ORDER	to
144 -- ensure that this package is not invalid
145 -- PLEASE NOTE  - THIS CODE IS NOT EXECUTED IN R12  as call is now in INV code  INV_Move_Order_PUB after Inventory Convergence
146   GR_WF_UTIL_PUB.INITIATE_PROCESS_SALES_ORDER
147 	(p_api_version         => l_api_version_number,
148 	 p_init_msg_list       => p_init_msg_lst,
149 	 p_commit              => p_commit,
150 	 p_sales_order_org_id  => 0,   -- dummy value to ensure compilation 6733409
151 	 p_orgn_id             => l_mo_line_rec.organization_id,
152 	 p_item_id             => l_mo_line_rec.inventory_item_id,
153 	 p_sales_order_no      => l_source_line_id,
154 	 x_return_status       => l_return_status,
155 	 x_error_code          => l_error_code,
156 	 x_msg_data            => l_msg_data);
157 
158   IF l_return_status <> 'S' THEN
159   WSH_Util_Core.PrintLn('Error occured on initiate the Outbound to Third Party with the following error message ' || l_msg_data);
160   ELSE
161   WSH_Util_Core.PrintLn('Successfully initiated the Outbound to Third Party => ' || l_mo_line_rec.inventory_item_id);
162   END IF;
163   /* End of the changes for GR Third Party Integration */
164 
165 /*   GMI_Move_Order_Header_Util.Insert_Row( l_mo_hdr_rec);    */
166 
167 /*    FND_MESSAGE.Set_Name('GMI','Entering_GMI_Create_Move_Order_Header');  */
168 /*    FND_MSG_PUB.Add;  */
169 /*    RAISE FND_API.G_EXC_ERROR;  */
170 
171 EXCEPTION
172    WHEN fnd_api.g_exc_error THEN
173       x_return_status := fnd_api.g_ret_sts_error;
174 
175 /*         Get message count and data  */
176       FND_MSG_PUB.count_and_get
177        (   p_count  => x_msg_count
178          , p_data  => x_msg_data
179        );
180 
181    WHEN OTHERS THEN
182       x_return_status := fnd_api.g_ret_sts_error;
183 
184 	 FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
185 					      , l_api_name
186 	      				);
187 
188 
189 /*         Get message count and data   */
190       FND_MSG_PUB.count_and_get
191        (   p_count  => x_msg_count
192          , p_data  => x_msg_data
193        );
194 
195 
196 
197 
198 END Process_Move_Order_lines;
199 
200 END GMI_Move_Order_lines_PUB;