DBA Data[Home] [Help]

PACKAGE BODY: APPS.CS_LIST_PRICE_PKG

Source


1 package body cs_list_price_pkg as
2 /* $Header: csxlistb.pls 115.1 99/07/16 09:08:25 porting ship  $ */
3 
4 PROCEDURE  call_fetch_list_price (
5 		p_inventory_item_id	IN 	NUMBER,
6  		p_price_list_id		IN 	NUMBER,
7  		p_unit_code		IN 	VARCHAR2,
8  		p_service_duration	IN 	NUMBER,
9  		p_item_Type_code	IN 	VARCHAR2 ,
10  		p_pricing_attribute1	IN 	VARCHAR2 ,
11  		p_pricing_attribute2	IN 	VARCHAR2 ,
12  		p_pricing_attribute3	IN 	VARCHAR2 ,
13  		p_pricing_attribute4	IN 	VARCHAR2 ,
14  		p_pricing_attribute5	IN 	VARCHAR2 ,
15  		p_pricing_attribute6	IN 	VARCHAR2 ,
16  		p_pricing_attribute7	IN 	VARCHAR2 ,
17  		p_pricing_attribute8	IN 	VARCHAR2 ,
18  		p_pricing_attribute9	IN 	VARCHAR2 ,
19  		p_pricing_attribute10	IN 	VARCHAR2 ,
20  		p_pricing_attribute11	IN 	VARCHAR2 ,
21  		p_pricing_attribute12	IN 	VARCHAR2 ,
22  		p_pricing_attribute13	IN 	VARCHAR2 ,
23  		p_pricing_attribute14	IN 	VARCHAR2 ,
24  		p_pricing_attribute15	IN 	VARCHAR2 ,
25 		p_base_price		IN 	NUMBER ,
26 		p_price_list_id_out	OUT 	NUMBER ,
27 		p_prc_method_code_out	OUT 	VARCHAR2 ,
28 		p_list_price		OUT 	NUMBER ,
29 		p_list_percent		OUT 	NUMBER ,
30 		p_rounding_factor	OUT 	NUMBER ,
31 		p_error_flag		OUT 	VARCHAR2 ,
32 		p_error_message		OUT 	VARCHAR2
33 	 ) IS
34 
35 	G_PRC_LST_DEF_ATTEMPTS  CONSTANT NUMBER := 2;
36 
37 	l_api_version_number 	NUMBER;
38 	l_fetch_attempts 		NUMBER;
39  	l_init_msg_list    		VARCHAR2(1);
40  	l_validation_level    	NUMBER;
41 	l_return_status    		VARCHAR2(1);
42 	l_msg_count			NUMBER;
43 	l_msg_data			VARCHAR2(2000);
44  	l_prc_method_code		VARCHAR2(4);
45 	l_error_message		VARCHAR2(2000);
46 
47  BEGIN
48 	/* This should be changed whenever the api version changes */
49 	l_api_version_number 		:= 1.0;
50 
51 	/* Initialize the message list */
52  	l_init_msg_list    			:= FND_API.G_FALSE;
53 
54 
55 
56  	l_validation_level    		:= FND_API.G_VALID_LEVEL_FULL;
57  	l_fetch_attempts    		:= G_PRC_LST_DEF_ATTEMPTS;
58 
59 
60 	/* Method code in so_price_list_lines can be either amount based or */
61 	/* percentage based . */
62 
63 	SELECT DISTINCT METHOD_CODE
64 	INTO  l_prc_method_code
65 	FROM  so_price_list_lines
66 	WHERE Price_List_Id = p_price_list_id
67      AND   Inventory_Item_Id = p_inventory_item_id
68 	AND   Unit_Code  = p_unit_Code;
69 
70 	--DBMS_Output.Put_Line('Calling Fetch_List_Price. ');
71 	--DBMS_Output.Put_Line('Values passed are :');
72 	--DBMS_Output.Put_Line('Version No.='||to_char(l_api_version_number));
73 	--DBMS_Output.Put_Line('Init Msg. List='|| l_init_msg_list);
74 	--DBMS_Output.Put_Line('Return Status=' || l_return_status);
75 
76 
77  	/* Call Fetch_Price_List. */
78   	OE_PRICE_LIST_PVT.FETCH_LIST_PRICE
79 			(l_api_version_number  ,
80      		 l_init_msg_list       ,
81 	           l_validation_level    ,
82      		 l_return_status       ,
83      		 l_msg_count           ,
84      		 l_msg_data            ,
85      		 p_price_list_id       ,
86      		 p_inventory_item_id   ,
87 			 p_unit_code	        ,
88 			 p_service_duration    ,
89 			 p_item_type_code      ,
90 			 l_prc_method_code     ,
91 			 p_pricing_attribute1  ,
92 			 p_pricing_attribute2  ,
93 			 p_pricing_attribute3  ,
94 			 p_pricing_attribute4  ,
95 			 p_pricing_attribute5  ,
96 			 p_pricing_attribute6  ,
97 			 p_pricing_attribute7  ,
98 			 p_pricing_attribute8  ,
99 			 p_pricing_attribute9  ,
100 			 p_pricing_attribute10  ,
101 			 p_pricing_attribute11  ,
102 			 p_pricing_attribute12  ,
103 			 p_pricing_attribute13  ,
104 			 p_pricing_attribute14  ,
105 			 p_pricing_attribute15  ,
106 			 p_base_price  ,
107 			 l_fetch_attempts  ,
108 			 p_price_list_id_out  ,
109 			 p_prc_method_code_out  ,
110 			 p_list_price  ,
111 			 p_list_percent  ,
112 			 p_rounding_factor
113      				);
114 
115 
116  	IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
117 		p_error_flag := 'Y';
118 	ELSE
119 		p_error_flag := 'N';
120 	END IF;
121 
122 	l_error_message := NULL ;
123 	/** Check if there are any warnings passed from the Pricing API. **/
124 	IF (l_msg_count >= 1) THEN
125      		FOR I IN 1..l_msg_count LOOP
126  			l_msg_data := FND_MSG_PUB.Get(p_msg_index => I,
127  					p_encoded     => FND_API.G_FALSE);
128 		 	l_error_message := l_error_message || to_char(i);
129 		 	l_error_message := l_error_message || l_msg_data;
130      		END LOOP;
131 	END IF ;
132 
133 	FND_MSG_PUB.Delete_Msg ;
134 
135    END call_fetch_list_price ;
136 
137 END cs_list_price_pkg;