DBA Data[Home] [Help]

PACKAGE BODY: APPS.GMF_GET_XFER_PRICE_HOOK_PUB

Source


1 PACKAGE BODY GMF_get_xfer_price_hook_PUB AS
2 /* $Header: GMFXFRUB.pls 120.6 2006/09/21 13:30:38 umoogala noship $ */
3 
4   G_PKG_NAME  CONSTANT VARCHAR2(30) := 'GMF_get_xfer_price_hook_PUB';
5 
6   -- Start of comments
7   -- API name        : Get_xfer_price_user_hook
8   -- Type            : Public
9   -- Pre-reqs        : None
10   -- Parameters      :
11   -- Version         : Current version 1.0
12   --                   Initial version 1.0
13   -- PURPOSE: Pseudo code
14   --   Begin
15   --     IF (p_from_organization_id IS discrete org) THEN
16   --       call discrete get prior cost routine
17   --       return -1
18   --     ELSE
19   --       Call process get prior cost
20   --       return -1
21   --   end;
22   -- End of comments
23 
24   procedure Get_xfer_price_user_hook
25     ( p_api_version                       IN            NUMBER
26     , p_init_msg_list                     IN            VARCHAR2
27 
28     , p_transaction_uom                   IN            VARCHAR2
29     , p_inventory_item_id                 IN            NUMBER
30     , p_transaction_id                    IN            NUMBER
31     , p_from_organization_id              IN            NUMBER
32     , p_to_organization_id                IN            NUMBER
33     , p_from_ou                           IN            NUMBER
34     , p_to_ou                             IN            NUMBER
35 
36     , x_return_status                     OUT NOCOPY    NUMBER
37     , x_msg_data                          OUT NOCOPY    VARCHAR2
38     , x_msg_count                         OUT NOCOPY    NUMBER
39 
40     , x_transfer_price                    OUT NOCOPY    NUMBER
41     , x_transfer_price_priuom             OUT NOCOPY    NUMBER
42     , x_currency_code                     OUT NOCOPY    VARCHAR2
43     )
44    IS
45 
46      l_api_name    CONSTANT       VARCHAR2(30) := 'Get_xfer_price_user_hook';
47      l_api_version CONSTANT       NUMBER       := 1.0;
48 
49      l_process_enabled_flag       mtl_parameters.process_enabled_flag%TYPE;
50      l_primary_cost_method        mtl_parameters.primary_cost_method%TYPE;
51      l_return_status              VARCHAR2(10);
52 
53   BEGIN
54 
55     -------------------------------------------------------------------------
56     -- initialize api return status to -1 to indicate no user hook
57     -------------------------------------------------------------------------
58     SELECT NVL(process_enabled_flag, 'N'), primary_cost_method
59       INTO l_process_enabled_flag, l_primary_cost_method
60       FROM mtl_parameters mp
61      WHERE organization_id = p_from_organization_id
62     ;
63 
64     IF l_process_enabled_flag = 'Y'
65     THEN
66       --
67       -- Sending Org is process org.
68       --
69       x_return_status := -1;
70       x_msg_count := 0;
71 
72       --
73       -- Following is the call to get the prior period cost, if the cost method is
74       -- Standard or Actual. For Lot Cost method, error is thrown. Cost Method is
75       -- derived from the Cost Type in Fiscal Policy setup.
76       --
77       -- To get the prior period cost, users have to uncomment the following call.
78       --
79 
80       /*
81       GMF_PROCESS_COST_PUB.Get_Prior_Period_Cost(
82           p_inventory_item_id => p_inventory_item_id
83         , p_organization_id   => p_from_organization_id
84         , p_transaction_date  => sysdate
85         , x_unit_cost         => x_transfer_price
86         , x_msg_data          => x_msg_data
87         , x_return_status     => l_return_status
88       );
89 
90       IF l_return_status <> FND_API.G_RET_STS_SUCCESS
91       THEN
92         x_return_status := -2;
93         FND_MESSAGE.SET_NAME('GMF', 'GMF_NO_PRIOR_PERIOD_COST');
94         x_msg_data      := FND_MESSAGE.get;
95       ELSE
96 	x_transfer_price_priuom := x_transfer_price;
97         x_return_status := 0;
98         x_msg_data      := NULL;
99       END IF;
100       */
101     ELSE
102       x_return_status := -1;
103       x_msg_count := 0;
104 
105       IF l_primary_cost_method = 1
106       THEN
107         CSTPSCHK.Get_xfer_price_user_hook (
108             p_api_version          => 1.0
109           , p_init_msg_list        => fnd_api.g_false
110 
111           , p_transaction_uom      => p_transaction_uom
112           , p_inventory_item_id    => p_inventory_item_id
113           , p_transaction_id       => p_transaction_id
114 
115           , p_from_organization_id => p_from_organization_id
116           , p_to_organization_id   => p_to_organization_id
117 
118           , p_from_ou              => p_from_ou
119           , p_to_ou                => p_to_ou
120 
121           , x_return_status        => x_return_status
122           , x_msg_data             => x_msg_data
123           , x_msg_count            => x_msg_count
124 
125           , x_transfer_price       => x_transfer_price
126           , x_currency_code        => x_currency_code
127           );
128       ELSE
129         CSTPACHK.Get_xfer_price_user_hook (
130             p_api_version          => 1.0
131           , p_init_msg_list        => fnd_api.g_false
132 
133           , p_transaction_uom      => p_transaction_uom
134           , p_inventory_item_id    => p_inventory_item_id
135           , p_transaction_id       => p_transaction_id
136 
137           , p_from_organization_id => p_from_organization_id
138           , p_to_organization_id   => p_to_organization_id
139 
140           , p_from_ou              => p_from_ou
141           , p_to_ou                => p_to_ou
142 
143           , x_return_status        => x_return_status
144           , x_msg_data             => x_msg_data
145           , x_msg_count            => x_msg_count
146 
147           , x_transfer_price       => x_transfer_price
148           , x_currency_code        => x_currency_code
149           );
150       END IF;
151 
152       IF x_return_status = -1
153       THEN
154         return;
155       ELSIF x_return_status <> 0
156       THEN
157         x_return_status := -2;
158       ELSE
159 	x_transfer_price_priuom := x_transfer_price;
160         x_return_status := 0;
161         x_msg_data      := NULL;
162       END IF;
163 
164     END IF;
165 
166   END Get_xfer_price_user_hook;
167 
168 END GMF_get_xfer_price_hook_PUB;