DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PROCESS_USER_SS_API

Source


1 package body ben_process_user_ss_api AS
2 /* $Header: benusrwf.pkb 120.0.12000000.2 2007/02/22 10:33:20 vvprabhu noship $*/
3 
4 -- Global variables
5   g_package                  constant varchar2(80):='ben_process_user_ss_api.';
6   g_data_error               exception;
7   g_void_fnd_user_rec        ben_process_user_utility.fnd_user_record;
8   g_void_fnd_resp_rec        ben_process_user_utility.fnd_resp_record;
9 
10 --
11 function get_transaction_step_id
12    (p_item_type                       in  varchar2
13    ,p_item_key                        in  varchar2
14    ,p_activity_id                     in  number
15    ) return number is
16   --
17   l_obj_vers_num               number;
18   l_no_of_rows                 number := 0;
19   l_transaction_step_id        number := null;
20   --
21 begin
22   --
23   /*if p_user_name is null then
24     return l_transaction_step_id;
25   end if;*/
26   --
27   -- ------------------------------------------------------------------
28   -- Check if there are any transaction rec already saved for the curren
29   -- transaction. This is used for re-display of the user page when a user
30   -- clicks series of Back buttons starting from the Review page to go back to the user page
31   -- to make further changes or to correct errors.
32   -----------------------------------------------------------------------------
33   --
34   hr_transaction_api.get_transaction_step_info
35    (p_item_type              => p_item_type
36    ,p_item_key               => p_item_key
37    ,p_activity_id            => p_activity_id
38    ,p_transaction_step_id    => l_transaction_step_id
39    ,p_object_version_number  => l_obj_vers_num
40    );
41   --
42   if l_no_of_rows > 0 then
43     null;
44   else
45      return l_transaction_step_id;
46   end if;
47   --
48   /*for i in 1..l_no_of_rows loop
49   l_user_name
50          := hr_transaction_api.get_varchar2_value
51                     (p_transaction_step_id => l_transaction_step_ids(i-1)
52                     ,p_name                => 'P_USER_NAME');
53      if p_user_name = l_user_name then
54       l_transaction_step_id := l_transaction_step_ids(i-1);
55       exit;
56      end if;
57   end loop;*/
58   --
59   return l_transaction_step_id;
60   --
61 end get_transaction_step_id;
62 --
63 -- ---------------------------------------------------------------------------
64 -- ---------------------- < get_user_data_from_tt> -------------------------
65 -- ---------------------------------------------------------------------------
66 -- Purpose: This procedure will get transaction data which are pending for
67 --          approval in workflow for a transaction step id.
68 --          This is the procedure which does the actual work.
69 -- ---------------------------------------------------------------------------
70 procedure get_user_data_from_tt
71   (p_transaction_step_id             in  number
72   ,p_user_name                    out nocopy varchar2
73   ,p_user_pswd                    out nocopy varchar2
74   ,p_pswd_hint                    out nocopy varchar2
75   ,p_owner                        out nocopy varchar2
76   ,p_session_number               out nocopy number
77   ,p_start_date                   out nocopy date
78   ,p_end_date                     out nocopy date
79   ,p_last_logon_date              out nocopy date
80   ,p_password_date                out nocopy date
81   ,p_password_accesses_left       out nocopy number
82   ,p_password_lifespan_accesses   out nocopy number
83   ,p_password_lifespan_days       out nocopy number
84   ,p_employee_id                  out nocopy number
85   ,p_email_address                out nocopy varchar2
86   ,p_fax                          out nocopy varchar2
87   ,p_customer_id                  out nocopy number
88   ,p_supplier_id                  out nocopy number
89   ,p_business_group_id            out nocopy number
90   ,p_respons_id                   out nocopy number
91   ,p_respons_appl_id              out nocopy number
92    ) is
93   --
94    cursor c_txn_values is
95      select txn.name
96            ,txn.varchar2_value
97            ,txn.number_value
98            ,txn.date_value
99      from  hr_api_transaction_values txn
100      where txn.transaction_step_id = p_transaction_step_id
101      and   (txn.varchar2_value is not null or
102             txn.number_value is not null or
106   --
103             txn.date_value is not null);
104   --
105 begin
107   if p_transaction_step_id is null then
108     return;
109   end if;
110   --
111   for l_txn_values in c_txn_values loop
112   --
113     if l_txn_values.name = 'P_USER_NAME' then
114       p_user_name := l_txn_values.varchar2_value;
115     elsif l_txn_values.name = 'P_ENCRYPTED_PASSWORD' then
116       p_user_pswd := l_txn_values.varchar2_value;
117     elsif l_txn_values.name = 'P_DESCRIPTION' then
118       p_pswd_hint := l_txn_values.varchar2_value;
119     elsif l_txn_values.name = 'P_OWNER' then
120       p_owner := l_txn_values.varchar2_value;
121     elsif l_txn_values.name = 'P_SESSION_NUMBER' then
122       p_session_number := l_txn_values.number_value;
123     elsif l_txn_values.name = 'P_START_DATE' then
124       p_start_date := l_txn_values.date_value;
125     elsif l_txn_values.name = 'P_END_DATE' then
126       p_end_date := l_txn_values.date_value;
127     elsif l_txn_values.name = 'P_LAST_LOGON_DATE' then
128       p_last_logon_date := l_txn_values.date_value;
129     elsif l_txn_values.name = 'P_PASSWORD_DATE' then
130       p_password_date := l_txn_values.date_value;
131     elsif l_txn_values.name = 'P_PASSWORD_ACCESSES_LEFT' then
132       p_password_accesses_left := l_txn_values.number_value;
133     elsif l_txn_values.name = 'P_PASSWORD_LIFESPAN_ACCESSES' then
134       p_password_lifespan_accesses := l_txn_values.number_value;
135     elsif l_txn_values.name = 'P_PASSWORD_LIFESPAN_DAYS' then
136       p_password_lifespan_days := l_txn_values.number_value;
137     elsif l_txn_values.name = 'P_EMPLOYEE_ID' then
138       p_employee_id := l_txn_values.number_value;
139     elsif l_txn_values.name = 'P_EMAIL_ADDRESS' then
140       p_email_address := l_txn_values.varchar2_value;
141     elsif l_txn_values.name = 'P_FAX' then
142       p_fax := l_txn_values.varchar2_value;
143     elsif l_txn_values.name = 'P_CUSTOMER_ID' then
144       p_customer_id := l_txn_values.number_value;
145     elsif l_txn_values.name = 'P_SUPPLIER_ID' then
146       p_supplier_id := l_txn_values.number_value;
147     elsif l_txn_values.name = 'P_BUSINESS_GROUP_ID' then
148       p_business_group_id := l_txn_values.number_value;
149     elsif l_txn_values.name = 'P_RESPONSIBILITY_ID' then
150       p_respons_id := l_txn_values.number_value;
151     elsif l_txn_values.name = 'P_RESPONSIBILITY_APPL_ID' then
152       p_respons_appl_id := l_txn_values.number_value;
153     end if;
154     --
155   end loop;
156   --
157 end get_user_data_from_tt;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |---------------------- < create_sec_profile_asg > ------------------------|
161 -- ----------------------------------------------------------------------------
162 --
163 PROCEDURE create_sec_profile_asg
164   (p_user_id               in fnd_user.user_id%type
165   ,p_sec_group_id          in fnd_security_groups.security_group_id%type
166   ,p_sec_profile_id        in per_security_profiles.security_profile_id%type
167   ,p_resp_id               in fnd_responsibility.responsibility_id%type
168   ,p_resp_app_id           in per_sec_profile_assignments.responsibility_application_id%type
169   ,p_start_date            in per_sec_profile_assignments.start_date%type
170   ,p_end_date              in per_sec_profile_assignments.end_date%type default null
171   ,p_business_group_id     in per_sec_profile_assignments.business_group_id%type default null
172 
173   ) is
174 --
175 --
176   cursor lc_get_sec_group_id IS
177   select fsg.security_group_id
178   from   fnd_security_groups fsg
179   where  fsg.security_group_id = p_sec_group_id;
180 --
181   cursor lc_get_sec_profile IS
182   select psp.security_profile_id
183         ,psp.business_group_id
184   from   per_security_profiles psp
185   where  psp.security_profile_id = p_sec_profile_id;
186 --
187   l_bg_id               per_security_profiles.business_group_id%type := null;
188   l_dummy               number default null;
189   l_sec_prof_asg_id
190         per_sec_profile_assignments.sec_profile_assignment_id%type := null;
191   l_obj_vers_num
192         per_sec_profile_assignments.object_version_number%type := null;
193   l_proc                varchar2(72) := g_package|| 'create_sec_profile_asg';
194 
195 BEGIN
196   hr_utility.set_location('Entering:' || l_proc, 10);
197   --
198   --Validate input parameters first.
199   --Validate security group id
200 
201     l_dummy := null;
202 
203     open lc_get_sec_group_id;
204     fetch lc_get_sec_group_id into l_dummy;
205     if lc_get_sec_group_id%NOTFOUND
206     then
207        close lc_get_sec_group_id;
208        fnd_message.set_name('FND', 'SQL_NO_DATA_FOUND');
209        fnd_message.set_token('TABLE', 'FND_SECURITY_GROUPS');
210        fnd_message.set_token('COLUMN', 'SECURITY_GROUP_ID');
211        fnd_message.set_token('VALUE', to_char(p_sec_group_id));
212        hr_utility.raise_error;
213     else
214        close lc_get_sec_group_id;
215     end if;
216   --
217   -- Validate security_profile_id
218      l_dummy := null;
219 
220     open lc_get_sec_profile;
221     fetch lc_get_sec_profile into l_dummy, l_bg_id;
222     --
223     if lc_get_sec_profile%NOTFOUND
224     then
225        close lc_get_sec_profile;
226        fnd_message.set_name('FND', 'SQL_NO_DATA_FOUND');
227        fnd_message.set_token('TABLE', 'PER_SECURITY_PROFILES');
228        fnd_message.set_token('COLUMN', 'SECURITY_PROFILE_ID');
229        fnd_message.set_token('VALUE', to_char(p_sec_profile_id));
230        hr_utility.raise_error;
231     else
232        close lc_get_sec_profile;
233     end if;
234   --
235   -- Validate Start Date cannot be null
239      hr_utility.raise_error;
236   if p_start_date is null
237   then
238      hr_utility.set_message(800, 'HR_50374_SSL_MAND_START_DATE');
240   end if;
241 --
242 if p_end_date is not null
243   then
244      if p_end_date < nvl(p_start_date, p_end_date + 1)
245      then
246         hr_utility.set_message(800, 'HR_51070_CAU_START_END');
247         hr_utility.raise_error;
248      end if;
249   end if;
250   --
251   -- Now call the per_asp_ins.ins which will insert a row into
252   -- per_sec_profile_assignments as well as fnd_user_resp_groups.
253   per_asp_ins.ins
254     (p_user_id                      => p_user_id
255     ,p_security_group_id            => p_sec_group_id
256     ,p_business_group_id            => l_bg_id
257     ,p_security_profile_id          => p_sec_profile_id
258     ,p_responsibility_id            => p_resp_id
259     ,p_responsibility_application_i => p_resp_app_id
260     ,p_start_date                   => p_start_date
261     ,p_end_date                     => p_end_date
262     ,p_sec_profile_assignment_id    => l_sec_prof_asg_id
263     ,p_object_version_number        => l_obj_vers_num
264     );
265 
266 --
267   hr_utility.set_location('Leaving:'||l_proc, 50);
268 
269 
270 END create_sec_profile_asg;
271 --
272 -- ---------------------------------------------------------------------------
273 -- ---------------------- < add_func_sec_exclusion_rules> -------------------------
274 -- ---------------------------------------------------------------------------
275 procedure add_func_sec_exclusion_rules
276       (p_resp_id               in fnd_responsibility.responsibility_id%type
277       ,p_resp_app_id           in fnd_responsibility.application_id%type)
278 is
279 --
280   cursor lc_get_resp_func (p_resp_id in
281                               fnd_responsibility.responsibility_id%type
282                           ,p_app_id  in
283                               fnd_responsibility.application_id%type)
284   is
285   select   frf.action_id, frf.rule_type
286   from     fnd_resp_functions frf
287   where    frf.application_id = p_app_id
288   and      frf.responsibility_id = p_resp_id;
289 --
290 
291   cursor lc_get_function_name (p_func_id in fnd_form_functions.function_id%type)
292   is
293   select   fff.function_name
294   from     fnd_form_functions fff
295   where    fff.function_id = p_func_id;
296 --
297   cursor lc_get_menu_name (p_menu_id in fnd_menus.menu_id%type)
298   is
299   select   fm.menu_name
300   from     fnd_menus fm
301   where    fm.menu_id = p_menu_id;
302 --
303   cursor lc_get_resp_id (p_resp_id in
304                               fnd_responsibility.responsibility_id%type
305                           ,p_app_id  in
306                               fnd_responsibility.application_id%type)
307   is
308   select   fr.responsibility_key
309   FROM     fnd_responsibility fr
310   where    fr.application_id = p_app_id
311   and      fr.responsibility_id = p_resp_id;
312 --
313   l_proc                      varchar2(72) := g_package ||
314                                               'add_func_sec_exclusion_rules';
315   l_rule_name                 fnd_form_functions.function_name%type;
316   l_resp_key                  fnd_responsibility.responsibility_key%type;
317   l_func_sec_excl_err         exception;
318 --
319 begin
320   hr_utility.set_location('Entering:'|| l_proc, 11);
321 --
322   for get_resp_func_rec in lc_get_resp_func
323             (p_resp_id => p_resp_id
324             ,p_app_id  => p_resp_app_id)
325         loop
326            --
327            if get_resp_func_rec.rule_type = 'F'
328            then
329               -- derive the function_name from fnd_form_functions
330               open lc_get_function_name
331                    (p_func_id => get_resp_func_rec.action_id);
332               fetch lc_get_function_name into l_rule_name;
333               if lc_get_function_name%NOTFOUND
334               then
335                  -- raise an error
336                  close lc_get_function_name;
337                  raise l_func_sec_excl_err;
338               else
339                  close lc_get_function_name;
340               end if;
341            else
342               -- derive the menu_name from fnd_menus
343               open lc_get_menu_name
344                    (p_menu_id => get_resp_func_rec.action_id);
345               fetch lc_get_menu_name into l_rule_name;
346               if lc_get_menu_name%NOTFOUND
347               then
348                  -- raise an error
349                  close lc_get_menu_name;
350                  raise l_func_sec_excl_err;
351               else
352                  close lc_get_menu_name;
353               end if;
354            end if;
355 
356               open lc_get_resp_id
357                    (p_resp_id => p_resp_id
358                     ,p_app_id  => p_resp_app_id);
359               fetch lc_get_resp_id into l_resp_key;
360               if lc_get_resp_id%NOTFOUND
361               then
362                  -- raise an error
363                  close lc_get_resp_id;
364                  raise l_func_sec_excl_err;
365               else
366                  close lc_get_resp_id;
367               end if;
368 
369       fnd_function_security.security_rule
370       (responsibility_key  => l_resp_key
371       ,rule_type           => get_resp_func_rec.rule_type
372       ,rule_name           => l_rule_name);
373 
374     end loop;
375 --
376   hr_utility.set_location('Leaving:'|| l_proc, 15);
377 --
378 exception
382 --
379     when l_func_sec_excl_err then
380        hr_utility.set_message(800, 'HR_BUILD_FUNC_EXCL_RULE_ERR');
381        hr_utility.raise_error;
383     when others then
384        hr_utility.set_message(800, 'HR_BUILD_FUNC_EXCL_RULE_ERR');
385        hr_utility.raise_error;
386 --
387 END add_func_sec_exclusion_rules;
388 --
389 -- ---------------------------------------------------------------------------
390 -- ---------------------- < create_user_details> -------------------------
391 -- ---------------------------------------------------------------------------
392 -- Purpose: This procedure does have user hooks and actually calls fnd_user_pkg to do inserts.
393 -- ---------------------------------------------------------------------------
394 procedure create_user_details
395            (p_validate                   in boolean  default false
396            ,p_user_name                  in varchar2
397            ,p_owner                      in varchar2 default null
398            ,p_unencrypted_password       in varchar2
399            ,p_session_number             in number default 0
400            ,p_start_date                 in date default sysdate
401            ,p_end_date                   in date default null
402            ,p_last_logon_date            in date default null
403            ,p_description                in varchar2 default null
404            ,p_password_date              in date default sysdate
405            ,p_password_accesses_left     in number default null
406            ,p_password_lifespan_accesses in number default null
407            ,p_password_lifespan_days     in number default null
408            ,p_employee_id                in number default null
409            ,p_email_address              in varchar2 default null
410            ,p_fax                        in varchar2 default null
411            ,p_customer_id                in number default null
412            ,p_supplier_id                in number default null
413            ,p_business_group_id          in number default null
414            ,p_responsibility_id          in number default null
415            ,p_respons_application_id     in number default null
416            ,p_api_error                  out nocopy boolean
417            ,p_user_id                    out nocopy number
418            ) is
419 
420    l_user_id             number(15);
421    l_start_date          date;
422    l_end_date            date;
423    l_last_logon_date     date;
424    l_password_date       date;
425    l_respons_id          number ;
426    l_respons_appl_id     number ;
427    l_employee_id         number default null;
428    prflvalue             varchar2(2000);
429    l_enable_sec_groups    varchar2(2000) default null;
430    l_sec_group_id         fnd_security_groups.security_group_id%type := null;
431    l_out_func_sec_excl_tbl   hr_user_acct_utility.func_sec_excl_tbl;
432 
433    l_proc                varchar2(72) := g_package||'create_user_details';
434 
435    cursor  lc_get_sec_group_id
436   is
437   select  fsg.security_group_id
438   from    fnd_security_groups fsg
439   where   fsg.security_group_key = decode(p_business_group_id,0, 'STANDARD',to_char(p_business_group_id));
440   --
441 
442 begin
443 --
444   hr_utility.set_location('Entering:'|| l_proc, 10);
445 
446   savepoint create_user_details;
447   p_api_error := false;
448 
449  /************************************************************/
450  /*When this procedure gets called from create_user_details via
451  update_user_details(i.e userid/password getting created from
452  user page on pressing next  after typing in userid/password),
453  the responsibility that will get attached to this new user is
454  the value of the profile 'BEN_NEW_USER_RESP_PROFILE'.
455 
456  But if it's decided to generate user/pswd instead of typing it
457  in user page, by calling update_user_details(passing all
458  parameters as null) on pressing next
459  button,putting logic in the hooks then customer can pass respo-
460  nsibility_id and responsibility_application_id via global variables
461  defined in ben_process_user_utility package header.The value of
462  the global variables will be copied to the parameter for fnd_user_pkg.
463  createuserid and fnd_user_resp_groups_api and fnd_resp_functions api.
464 
465  Also we have taken care of the fact that username,password,
466  start_date,end_date,last_logon_date,password_date,password_
467  accesses_left,password_lifespan_accesses,password_lifespan_days,
468  email_address,fax,description,employee_id can be passed to
469  us from hooks via global variables in ben_process_user_utility
470  package header.*/
471 
472  /************************************************************/
473 
474   -- Clear the global record variables first.  Otherwise,these variables
475   -- may retain values from previous executions.
476   --
477 
478     ben_process_user_utility.g_fnd_user_record := g_void_fnd_user_rec;
479     ben_process_user_utility.g_fnd_resp_record := g_void_fnd_resp_rec;
480 
481   prflvalue := fnd_profile.value('BEN_NEW_USER_RESP_PROFILE');
482   if prflvalue is not null  and
483      p_responsibility_id is null and
484      p_respons_application_id is null then
485      l_respons_id := substr(prflvalue,1,length(prflvalue)-3);
486      l_respons_appl_id := substr(prflvalue,length(prflvalue)-2);
487   elsif p_responsibility_id is not null and
488         p_respons_application_id is not null then
489      l_respons_id := p_responsibility_id;
490      l_respons_appl_id := p_respons_application_id;
491   end if;
492 
493   /*if p_employee_id is null then
494   if ((hr_process_person_ss.g_session_id is not null) and
495      (hr_process_person_ss.g_session_id = ICX_SEC.G_SESSION_ID))
496   and hr_process_person_ss.g_person_id is not null
500      l_employee_id := hr_process_person_ss.g_person_id;
497   then
498   --if hr_process_person_ss.g_person_id is not null then
499 
501   end if;
502   else*/
503   if p_employee_id is not null then
504      l_employee_id := p_employee_id;
505   end if;
506 
507   -- Truncate the time portion from all date parameters
508   -- which are passed in.
509 
510   l_start_date        := trunc(p_start_date);
511   l_end_date          := trunc(p_end_date);
512   l_last_logon_date   := trunc(p_last_logon_date);
513   l_password_date     := trunc(p_password_date);
514 
515 
516   --<<before process hook>>
517 
518    -- Start of API User Hook for the before hook of create_user_details
519 
520    -- Users can use this hook to return username,password,responsibilities.
521    --
522   begin
523    hr_utility.set_location('Calling ben_process_user_ss_bk1.create_user_details_b', 12);
524 
525    ben_process_user_ss_bk1.create_user_details_b
526            (p_user_name                 => p_user_name
527            ,p_owner                     => p_owner
528            ,p_unencrypted_password      => p_unencrypted_password
529            ,p_session_number            => p_session_number
530            ,p_start_date                => l_start_date
531            ,p_end_date                  => l_end_date
532            ,p_last_logon_date           => l_last_logon_date
533            ,p_description               => p_description
534            ,p_password_date             => l_password_date
535            ,p_password_accesses_left    => p_password_accesses_left
536            ,p_password_lifespan_accesses=> p_password_lifespan_accesses
537            ,p_password_lifespan_days    => p_password_lifespan_days
538            ,p_employee_id               => p_employee_id
539            ,p_email_address             => p_email_address
540            ,p_fax                       => p_fax
541            ,p_customer_id               => p_customer_id
542            ,p_supplier_id               => p_supplier_id
543            ,p_responsibility_id         => nvl(p_responsibility_id,l_respons_id)
544            ,p_respons_application_id    => nvl(p_respons_application_id,l_respons_appl_id)
545            ,p_business_group_id         => p_business_group_id
546            );
547 
548     hr_utility.set_location('After calling ben_process_user_bk1.create_user_details_b'
549                             ,14);
550 
551   EXCEPTION
552     when hr_api.cannot_find_prog_unit then
553       hr_api.cannot_find_prog_unit_error
554         (p_module_name => 'CREATE_USER_DETAILS'
555         ,p_hook_type   => 'BP'
556         );
557     --
558     -- End of API User Hook for the before hook of create_user_details
559     --
560   end;
561   --
562 
563   l_user_id := fnd_user_pkg.createuserid
564            (x_user_name                 => nvl(ben_process_user_utility.g_fnd_user_record.user_name,p_user_name)
565            ,x_owner                     => p_owner
566            ,x_unencrypted_password      => nvl(ben_process_user_utility.g_fnd_user_record.password,p_unencrypted_password)
567            ,x_start_date                => nvl(ben_process_user_utility.g_fnd_user_record.start_date,p_start_date)
568            ,x_end_date                  => nvl(ben_process_user_utility.g_fnd_user_record.end_date,p_end_date)
569            ,x_last_logon_date           => nvl(ben_process_user_utility.g_fnd_user_record.last_logon_date,p_last_logon_date)
570            ,x_description               => nvl(ben_process_user_utility.g_fnd_user_record.description,p_description)
571            ,x_password_date             => nvl(ben_process_user_utility.g_fnd_user_record.password_date,p_password_date)
572            ,x_password_accesses_left    => nvl(ben_process_user_utility.g_fnd_user_record.password_accesses_left,p_password_accesses_left)
573            ,x_password_lifespan_accesses=> nvl(ben_process_user_utility.g_fnd_user_record.password_lifespan_accesses,p_password_lifespan_accesses)
574            ,x_password_lifespan_days    => nvl(ben_process_user_utility.g_fnd_user_record.password_lifespan_days,p_password_lifespan_days)
575            ,x_employee_id               => nvl(ben_process_user_utility.g_fnd_user_record.employee_id,l_employee_id)
576            ,x_email_address             => nvl(ben_process_user_utility.g_fnd_user_record.email_address,p_email_address)
577            ,x_fax                       => nvl(ben_process_user_utility.g_fnd_user_record.fax,p_fax)
578            ,x_customer_id               => nvl(ben_process_user_utility.g_fnd_user_record.customer_id,p_customer_id)
579            ,x_supplier_id               => nvl(ben_process_user_utility.g_fnd_user_record.supplier_id,p_supplier_id)
580            );
581 --
582 
583   if (l_respons_id is not null or ben_process_user_utility.g_fnd_resp_record.responsibility_id is not null)
584   and (l_respons_appl_id is not null or ben_process_user_utility.g_fnd_resp_record.respons_application_id is not null) then
585     --
586        -- Get the profile option value for 'ENABLE_SECURITY_GROUPS'
587        -- Use value_specific because you want the value of the resp being
588        -- assigned, not the resp you used to login.
589        --
590        l_enable_sec_groups := nvl(fnd_profile_server.value_specific(
591                                          'ENABLE_SECURITY_GROUPS'
592                                         ,l_user_id
593                                         , nvl(ben_process_user_utility.g_fnd_resp_record.responsibility_id,l_respons_id)
594                                         , nvl(ben_process_user_utility.g_fnd_resp_record.respons_application_id,l_respons_appl_id))
595                                     ,'N');
596 
597        if l_enable_sec_groups = 'N' then
598 
599           hr_utility.set_location (l_proc ||
600                 ' before create_fnd_user_resp_groups', 50);
604           -- **********************************************
601           --
602           -- **********************************************
603           -- Create the new fnd_user_resp_groups record
605 	     -- NOTE: Only insert a row into fnd_user_resp_groups
606 	     --       when the profile option 'ENABLE_SECURITY_GROUPS'
607 	     --       is 'N'.
608              --
609           fnd_user_resp_groups_api.insert_assignment(
610            user_id                       => l_user_id
611           ,responsibility_id             => nvl(ben_process_user_utility.g_fnd_resp_record.responsibility_id,l_respons_id)
612           ,responsibility_application_id => nvl(ben_process_user_utility.g_fnd_resp_record.respons_application_id,l_respons_appl_id)
613           ,security_group_id             => 0
614           ,start_date                    => nvl(ben_process_user_utility.g_fnd_user_record.start_date,p_start_date)
615           ,end_date                      => nvl(ben_process_user_utility.g_fnd_user_record.end_date,p_end_date)
616           ,description                   => null
617           );
618 
619       else
620           -- 'ENABLE_SECURITY_GROUPS' = 'Y'; customers have the option to insert
621           -- into fnd_user_resp_groups only if view-all security profile of the
622           -- employee's business group is to be used.
623           -- If a restricted security
624           -- profile is to be used, then we must call hrasprhi.pkb which will
625           -- insert one row into per_sec_profile_assignments as well as to
626           -- fnd_user_resp_groups.
627 
628           -- Insert into fnd_user_resp_groups only
629           -- get the security_group_id for the employee's business_group_id
630         if (ben_process_user_utility.g_fnd_resp_record.security_group_id is null
631            or ben_process_user_utility.g_fnd_resp_record.security_profile_id is null) then
632           open lc_get_sec_group_id;
633           fetch lc_get_sec_group_id into l_sec_group_id;
634           if lc_get_sec_group_id%NOTFOUND then
635 
636                 close lc_get_sec_group_id;
637                 fnd_message.set_name('FND', 'SQL_NO_DATA_FOUND');
638                 fnd_message.set_token('TABLE', 'FND_SECURITY_GROUPS');
639                 fnd_message.set_token('COLUMN', 'SECURITY_GROUP_KEY');
640                 fnd_message.set_token('VALUE', to_char(p_business_group_id));
641                 hr_utility.raise_error;
642           else
643                 close lc_get_sec_group_id;
644           end if;
645 
646              hr_utility.set_location (l_proc ||
647                 ' before create_fnd_user_resp_groups', 53);
648              --
649           fnd_user_resp_groups_api.insert_assignment(
650            user_id                       => l_user_id
651           ,responsibility_id             => nvl(ben_process_user_utility.g_fnd_resp_record.responsibility_id,l_respons_id)
652           ,responsibility_application_id => nvl(ben_process_user_utility.g_fnd_resp_record.respons_application_id,l_respons_appl_id)
653           ,security_group_id             => l_sec_group_id
654           ,start_date                    => nvl(ben_process_user_utility.g_fnd_user_record.start_date,p_start_date)
655           ,end_date                      => nvl(ben_process_user_utility.g_fnd_user_record.end_date,p_end_date)
656           ,description                   => null
657           );
658 
659          hr_utility.set_location (l_proc ||
660                 ' after create_fnd_user_resp_groups', 54);
661              --
662        else
663              -- sec_group_id and sec_profile_id are filled in
664              -- call peasprhi.pkb to insert into per_sec_profile_assignments
665              -- as well as fnd_user_resp_groups.
666 
667 	     hr_utility.set_location (l_proc ||
668 				 ' before create_sec_profile_asg', 56);
669 
670              -- Insert this row into per_sec_profile_assignments
671              create_sec_profile_asg
672                 (p_user_id            => l_user_id
673                 ,p_sec_group_id       => ben_process_user_utility.g_fnd_resp_record.security_group_id
674                 ,p_sec_profile_id     => ben_process_user_utility.g_fnd_resp_record.security_profile_id
675                 ,p_resp_id            => nvl(ben_process_user_utility.g_fnd_resp_record.responsibility_id,l_respons_id)
676                 ,p_resp_app_id        => nvl(ben_process_user_utility.g_fnd_resp_record.respons_application_id,l_respons_appl_id)
677                 ,p_start_date         => nvl(ben_process_user_utility.g_fnd_user_record.start_date,p_start_date)
678                 ,p_end_date           => nvl(ben_process_user_utility.g_fnd_user_record.end_date,p_end_date)
679                 );
680 
681              hr_utility.set_location (l_proc ||
682                                  ' after create_sec_profile_asg', 57);
683           end if;
684       end if;
685   end if;
686 --
687 --
688 
689   <<add_func_security_exclusion>>
690   -- ************************************************
691   -- Now create the fnd_resp_functions
692   -- ************************************************
693 
694   hr_utility.set_location(l_proc, 60);
695   --
696   /*add_func_sec_exclusion_rules
697      (p_resp_id            => nvl(ben_process_user_utility.g_fnd_resp_record.responsibility_id,l_respons_id)
698      ,p_resp_app_id        => nvl(ben_process_user_utility.g_fnd_resp_record.respons_application_id,l_respons_appl_id));
699    */
700   --
701 --
702 
703 --<<after_process_hook>>
704 
705   BEGIN
706     --
707     -- Start of API User Hook for the after hook of create_user_details
708    hr_utility.set_location('Calling ben_proocess_user_ss_bk1.create_user_details_a', 12);
709 
710    ben_process_user_ss_bk1.create_user_details_a
714            ,p_session_number            => p_session_number
711            (p_user_name                 => nvl(ben_process_user_utility.g_fnd_user_record.user_name,p_user_name)
712            ,p_owner                     => p_owner
713            ,p_unencrypted_password      => nvl(ben_process_user_utility.g_fnd_user_record.password,p_unencrypted_password)
715            ,p_start_date                => nvl(ben_process_user_utility.g_fnd_user_record.start_date,p_start_date)
716            ,p_end_date                  => nvl(ben_process_user_utility.g_fnd_user_record.end_date,p_end_date)
717            ,p_last_logon_date           => nvl(ben_process_user_utility.g_fnd_user_record.last_logon_date,p_last_logon_date)
718            ,p_description               => nvl(ben_process_user_utility.g_fnd_user_record.description,p_description)
719            ,p_password_date             => nvl(ben_process_user_utility.g_fnd_user_record.password_date,p_password_date)
720            ,p_password_accesses_left    => nvl(ben_process_user_utility.g_fnd_user_record.password_accesses_left,p_password_accesses_left)
721            ,p_password_lifespan_accesses=> nvl(ben_process_user_utility.g_fnd_user_record.password_lifespan_accesses,p_password_lifespan_accesses)
722            ,p_password_lifespan_days    => nvl(ben_process_user_utility.g_fnd_user_record.password_lifespan_days,p_password_lifespan_days)
723            ,p_employee_id               => nvl(ben_process_user_utility.g_fnd_user_record.employee_id,l_employee_id)
724            ,p_email_address             => nvl(ben_process_user_utility.g_fnd_user_record.email_address,p_email_address)
725            ,p_fax                       => nvl(ben_process_user_utility.g_fnd_user_record.fax,p_fax)
726            ,p_customer_id               => nvl(ben_process_user_utility.g_fnd_user_record.customer_id,p_customer_id)
727            ,p_supplier_id               => nvl(ben_process_user_utility.g_fnd_user_record.supplier_id,p_supplier_id)
728            ,p_responsibility_id         => nvl(ben_process_user_utility.g_fnd_resp_record.responsibility_id,l_respons_id)
729            ,p_respons_application_id    => nvl(ben_process_user_utility.g_fnd_resp_record.respons_application_id,l_respons_appl_id)
730            ,p_user_id                   => l_user_id
731            ,p_business_group_id         => p_business_group_id
732            );
733 
734 EXCEPTION
735     WHEN hr_api.cannot_find_prog_unit THEN
736       hr_api.cannot_find_prog_unit_error
737         (p_module_name => 'CREATE_USER_DETAILS'
738         ,p_hook_type   => 'AP'
739         );
740     --
741     -- End of API User Hook for the after hook of create_user_acct
742     --
743   end;
744   --
745 
746   if p_validate then
747     ROLLBACK TO create_user_details;
748     p_user_id := null;
749     p_api_error := false;
750     --raise hr_api.validate_enabled;
751   end if;
752   --
753   -- Set all output arguments
754   --
755     p_user_id := l_user_id;
756     p_api_error := false;
757   --
758   hr_utility.set_location(' Leaving:'||l_proc, 80);
759 exception
760   --
761   when hr_api.validate_enabled then
762     --
763     -- As the Validate_Enabled exception has been raised
764     -- we must rollback to the savepoint
765     --
766     ROLLBACK TO create_user_details;
767     p_user_id := null;
768     p_api_error := false;
769   when others then
770     p_user_id := null;
771     p_api_error := true;
772     fnd_msg_pub.add;
773   --
774 
775 end create_user_details;
776 --
777 -- ---------------------------------------------------------------------------
778 -- ------------------------- < update_user_details > -------------------------
779 -- ---------------------------------------------------------------------------
780 -- Purpose: This procedure will perform validations when a user presses Next
781 --          on user page or on the Review page.
782 --          Either case, the data will be saved to the transaction table.
783 --          If this procedure is invoked from Review page, it will first check
784 --          that if a transaction already exists.  If it does, it will update
785 --          the current transaction record.
786 --          NOTE: The p_validate_mode cannot be in boolean because this
787 --                procedure will be called from Java which has a different
788 --                boolean value from pl/sql.
789 -- ---------------------------------------------------------------------------
790 procedure update_user_details
791   (p_item_type                    in varchar2
792   ,p_item_key                     in varchar2
793   ,p_actid                        in number
794   ,p_login_person_id              in number
795   ,p_process_section_name         in varchar2
796   ,p_review_page_region_code      in varchar2
797   ,p_user_name                    in varchar2
798   ,p_owner                        in varchar2
799   ,p_unencrypted_password         in varchar2
800   ,p_session_number               in number
801   ,p_start_date                   in date
802   ,p_end_date                     in date
803   ,p_last_logon_date              in date
804   ,p_description                  in varchar2
805   ,p_password_date                in date
806   ,p_password_accesses_left       in number
807   ,p_password_lifespan_accesses   in number
808   ,p_password_lifespan_days       in number
809   ,p_employee_id                  in number
810   ,p_email_address                in varchar2
811   ,p_fax                          in varchar2
812   ,p_customer_id                  in number
813   ,p_supplier_id                  in number
814   ,p_business_group_id            in number
815   ) is
816  --
817   l_transaction_table             hr_transaction_ss.transaction_table;
818   l_api_error                     boolean;
819   l_transaction_id                number := null;
820   l_transaction_step_id           number := null;
821   l_respons_id                    number := null;
822   l_respons_appl_id               number := null;
826   l_user_id                       number;
823   l_result                        varchar2(100);
824   l_transaction_step              varchar2(100) default null;
825   l_trans_obj_vers_num            number;
827   l_employee_id                   number default null;
828   l_count                         number := 1;
829   prflvalue  varchar2(2000);
830   l_user_pswd             fnd_user.encrypted_user_password%TYPE;
831 
832 begin
833   --
834     --savepoint create_user_details;
835     --
836     prflvalue := fnd_profile.value('BEN_NEW_USER_RESP_PROFILE');
837     if prflvalue is not null
838     then
839        l_respons_id := substr(prflvalue,1,length(prflvalue)-3);
840        l_respons_appl_id := substr(prflvalue,length(prflvalue)-2);
841     end if;
842     /*if p_employee_id is null then
843       if ((hr_process_person_ss.g_session_id is not null) and
844      (hr_process_person_ss.g_session_id = ICX_SEC.G_SESSION_ID))
845       and hr_process_person_ss.g_person_id is not null then
846          l_employee_id := hr_process_person_ss.g_person_id;
847        end if;
848      else*/
849      if p_employee_id is not null then
850         l_employee_id := p_employee_id;
851      end if;
852 
853       -- Getting unencrypted password
854 
855      l_user_pswd := wf_engine.GetItemAttrText
856                     (itemtype   => p_item_type,
857                      itemkey    => p_item_key,
858                      aname      =>'USER_ACCOUNT_INFO');
859 
860      -- Setting wf attribute 'USER_ACCOUNT_INFO' to null
861 
862 /*     wf_engine.SetItemAttrText (itemtype => p_item_type,
863                            itemkey  => p_item_key,
864                            aname    => 'USER_ACCOUNT_INFO',
865                            avalue   => null);
866 
867 */
868     hr_utility.set_location('Entering'||g_package, 5);
869      create_user_details
870            (p_validate                    => true
871            ,p_user_name                   => p_user_name
872            ,p_owner                       => p_owner
873            ,p_unencrypted_password        => l_user_pswd
874            ,p_session_number              => p_session_number
875            ,p_start_date                  => p_start_date
876            ,p_end_date                    => p_end_date
877            ,p_last_logon_date             => p_last_logon_date
878            ,p_description                 => p_description
879            ,p_password_date               => p_password_date
880            ,p_password_accesses_left      => p_password_accesses_left
881            ,p_password_lifespan_accesses  => p_password_lifespan_accesses
882            ,p_password_lifespan_days      => p_password_lifespan_days
883            ,p_employee_id                 => p_employee_id
884            ,p_email_address               => p_email_address
885            ,p_fax                         => p_fax
886            ,p_customer_id                 => p_customer_id
887            ,p_supplier_id                 => p_supplier_id
888            ,p_business_group_id           => p_business_group_id
889            ,p_responsibility_id           => l_respons_id
890            ,p_respons_application_id      => l_respons_appl_id
891            ,p_api_error                   => l_api_error
892            ,p_user_id                     => l_user_id
893            );
894 --
895     --hr_utility.set_location('Entering'||g_package||'we are hereeeeeeeeee1', 5);
896    if l_api_error then
897      raise g_data_error;
898   end if;
899     --hr_utility.set_location('Entering'||g_package||'we are hereeeeeeeeee2', 5);
900 --
901    --rollback to create_user_details;
902 ----------------------------------------------------------------------
903 -- Now save the data to transaction table.  When coming from user page
904 -- first time, a transaction step won't exist.  We'll  have to save to
905 -- transaction table.  Then when the review page is displayed user can press back to
906 -- go back to user page and enters some more changes or correct whatever he
907 -- just entered At this point, a transaction step already exists.
908 -- Before saving to the transaction table, we need to see if a transaction step
909 -- already exists or not.  This could happen when a user enters data to user
910 -- Page --> Next --> Next -->...-->Review Page --> Back to usr page to
911 -- correct wrong entry or to make further changes --> Next -->Next -->...--> Review Page.
912 -- Use the activity_id to check if a transaction step already
913 -- exists.
914 -------------------------------------------------------------------------------
915 --
916     hr_utility.set_location('Entering next line'||g_package, 6);
917   l_transaction_id := hr_transaction_ss.get_transaction_id
918                      (p_item_type   => p_item_type
919                      ,p_item_key    => p_item_key);
920 --
921     hr_utility.set_location('Entering next line line'||g_package, 7);
922   if l_transaction_id is null then
923      hr_transaction_ss.start_transaction
924         (itemtype   => p_item_type
925         ,itemkey    => p_item_key
926         ,actid      => p_actid
927         ,funmode    => 'RUN'
928         ,p_login_person_id => p_login_person_id
929         ,result     => l_result);
930      --
931     hr_utility.set_location('Entering next line line'||g_package, 8);
932      l_transaction_id := hr_transaction_ss.get_transaction_id
933                      (p_item_type   => p_item_type
934                      ,p_item_key    => p_item_key);
935   end if;
936   --
937     --hr_utility.set_location('Entering'||g_package||'we are hereeeeeeeeee3', 5);
938   l_transaction_step_id := get_transaction_step_id
939                           (p_item_type              => p_item_type
940                           ,p_item_key               => p_item_key
941                           ,p_activity_id            => p_actid);
942  --
946      (p_validate              => false
943   if l_transaction_step_id is null then
944     --hr_utility.set_location('Entering'||g_package||'we are hereeeeeeeeee4', 5);
945     hr_transaction_api.create_transaction_step
947      ,p_creator_person_id     => p_login_person_id
948      ,p_transaction_id        => l_transaction_id
949      ,p_api_name              => upper(g_package || 'process_api')
950      ,p_item_type             => p_item_type
951      ,p_item_key              => p_item_key
952      ,p_activity_id           => p_actid
953      ,p_transaction_step_id   => l_transaction_step_id
954      ,p_object_version_number => l_trans_obj_vers_num);
955   end if;
956   --
957   l_transaction_table(l_count).param_name := 'P_ITEM_TYPE';
958   l_transaction_table(l_count).param_value := p_item_type;
959   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
960   --
961   l_count := l_count + 1;
962   l_transaction_table(l_count).param_name := 'P_ITEM_KEY';
963   l_transaction_table(l_count).param_value := p_item_key;
964   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
965   --
966   l_count := l_count + 1;
967   --hr_utility.set_location('Entering'||g_package||'we are hereeeeeeeeee5', 5);
968   l_transaction_table(l_count).param_name := 'P_PROCESS_SECTION_NAME';
969   l_transaction_table(l_count).param_value := p_process_section_name;
970   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
971 --
972   l_count := l_count + 1;
973   l_transaction_table(l_count).param_name := 'P_REVIEW_PROC_CALL';
974   l_transaction_table(l_count).param_value := p_review_page_region_code;
975   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
976 --
977   l_count := l_count + 1;
978   l_transaction_table(l_count).param_name := 'P_REVIEW_ACTID';
979   l_transaction_table(l_count).param_value := p_actid;
980   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
981 --
982   l_count := l_count + 1;
983   l_transaction_table(l_count).param_name := 'P_USER_NAME';
984   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.user_name,p_user_name);
985   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
986 --
987   l_count := l_count + 1;
988   l_transaction_table(l_count).param_name := 'P_OWNER';
989   l_transaction_table(l_count).param_value := p_owner;
990   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
991 --
992   l_count := l_count + 1;
993   l_transaction_table(l_count).param_name := 'P_ENCRYPTED_PASSWORD';
994   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.password,p_unencrypted_password);
995   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
996 --
997   l_count := l_count + 1;
998   l_transaction_table(l_count).param_name := 'P_SESSION_NUMBER';
999   l_transaction_table(l_count).param_value := p_session_number;
1000   l_transaction_table(l_count).param_data_type := 'NUMBER';
1001 --
1002   l_count := l_count + 1;
1003   l_transaction_table(l_count).param_name := 'P_START_DATE';
1004   l_transaction_table(l_count).param_value := nvl(to_char(ben_process_user_utility.g_fnd_user_record.start_date,hr_transaction_ss.g_date_format),to_char(p_start_date,
1005                                               hr_transaction_ss.g_date_format));
1006   l_transaction_table(l_count).param_data_type := 'DATE';
1007 --
1008   l_count := l_count + 1;
1009   l_transaction_table(l_count).param_name := 'P_END_DATE';
1010   l_transaction_table(l_count).param_value := nvl(to_char(ben_process_user_utility.g_fnd_user_record.end_date,hr_transaction_ss.g_date_format),to_char(p_end_date,
1011                                               hr_transaction_ss.g_date_format));
1012   l_transaction_table(l_count).param_data_type := 'DATE';
1013 --
1014   l_count := l_count + 1;
1015   l_transaction_table(l_count).param_name := 'P_LAST_LOGON_DATE';
1016   l_transaction_table(l_count).param_value := nvl(to_char(ben_process_user_utility.g_fnd_user_record.last_logon_date,hr_transaction_ss.g_date_format),to_char(p_last_logon_date,
1017                                               hr_transaction_ss.g_date_format));
1018   l_transaction_table(l_count).param_data_type := 'DATE';
1019 --
1020   l_count := l_count + 1;
1021   l_transaction_table(l_count).param_name := 'P_DESCRIPTION';
1022   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.description,p_description);
1023   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
1024 --
1025   l_count := l_count + 1;
1026   l_transaction_table(l_count).param_name := 'P_PASSWORD_DATE';
1027   l_transaction_table(l_count).param_value := nvl(to_char(ben_process_user_utility.g_fnd_user_record.password_date,hr_transaction_ss.g_date_format),to_char(p_password_date,
1028                                               hr_transaction_ss.g_date_format));
1029   l_transaction_table(l_count).param_data_type := 'DATE';
1030 --
1031   l_count := l_count + 1;
1032   l_transaction_table(l_count).param_name := 'P_PASSWORD_ACCESSES_LEFT';
1033   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.password_accesses_left,p_password_accesses_left);
1034   l_transaction_table(l_count).param_data_type := 'NUMBER';
1035 --
1036   l_count := l_count + 1;
1037   l_transaction_table(l_count).param_name := 'P_PASSWORD_LIFESPAN_ACCESSES';
1038   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.password_lifespan_accesses,p_password_lifespan_accesses);
1039   l_transaction_table(l_count).param_data_type := 'NUMBER';
1040 --
1041   l_count := l_count + 1;
1042   l_transaction_table(l_count).param_name := 'P_PASSWORD_LIFESPAN_DAYS';
1043   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.password_lifespan_days,p_password_lifespan_days);
1044   l_transaction_table(l_count).param_data_type := 'NUMBER';
1045 --
1046   l_count := l_count + 1;
1050 --
1047   l_transaction_table(l_count).param_name := 'P_EMPLOYEE_ID';
1048   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.employee_id,l_employee_id);
1049   l_transaction_table(l_count).param_data_type := 'NUMBER';
1051   l_count := l_count + 1;
1052   l_transaction_table(l_count).param_name := 'P_EMAIL_ADDRESS';
1053   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.email_address,p_email_address);
1054   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
1055 --
1056   l_count := l_count + 1;
1057   l_transaction_table(l_count).param_name := 'P_FAX';
1058   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.fax,p_fax);
1059   l_transaction_table(l_count).param_data_type := 'VARCHAR2';
1060 --
1061   l_count := l_count + 1;
1062   l_transaction_table(l_count).param_name := 'P_CUSTOMER_ID';
1063   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.customer_id,p_customer_id);
1064   l_transaction_table(l_count).param_data_type := 'NUMBER';
1065 --
1066   l_count := l_count + 1;
1067   l_transaction_table(l_count).param_name := 'P_SUPPLIER_ID';
1068   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_user_record.supplier_id,p_supplier_id);
1069   l_transaction_table(l_count).param_data_type := 'NUMBER';
1070 --
1071   l_count := l_count + 1;
1072   l_transaction_table(l_count).param_name := 'P_BUSINESS_GROUP_ID';
1073   l_transaction_table(l_count).param_value := p_business_group_id;
1074   l_transaction_table(l_count).param_data_type := 'NUMBER';
1075 --
1076   l_count := l_count + 1;
1077   l_transaction_table(l_count).param_name := 'P_RESPONSIBILITY_ID';
1078   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_resp_record.responsibility_id,l_respons_id);
1079   l_transaction_table(l_count).param_data_type := 'NUMBER';
1080 --
1081   l_count := l_count + 1;
1082   l_transaction_table(l_count).param_name := 'P_RESPONSIBILITY_APPL_ID';
1083   l_transaction_table(l_count).param_value := nvl(ben_process_user_utility.g_fnd_resp_record.respons_application_id,l_respons_appl_id);
1084   l_transaction_table(l_count).param_data_type := 'NUMBER';
1085 --
1086 --
1087   --hr_utility.set_location('Entering'||g_package||'we are hereeeeeeeeee7', 5);
1088   hr_transaction_ss.save_transaction_step
1089                 (p_item_type           => p_item_type
1090                 ,p_item_key            => p_item_key
1091                 ,p_actid               => p_actid
1092                 ,p_login_person_id     => p_login_person_id
1093                 ,p_transaction_step_id => l_transaction_step_id
1094                 ,p_api_name            => upper(g_package || 'process_api')
1095                 ,p_transaction_data    => l_transaction_table);
1096     --hr_utility.set_location('Entering'||g_package||'we are hereeeeeeeeee8', 5);
1097     --hr_utility.set_location('Entering'||g_package||'we are hereeeeeeeeee9'||l_transaction_step_id, 55);
1098 --
1099    if p_employee_id is null then
1100     --hr_utility.set_location('Entering'||g_package||'we are hereeeeeeeeee10', 5);
1101       wf_engine.SetItemAttrText (itemtype => p_item_type,
1102                            itemkey  => p_item_key,
1103                            aname    => 'USER_TRANSACTION_STEP',
1104                            avalue   => to_char(l_transaction_step_id));
1105    end if;
1106      -- bug 3728862, set the USER_ACCOUNT_INFO attr. here instead of setting from UserReviewCO
1107      wf_engine.SetItemAttrText (itemtype => p_item_type,
1108                            itemkey  => p_item_key,
1109                            aname    => 'USER_ACCOUNT_INFO',
1110                            avalue   => nvl(ben_process_user_utility.g_fnd_user_record.password,l_user_pswd));
1111 exception
1112   when g_data_error then
1113    null;
1114 
1115   when others then
1116      fnd_msg_pub.add;
1117 
1118 end update_user_details;
1119 --
1120 -- ---------------------------------------------------------------------------
1121 -- ----------------------------- < process_api > -----------------------------
1122 -- ---------------------------------------------------------------------------
1123 -- Purpose: This procedure will be invoked in workflow notification
1124 --          when an approver approves all the changes.  This procedure
1125 --          will call the api to update to the database with p_validate
1126 --          equal to false.
1127 -- ---------------------------------------------------------------------------
1128 procedure process_api
1129           (p_validate IN BOOLEAN DEFAULT FALSE
1130           ,p_transaction_step_id IN NUMBER) is
1131   --
1132   l_user_id               number;
1133   l_user_name             fnd_user.user_name%TYPE;
1134   l_user_pswd             fnd_user.encrypted_user_password%TYPE;
1135   l_pswd_hint             fnd_user.description%TYPE;
1136   l_api_error             boolean;
1137   l_respons_id            number ;
1138   l_respons_appl_id       number ;
1139   l_owner                 number ;
1140   l_session_number        number ;
1141   l_start_date            date;
1142   l_end_date              date;
1143   l_last_logon_date       date;
1144   l_password_date         date;
1145   l_password_accesses_left                 number ;
1146   l_password_lifespan_accesses             number ;
1147   l_password_lifespan_days                 number ;
1148   l_employee_id                            number ;
1149   l_customer_id                            number ;
1150   l_supplier_id                            number ;
1151   l_business_group_id                      number ;
1152   l_email_address                          varchar2(240);
1153   l_fax                                    varchar2(80);
1154   prflvalue                                varchar2(2000);
1155   l_item_type                        wf_items.item_type%type default null;
1156   l_item_key                         wf_items.item_key%type default null;
1157   l_transaction_step_id              number default null;
1158   --
1159 begin
1160   --
1161 
1162   l_employee_id := hr_transaction_api.get_number_value
1163                           (p_transaction_step_id => p_transaction_step_id
1164                           ,p_name => 'P_EMPLOYEE_ID');
1165 
1166 
1167    if l_employee_id is null then
1168 
1169        null;
1170 
1171    else
1172 
1173       get_user_data_from_tt(
1174    p_transaction_step_id          => p_transaction_step_id
1175   ,p_user_name                    => l_user_name
1176   ,p_user_pswd                    => l_user_pswd
1177   ,p_pswd_hint                    => l_pswd_hint
1178   ,p_owner                        => l_owner
1179   ,p_session_number               => l_session_number
1180   ,p_start_date                   => l_start_date
1181   ,p_end_date                     => l_end_date
1182   ,p_last_logon_date              => l_last_logon_date
1183   ,p_password_date                => l_password_date
1184   ,p_password_accesses_left       => l_password_accesses_left
1185   ,p_password_lifespan_accesses   => l_password_lifespan_accesses
1186   ,p_password_lifespan_days       => l_password_lifespan_days
1187   ,p_employee_id                  => l_employee_id
1188   ,p_email_address                => l_email_address
1189   ,p_fax                          => l_fax
1190   ,p_customer_id                  => l_customer_id
1191   ,p_supplier_id                  => l_supplier_id
1192   ,p_business_group_id            => l_business_group_id
1193   ,p_respons_id                   => l_respons_id
1194   ,p_respons_appl_id              => l_respons_appl_id
1195    );
1196   --
1197    l_item_type := hr_transaction_api.get_varchar2_value
1198                           (p_transaction_step_id => p_transaction_step_id
1199                           ,p_name => 'P_ITEM_TYPE');
1200 
1201   l_item_key := hr_transaction_api.get_varchar2_value
1202                           (p_transaction_step_id => p_transaction_step_id
1203                           ,p_name => 'P_ITEM_KEY');
1204 
1205   l_user_pswd := wf_engine.GetItemAttrText
1206                     (itemtype   => l_item_type,
1207                      itemkey    => l_item_key,
1208                      aname      =>'USER_ACCOUNT_INFO');
1209 
1210 /*  wf_engine.SetItemAttrText (itemtype => l_item_type,
1211                            itemkey  => l_item_key,
1212                            aname    => 'USER_ACCOUNT_INFO',
1213                            avalue   => null);
1214 */
1215     --hr_utility.set_location('Entering'||g_package, 5);
1216      create_user_details
1217            (p_validate                    => false
1218            ,p_user_name                   => l_user_name
1219            ,p_owner                       => l_owner
1220            ,p_unencrypted_password        => trim(l_user_pswd)
1221            ,p_session_number              => l_session_number
1222            ,p_start_date                  => l_start_date
1223            ,p_end_date                    => l_end_date
1224            ,p_last_logon_date             => l_last_logon_date
1225            ,p_description                 => l_pswd_hint
1226            ,p_password_date               => l_password_date
1227            ,p_password_accesses_left      => l_password_accesses_left
1228            ,p_password_lifespan_accesses  => l_password_lifespan_accesses
1229            ,p_password_lifespan_days      => l_password_lifespan_days
1230            ,p_employee_id                 => l_employee_id
1231            ,p_email_address               => l_email_address
1232            ,p_fax                         => l_fax
1233            ,p_customer_id                 => l_customer_id
1234            ,p_supplier_id                 => l_supplier_id
1235            ,p_business_group_id           => l_business_group_id
1236            ,p_responsibility_id           => l_respons_id
1237            ,p_respons_application_id      => l_respons_appl_id
1238            ,p_api_error                   => l_api_error
1239            ,p_user_id                     => l_user_id
1240            );
1241 
1242   -- bug 3728862, set the USER_ACCOUNT_INFO attr. here instead of setting from UserReviewCO
1243   wf_engine.SetItemAttrText (itemtype => l_item_type,
1244    		     itemkey  => l_item_key,
1245 		     aname    => 'USER_ACCOUNT_INFO',
1246 		     avalue   => nvl(ben_process_user_utility.g_fnd_user_record.password,l_user_pswd));
1247 
1248 --
1249     --hr_utility.set_location('Entering'||g_package||'we are hereeeeeeeeee1', 5);
1250    if l_api_error then
1251      raise g_data_error;
1252   end if;
1253   end if;
1254 --
1255 end process_api;
1256 --
1257 
1258 end ben_process_user_ss_api;
1259 --