DBA Data[Home] [Help]

PACKAGE BODY: APPS.CSD_LOGISTICS_PUB

Source


4     * This is the public interface for managing repair logistics . It allows
1 PACKAGE BODY CSD_LOGISTICS_PUB as
2 /* $Header: csdplogb.pls 120.4 2005/09/29 17:19:40 takwong noship $ */
3     /*#
5     * creation/update  of repair logistics lines for a repair order.
6     * @rep:scope public
7     * @rep:product CSD
8     * @rep:displayname  Repair Logistics
9     * @rep:lifecycle active
10     * @rep:category BUSINESS_ENTITY REPAIR_LOGISTICS
11     */
12 -- Start of Comments
13 -- Package name     : CSD_LOGISTICS_PUB
14 -- Purpose          :
15 -- History          :
16 -- NOTE             :
17 -- End of Comments
18 
19 G_PKG_NAME CONSTANT VARCHAR2(30):= 'CSD_LOGISTICS_PUB';
20 G_FILE_NAME CONSTANT VARCHAR2(15) := 'csdplogb.pls';
21 
22     /*#
26     * @param P_Api_Version api version number
23     * Creates a new Repair Logistics line for the given Repair order. The Product Pransaction Id
24     * Id is generated if a unique number is not passed. Returns the Product Pransaction Id.
25 	* Product transaction is a technical term for logistics line.
27     * @param P_Commit to decide whether to commit the transaction or not, default to false
28     * @param P_Init_Msg_List initial the message stack, default to false
29     * @param X_Return_Status return status
30     * @param X_Msg_Count return message count
31     * @param X_Msg_Data return message data
32     * @param p_product_txn_rec Logistics line record.
33     * @param X_product_transaction_id Generated key for the logistics line.
34     * @param X_order_header_id If he logistics line is interfaced, this indicates the order  header id created.
35     * @param X_order_line_id If the logistics line is interfaced, this indicates the order line id created..
36     * @rep:scope public
37     * @rep:lifecycle active
38     * @rep:displayname Create Logistics Line
39     */
40 PROCEDURE Create_Logistics_Line(
41       p_api_version         IN              NUMBER,
42       p_commit              IN              VARCHAR2     := fnd_api.g_false,
43       p_init_msg_list       IN              VARCHAR2     := fnd_api.g_false,
44       p_validation_level    IN              NUMBER       := fnd_api.g_valid_level_full,
45       x_return_status       OUT NOCOPY      VARCHAR2,
46       x_msg_count           OUT NOCOPY      NUMBER,
47       x_msg_data            OUT NOCOPY      VARCHAR2,
48       p_product_txn_rec     IN OUT NOCOPY   csd_process_pvt.product_txn_rec,
49       p_add_to_order_flag   IN              VARCHAR2
50    )
51 IS
52 
53 Begin
54 
55    --need to add more validation here
56 
57    CSD_LOGISTICS_PVT.Create_Logistics_Line(
58          p_api_version         =>    p_api_version,
59          p_commit              =>    p_commit,
60          p_init_msg_list       =>    p_init_msg_list,
61          p_validation_level    =>    p_validation_level,
62          x_return_status       =>    x_return_status,
63          x_msg_count           =>    x_msg_count,
64          x_msg_data            =>    x_msg_data,
65          p_product_txn_rec     =>    p_product_txn_rec,
66          p_add_to_order_flag   =>    p_add_to_order_flag
67       );
68 
69    IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
70       RAISE FND_API.G_EXC_ERROR;
71    END IF;
72 
73 End Create_Logistics_Line;
74 
75 
76     /*#
77     * Creates default logistics lines for the repair order based on repair type.
78     * @param P_Api_Version api version number
79     * @param P_Commit to decide whether to commit the transaction or not, default to false
80     * @param P_Init_Msg_List initial the message stack, default to false
81     * @param X_Return_Status return status
82     * @param X_Msg_Count return message count
83     * @param X_Msg_Data return message data
84     * @param p_repair_line_id repair line for which the default logistics lines are to be created.
85     * @rep:scope public
86     * @rep:lifecycle active
87     * @rep:displayname Create Default Logitics Lines.
88     */
89 PROCEDURE Create_Default_Logistics
90 (     p_api_version           IN     NUMBER,
91       p_commit                IN     VARCHAR2  := fnd_api.g_false,
92       p_init_msg_list         IN     VARCHAR2  := fnd_api.g_false,
93       p_validation_level      IN     NUMBER    := fnd_api.g_valid_level_full,
94       p_repair_line_id        IN     NUMBER,
95       x_return_status         OUT NOCOPY    VARCHAR2,
96       x_msg_count             OUT NOCOPY    NUMBER,
97       x_msg_data              OUT NOCOPY    VARCHAR2
98  )
99 
100 IS
101 
102 Begin
103 
104    --need to add more validation here
105 
106    CSD_LOGISTICS_PVT.Create_Default_Logistics
107    (     p_api_version        =>    p_api_version,
108          p_commit             =>    p_commit,
109          p_init_msg_list      =>    p_init_msg_list,
110          p_validation_level   =>    p_validation_level,
111          p_repair_line_id     =>    p_repair_line_id,
112          x_return_status      =>    x_return_status,
113          x_msg_count          =>    x_msg_count,
114          x_msg_data           =>    x_msg_data
115    );
116 
117    IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
118       RAISE FND_API.G_EXC_ERROR;
119    END IF;
120 
121 End Create_Default_Logistics;
122 
123     /*#
124     * Updates a given Logistics line. It is interfaced/booked based on the input flags.
125     * @param P_Api_Version api version number
126     * @param P_Commit to decide whether to commit the transaction or not, default to false
127     * @param P_Init_Msg_List initial the message stack, default to false
128     * @param X_Return_Status return status
129     * @param X_Msg_Count return message count
130     * @param X_Msg_Data return message data
131     * @param p_Upd_ProdTxn_Rec This contains the fields to be updated in the logistics line.
132     * @param X_object_version_number Updated Object version number of the logistics line.
133     * @param X_order_header_id If he logistics line is interfaced, this indicates the order  header id created.
134     * @param X_order_line_id If the logistics line is interfaced, this indicates the order line id created..
135     * @rep:scope public
136     * @rep:lifecycle active
137     * @rep:displayname Update Repair Logistics Line.
138     */
139 	procedure Update_Logistics_Line(p_api_version            IN NUMBER,
140                                     p_commit                 IN VARCHAR2,
144                                     x_msg_data               OUT NOCOPY VARCHAR2,
141                                     p_init_msg_list          IN VARCHAR2,
142                                     x_return_status          OUT NOCOPY VARCHAR2,
143                                     x_msg_count              OUT NOCOPY NUMBER,
145                                     p_Upd_ProdTxn_Rec        IN CSD_LOGISTICS_PUB.Upd_ProdTxn_Rec_Type,
146 								    x_object_version_number  OUT NOCOPY NUMBER,
147 								    x_order_header_id        OUT NOCOPY NUMBER,
148 								    x_order_line_id          OUT NOCOPY NUMBER ) IS
149 	    --
150 	    l_api_name           CONSTANT VARCHAR2(30) := 'Update_Logistics_Line';
151 	    l_api_version_number CONSTANT NUMBER := 1.0;
152 	    --
153 	BEGIN
154 	    --
155 	    -- Standard Start of API savepoint
156 	    SAVEPOINT UPDATE_LOGISTICS_LINE_PUB;
157 	    -- Standard call to check for call compatibility.
158 	    IF NOT FND_API.Compatible_API_Call(l_api_version_number,
159 	                                       p_api_version,
160 	                                       l_api_name,
161 	                                       G_PKG_NAME)
162 	    THEN
163 	        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
164 	    END IF;
165 	    -- Initialize message list if p_init_msg_list is set to TRUE.
166 	    IF FND_API.to_Boolean(p_init_msg_list)
167 	    THEN
168 	        FND_MSG_PUB.initialize;
169 	    END IF;
170 	    -- Initialize API return status to success
171 	    x_return_status := FND_API.G_RET_STS_SUCCESS;
172 	    --
173 	    -- API body
174 	    --
175 	    CSD_LOGISTICS_PVT.Update_Logistics_Line(P_Api_Version           => p_api_version,
176 	                                     P_Commit                => p_commit,
177 	                                     P_Init_Msg_List         => p_init_msg_list,
178 	                                     P_Validation_Level      => FND_API.G_VALID_LEVEL_FULL,
179 	                                     X_Return_Status         => x_return_status,
180 	                                     X_Msg_Count             => x_msg_count,
181 	                                     X_Msg_Data              => x_msg_data,
182 	                                     P_UPD_PRODTXN_REC       => p_Upd_ProdTxn_Rec,
183 	                                     X_OBJECT_VERSION_NUMBER => x_object_Version_number,
184 										 X_ORDER_HEADER_ID       => x_order_header_id,
185 										 X_ORDER_LINE_ID         => x_order_line_id);
186 	    --
187 	    -- Check return status from the above procedure call
188 	    IF not (x_return_status = FND_API.G_RET_STS_SUCCESS)
189 	    then
190 	        ROLLBACK TO UPDATE_LOGISTICS_LINE_PUB;
191 	        return;
192 	    END IF;
193 	    --
194 	    -- End of API body.
195 	    --
196 	    -- Standard check for p_commit
197 	    IF FND_API.to_Boolean(p_commit)
198 	    THEN
199 	        COMMIT WORK;
200 	    END IF;
201 	    -- Standard call to get message count and if count is 1, get message info.
202 	    FND_MSG_PUB.Count_And_Get(p_count => x_msg_count,
203 	                              p_data  => x_msg_data);
204 	    --
205 	EXCEPTION
206 	    WHEN Fnd_Api.G_EXC_ERROR THEN
207 	        x_return_status := Fnd_Api.G_RET_STS_ERROR;
208 	        ROLLBACK TO UPDATE_LOGISTICS_LINE_PUB;
209 	        Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
210 	                                  p_data  => x_msg_data);
211 	        IF (Fnd_Log.level_error >= Fnd_Log.g_current_runtime_level)
212 	        THEN
213 	            Fnd_Log.STRING(Fnd_Log.level_error,
214 	                           'csd.plsql.csd_logistics_pub.update_logistics_pub',
215 	                           'EXC_ERROR[' || x_msg_data || ']');
216 	        END IF;
217 
218 	    WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
219 	        x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
220 	        ROLLBACK TO UPDATE_LOGISTICS_LINE_PUB;
221 	        Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
222 	                                  p_data  => x_msg_data);
223 	        IF (Fnd_Log.level_exception >= Fnd_Log.g_current_runtime_level)
224 	        THEN
225 	            Fnd_Log.STRING(Fnd_Log.level_exception,
226 	                           'csd.plsql.csd_logistics_pub.update_logistics_pub',
227 	                           'EXC_UNEXP_ERROR[' || x_msg_data || ']');
228 	        END IF;
229 	    WHEN OTHERS THEN
230 	        x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
231 	        Rollback TO UPDATE_LOGISTICS_LINE_PUB;
232 	        IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
233 	        THEN
234 	            Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
235 	        END IF;
236 	        Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
237 	                                  p_data  => x_msg_data);
238 	        IF (Fnd_Log.level_exception >= Fnd_Log.g_current_runtime_level)
239 	        THEN
240 	            Fnd_Log.STRING(Fnd_Log.level_exception,
241 	                           'csd.plsql.csd_logistics_pub.update_logistics_pub',
242 	                           'SQL MEssage[' || SQLERRM || ']');
243 	        END IF;
244 
245 	End UPDATE_LOGISTICS_LINE;
246 
247 
248 End CSD_LOGISTICS_PUB;