DBA Data[Home] [Help]

PACKAGE BODY: APPS.ONT_CUSTACCEPTOIP_PVT

Source


1 PACKAGE BODY ONT_CustAcceptOip_PVT AS
2 /* $Header: OEXVOIPB.pls 120.6 2006/08/23 10:20:21 myerrams noship $ */
3 PROCEDURE Call_OIP_Process_Order
4 (
5   p_header_id                    IN          NUMBER
6 , p_line_id_tbl                  IN          ont_num_tbl_type
7 , p_reference_document           IN          VARCHAR2
8 , p_customer_signature           IN          VARCHAR2
9 , p_signature_date               IN          DATE
10 , p_customer_comments            IN          VARCHAR2
11 , p_action                       IN          VARCHAR2
12 , x_return_status                OUT NOCOPY  VARCHAR2
13 , x_msg_count                    OUT NOCOPY  NUMBER
14 , x_msg_data                     OUT NOCOPY  VARCHAR2
15 )
16 IS
17         l_action_request_tbl        OE_ORDER_PUB.Request_Tbl_Type;
18 
19 	l_header_out_rec            OE_ORDER_PUB.Header_Rec_Type;
20 	l_header_adj_out_tbl        OE_Order_PUB.Header_Adj_Tbl_Type;
21 	l_header_price_att_out_tbl  OE_ORDER_PUB.Header_Price_Att_Tbl_Type;
22 	l_header_adj_att_out_tbl    OE_ORDER_PUB.Header_Adj_Att_Tbl_Type;
23 	l_header_adj_assoc_out_tbl  OE_ORDER_PUB.Header_Adj_Assoc_Tbl_Type;
24 	l_header_scredit_out_tbl    OE_Order_PUB.Header_Scredit_Tbl_Type;
25 	l_line_out_tbl              OE_ORDER_PUB.Line_Tbl_Type;
26 	l_line_adj_out_tbl          OE_ORDER_PUB.Line_Adj_Tbl_Type;
27 	l_line_price_att_out_tbl    OE_ORDER_PUB.Line_Price_Att_Tbl_Type;
28 	l_line_adj_att_out_tbl	    OE_ORDER_PUB.Line_Adj_Att_Tbl_Type;
29 	l_line_adj_assoc_out_tbl    OE_ORDER_PUB.Line_Adj_Assoc_Tbl_Type;
30 	l_line_scredit_out_tbl      OE_Order_PUB.Line_Scredit_Tbl_Type;
31 	l_lot_serial_out_tbl        OE_Order_PUB.Lot_Serial_Tbl_Type;
32 	l_action_request_out_tbl    OE_Order_PUB.Request_Tbl_Type;
33 
34 --myerrams, start
35 	l_header_val_out_rec	    OE_Order_PUB.Header_Val_Rec_Type;
36 	l_header_adj_val_out_tbl    OE_Order_PUB.Header_Adj_Val_Tbl_Type;
37 	l_header_scredit_val_out_tbl OE_Order_PUB.Header_Scredit_Val_Tbl_Type;
38 	l_line_val_out_tbl	    OE_Order_PUB.Line_Val_Tbl_Type;
39 	l_line_adj_val_out_tbl	    OE_Order_PUB.Line_Adj_Val_Tbl_Type;
40 	l_line_scredit_val_out_tbl  OE_Order_PUB.Line_Scredit_Val_Tbl_Type;
41 	l_lot_serial_val_out_tbl    OE_Order_PUB.Lot_Serial_Val_Tbl_Type;
42 --myerrams, end
43 
44 	l_action                    VARCHAR2(30);
45 	l_return_status		    VARCHAR2(1);
46 	l_msg_count		    NUMBER;
47 	l_msg_data		    VARCHAR2(4000);
48 
49         l_debug_level CONSTANT NUMBER	:= oe_debug_pub.g_debug_level;
50 	l_temp_var VARCHAR2(2000)	:= NULL;
51 	l_org_id			NUMBER;
52 
53 BEGIN
54 
55 --myerrams, Bug: 5285062
56   IF To_number(Nvl(fnd_profile.value('ONT_DEBUG_LEVEL'), '0')) > 0 THEN
57       oe_debug_pub.initialize;
58       l_temp_var := oe_debug_pub.set_debug_mode('FILE');
59       oe_debug_pub.debug_on;
60   END IF;
61   IF l_debug_level  > 0 THEN
62       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: Start of method ONT_CustAcceptOip_PVT.Call_OIP_Process_Order' ) ;
63   END IF;
64 
65 -- myerrams, to get the org_id of header passed.
66   select org_id into l_org_id from oe_order_headers_all where header_id = p_header_id;
67 
68 
69   IF l_debug_level  > 0 THEN
70       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: Org_Id of the header passed:' || l_org_id) ;
71   END IF;
72 
73 --myerrams, Bug:5155962; Modified the code to match the LookupCode instead of Meaning
74 --as Meaning can be different for different languages.
75  IF p_action = 'A'
76  THEN
77     l_action := OE_GLOBALS.G_ACCEPT_FULFILLMENT;
78  ELSIF p_action = 'R'
79  THEN
80     l_action := OE_GLOBALS.G_REJECT_FULFILLMENT;
81  END IF;
82 --myerrams, end. Bug:5155962
83 
84   IF l_debug_level  > 0 THEN
85       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: Parameters passed to Process Order') ;
86   END IF;
87 
88  oe_msg_pub.initialize;
89  FOR i IN 1..p_line_id_tbl.COUNT LOOP
90 
91    l_action_request_tbl(i).entity_code  := OE_GLOBALS.G_ENTITY_LINE;
92    l_action_request_tbl(i).request_type := l_action;
93    l_action_request_tbl(i).entity_id    := p_line_id_tbl(i);
94    l_action_request_tbl(i).param1       := p_customer_comments;
95    l_action_request_tbl(i).param2       := p_customer_signature;
96    l_action_request_tbl(i).param3       := p_reference_document;
97    l_action_request_tbl(i).param4       := 'N';
98    l_action_request_tbl(i).param5       := p_header_id;
99    l_action_request_tbl(i).date_param1  := p_signature_date;
100 
101   IF l_debug_level  > 0 THEN
102       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: Record Number:' || i || ' out of ' || p_line_id_tbl.COUNT || ' records') ;
103       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: entity_code'		|| l_action_request_tbl(i).entity_code) ;
104       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: request_type'		|| l_action_request_tbl(i).request_type) ;
105       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: entity_id'		|| l_action_request_tbl(i).entity_id) ;
106       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: customer_comments'	|| l_action_request_tbl(i).param1) ;
107       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: customer_signature'	|| l_action_request_tbl(i).param2) ;
108       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: reference_document'	|| l_action_request_tbl(i).param3) ;
109       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: Explicit Revenue Recognition Acceptance') ;
110       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: header_id'		|| l_action_request_tbl(i).param5) ;
111       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: signature_date'		|| l_action_request_tbl(i).date_param1) ;
112   END IF;
113 
114  END LOOP;
115 
116   IF l_debug_level  > 0 THEN
117       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: Before Call to Process Order API.') ;
118   END IF;
119 
120  OE_Order_PUB.Process_Order
121          (  p_api_version_number		=> 1.0
122 	  , p_org_id				=> l_org_id
123 	  , x_return_status			=> l_return_status
124 	  , x_msg_count				=> l_msg_count
125 	  , x_msg_data				=> l_msg_data
126           , x_header_rec			=> l_header_out_rec
127 	  , x_header_val_rec			=> l_header_val_out_rec
128           , x_header_adj_tbl			=> l_header_adj_out_tbl
129           , x_header_adj_val_tbl		=> l_header_adj_val_out_tbl
130       	  , x_header_price_att_tbl	        => l_header_price_att_out_tbl
131 	  , x_header_adj_att_tbl		=> l_header_adj_att_out_tbl
132 	  , x_header_adj_assoc_tbl	        => l_header_adj_assoc_out_tbl
133 	  , x_header_scredit_tbl		=> l_header_scredit_out_tbl
134 	  , x_header_scredit_val_tbl		=> l_header_scredit_val_out_tbl
135 	  , x_line_tbl				=> l_line_out_tbl
136 	  , x_line_val_tbl			=> l_line_val_out_tbl
137           , x_line_adj_tbl			=> l_line_adj_out_tbl
138           , x_line_adj_val_tbl			=> l_line_adj_val_out_tbl
139           , x_line_price_att_tbl		=> l_line_price_att_out_tbl
140           , x_line_adj_att_tbl			=> l_line_adj_att_out_tbl
141           , x_line_adj_assoc_tbl		=> l_line_adj_assoc_out_tbl
142 	  , x_line_scredit_tbl			=> l_line_scredit_out_tbl
143 	  , x_line_scredit_val_tbl		=> l_line_scredit_val_out_tbl
144           , x_lot_serial_tbl			=> l_lot_serial_out_tbl
145           , x_lot_serial_val_tbl		=> l_lot_serial_val_out_tbl
146 	  , p_action_request_tbl		=> l_action_request_tbl
147 	  , x_action_request_tbl		=> l_action_request_out_tbl
148 	);
149 
150   IF l_debug_level  > 0 THEN
151       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: After Call to Process Order API.') ;
152   END IF;
153 
154   x_return_status := l_return_status;
155   x_msg_count  :=  l_msg_count;
156 
157 --Decoding the Error message
158 if l_msg_count > 0 then
159 	for k in 1 .. l_msg_count loop
160 		l_msg_data := oe_msg_pub.get( p_msg_index => k,
161 					      p_encoded => 'F'
162 					    );
163 		x_msg_data := x_msg_data || k || '.' ||  l_msg_data || '  ' ;
164 	end loop;
165 end if;
166   IF l_debug_level  > 0 THEN
167       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: x_msg_count:' || x_msg_count) ;
168       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: x_msg_data: ' || x_msg_data) ;
169       oe_debug_pub.add(  'GBL:Customer Acceptance OIP: End of method ONT_CustAcceptOip_PVT.Call_OIP_Process_Order' ) ;
170   END IF;
171 
172 EXCEPTION
173   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
174     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
175 
176   WHEN FND_API.G_EXC_ERROR THEN
177     x_return_status := FND_API.G_RET_STS_ERROR;
178 
179   WHEN OTHERS THEN
180     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
181 
182 END Call_OIP_Process_Order;
183 
184 END ONT_CustAcceptOip_PVT;