DBA Data[Home] [Help]

PACKAGE BODY: APPS.WMS_ATF_DEST_LPN

Source


1 package body wms_atf_dest_lpn as
2  /* $Header: WMSDLPNB.pls 115.10 2003/11/03 21:17:12 joabraha noship $ */
3 --
4 -- ---------------------------------------------------------------------------|
5 -- |-------------------------------< trace >----------------------------------|
6 -- ---------------------------------------------------------------------------|
7 -- {Start Of Comments}
8 --
9 -- Description:
10 -- Wrapper around the tracing utility.
11 --
12 -- Prerequisites:
13 -- None
14 --
15 -- In Parameters:
16 --   Name        Reqd Type     Description
17 --   p_message   Yes  varchar2 Message to be displayed in the log file.
18 --   p_prompt    Yes  varchar2 Prompt.
19 --   p_level     No   number   Level.
20 --
21 -- Post Success:
22 --   None.
23 --
24 -- Post Failure:
25 --   None
26 --
27 -- Access Status:
28 --   Internal Development Use Only.
29 --
30 -- {End Of Comments}
31 --
32 Procedure trace(
33    p_message  in varchar2
34 ,  p_level    in number
35 ) is
36 begin
37       INV_LOG_UTIL.trace(p_message, 'SEED_LOC_API', p_level);
38 end trace;
39 --
40 -- -----------------------------------------------------------------------------|
41 -- |------------------------< get_dest_lpn >------------------------------------|
42 -- -----------------------------------------------------------------------------|
43 -- API name    : Get_destination_Loc_LPN
44 -- Type        : Private
45 -- Function    : Returns Sub/Loc, LPN or Validation Status.
46 -- Input Parameters  :
47 --             As shown below.
48 --
49 -- Output Parameters:
50 --             As shown below.
51 -- Version     :
52 -- Current version 1.0
53 --
54 -- Notes       :
55 -- Date           Modification       Author
56 -- ------------   ------------       ------------------
57 --
58 PROCEDURE get_dest_lpn(
59    x_return_status       out nocopy varchar2
60 ,  x_msg_count           out nocopy number
61 ,  x_msg_data            out nocopy varchar2
62 ,  x_lpn_id              out nocopy number
63 ,  x_valid_flag          out nocopy varchar2
64 ,  p_mode                in  number -- 1. Selection  2. Validation
65 ,  p_task_id             in  number -- MMTT.transaction_temp_id
66 ,  p_activity_type_id    in  number -- 1. Inbound   2. Outbound
67 ,  p_hook_call_id	 in  number -- Seeded/Custom API call hook id in the wms_api_hook_calls.
68 ,  p_lpn_id              in  number -- LPN ID for Validation purposes.
69 ,  p_item_id             in  number -- Item ID for Validation purposes.
70 ,  p_subinventory_code   in  varchar2 -- Subinventory code passed from WMSATFRB.pls
71 ,  p_locator_id          in  number -- Locator ID passed from WMSATFRB.pls
72 ,  p_api_version         in  number
73 ,  p_init_msg_list       in  varchar2
74 ,  p_commit              in  varchar2
75 )
76 is
77 
78 cursor c_get_hook_call_details is
79 select wahe.current_package_cntr
80 from   wms_api_hook_calls wahc, wms_api_hooked_entities wahe
81 where  wahe.module_hook_id = wahc.module_hook_id
82 and    wahe.short_name_id = 2                    -- Restricts the output to "LPN Selection/Validation" only
83 and    wahc.hook_call_id = p_hook_call_id;
84 
85 l_debug  			number := NVL(FND_PROFILE.VALUE('INV_DEBUG_TRACE'),0);
86 l_proc                          varchar2(72) := 'GET_DEST_LPN :';
87 l_current_package_cntr		number;
88 
89 begin
90    -- ### Initialize API return status to success
91    x_return_status := FND_API.G_RET_STS_SUCCESS;
92 
93    if (l_debug = 1) then
94       trace(l_proc ||' Entering package wms_atf_dest_locator  '|| to_char(sysdate, 'YYYY-MM-DD HH:DD:SS'), 1);
95       trace(l_proc ||' Entering procedure get_dest_locator  '|| to_char(sysdate, 'YYYY-MM-DD HH:DD:SS'), 1);
96       trace(l_proc ||' p_mode => ' || p_mode);
97       trace(l_proc ||' p_task_id => ' || p_task_id);
98       trace(l_proc ||' p_activity_type_id  => ' || p_activity_type_id);
99       trace(l_proc ||' p_hook_call_id   => ' || p_hook_call_id);
100       trace(l_proc ||' p_lpn_id => ' || p_lpn_id);
101       trace(l_proc ||' p_item_id => ' || p_item_id, 4);
102       trace(l_proc ||' p_subinventory_code => ' || p_subinventory_code, 4);
103       trace(l_proc ||' p_locator_id => ' || p_locator_id, 4);
104    end if;
105 
106    -- ### Derive hook call details to start with.
107    if (l_debug = 1) then
108       trace(l_proc ||' Opening Cursor c_get_hook_call_details  '|| to_char(sysdate, 'YYYY-MM-DD HH:DD:SS'), 1);
109    end if;
110    -- Opening Cursor...
111    open  c_get_hook_call_details;
112    if (l_debug = 1) then
113       trace(l_proc ||' Fetching Cursor c_get_hook_call_details  '|| to_char(sysdate, 'YYYY-MM-DD HH:DD:SS'), 1);
114    end if;
115 
116    fetch c_get_hook_call_details
117    into  l_current_package_cntr;
118 
119       if c_get_hook_call_details%NOTFOUND then
120          if (l_debug = 1) then
121             trace(l_proc ||' c_get_hook_call_details%NOTFOUND...Invalid p_hook_call_id passed in ...Cannot Proceed');
122          end if;
123          close c_get_hook_call_details;
124       else
125          -- ### Short Name is maintained as an MFG_LOOKUP.
126          -- ### 1. Loc Determination
127          -- ### 2. LPN Determination
128          if  (l_debug = 1) then
129              trace(l_proc ||' Cursor c_get_hook_call_details FOUND...');
130              trace(l_proc ||' Values after fetching Cursor c_get_hook_call_details.. ', 4);
131              trace(l_proc ||' l_current_package_cntr '|| l_current_package_cntr, 4);
132          end if;
133 
134          -- ### Check if p_mode is 'Validation' and the p_locator_id is null.
135          if (p_mode = 2 and p_lpn_id is null)
136          then
137              if (l_debug =1) then
138                 trace(l_proc ||' LPN ID cannot be null if "wms_atf_dest_lPN.get_dest_lPN" is called in validation mode');
139              end if;
140              return;
141          end if;
142          -- ###
143          -- ### This means that the call is to select/validate LPN.
144          -- ### Also call the current package based on the counter.
145          -- ###
146          -- ### Validation mode is not enabled for LPN's in patchset 'J'.
147          -- ###
148          -- ### Procedure  GET_LPN(
149 	 -- ### x_return_status                  OUT  VARCHAR2,
150 	 -- ### x_msg_count                      OUT  NUMBER,
151 	 -- ### x_msg_data                       OUT  VARCHAR2,
152 	 -- ### x_lpn_id                         OUT  NUMBER,
153 	 -- ### x_lpn_valid                      OUT  VARCHAR2,
154 	 -- ### p_mode                           IN  NUMBER,
155 	 -- ### p_activity_type_id               IN  NUMBER,
156 	 -- ### p_task_id                        IN  NUMBER,
157 	 -- ### p_lpn_id                         IN  NUMBER,
158 	 -- ### p_item_id                        IN  NUMBER,
159 	 -- ### p_subinventory_code              IN  VARCHAR2
160 	 -- ### p_locator_id                     IN  NUMBER
161 	 -- ### p_hook_call_id                   IN  NUMBER
162 	 -- ### );
163 
164          if l_current_package_cntr = 1
165          then
166             	wms_api_lpn_package_1.get_lpn(
167             	   x_return_status        => x_return_status
168             	,  x_msg_count            => x_msg_count
169             	,  x_msg_data             => x_msg_data
170             	,  x_lpn_id               => x_lpn_id
171             	,  x_lpn_valid            => x_valid_flag
172             	,  p_mode                 => p_mode
173             	,  p_activity_type_id     => p_activity_type_id
174             	,  p_task_id              => p_task_id
175             	,  p_lpn_id               => p_lpn_id
176             	,  p_item_id              => p_item_id
177             	,  p_subinventory_code    => p_subinventory_code
178             	,  p_locator_id           => p_locator_id
179                 ,  p_api_version          => p_api_version
180                 ,  p_init_msg_list        => p_init_msg_list
181                 ,  p_commit               => p_commit
182             	,  p_hook_call_id         => p_hook_call_id
183             	);
184          elsif l_current_package_cntr = 2
185          then
186             	wms_api_lpn_package_2.get_lpn(
187             	   x_return_status        => x_return_status
188             	,  x_msg_count            => x_msg_count
189             	,  x_msg_data             => x_msg_data
190             	,  x_lpn_id               => x_lpn_id
191             	,  x_lpn_valid            => x_valid_flag
192             	,  p_mode                 => p_mode
193             	,  p_activity_type_id     => p_activity_type_id
194             	,  p_task_id              => p_task_id
195             	,  p_lpn_id               => p_lpn_id
196             	,  p_item_id              => p_item_id
197             	,  p_subinventory_code    => p_subinventory_code
198             	,  p_locator_id           => p_locator_id
199                 ,  p_api_version          => p_api_version
200                 ,  p_init_msg_list        => p_init_msg_list
201                 ,  p_commit               => p_commit
202             	,  p_hook_call_id         => p_hook_call_id
203             	);
204          end if;
205          if (l_debug = 1) then
206             trace(l_proc ||' Exiting package wms_atf_dest_loc_lpn_wrap  '|| to_char(sysdate, 'YYYY-MM-DD HH:DD:SS'), 1);
207             trace(l_proc ||' Exiting procedure get_dest_loc_lpn_wrap  '|| to_char(sysdate, 'YYYY-MM-DD HH:DD:SS'), 1);
208             trace(l_proc ||'   x_lpn_id      => ' || x_lpn_id);
209             trace(l_proc ||'   x_valid_flag    => ' || x_valid_flag, 4);
210          end if;
211       end if;
212       close c_get_hook_call_details;
213 exception
214     when others then
215          close c_get_hook_call_details;
216 
217          if (l_debug = 1) then
218             trace(l_proc ||' Error within "When Others" of the Outermost block in the get_dest_loc_lpn_wrap package is ..'|| sqlerrm(sqlcode));
219          end if;
220 end get_dest_lpn;
221 
222 end wms_atf_dest_lpn;