api para borrar programas concurrentes

Posted: octubre 27, 2009 in SQL & PLSQL
Etiquetas: , ,

En ocaciones hay que borrar programas concurrentes por lo regular los de pruebas..
este es el api

declare
cursor init_values Is
select
   us.user_id
  ,rg.responsibility_id resp_id
  ,rg.responsibility_application_id resp_appl_id
  ,rg.security_group_id
 from fnd_user  us
    , fnd_user_resp_groups rg
where us.user_id = rg.user_id
  and us.user_name = '&user_name'
  and rownum < 2 ;
----------------------------------
cursor program_val is
select fcp.concurrent_program_name  program_name
     , fa.application_short_name    prog_app_name
     , fe.executable_name           exec_name
     , fa2.application_short_name   exec_app_name
   from fnd_concurrent_programs fcp
      , fnd_application         fa
      , fnd_application         fa2
      , fnd_executables         fe
where fcp.application_id = fa.application_id
  and fcp.executable_id  = fe.executable_id
  and fe.application_id = fa2.application_id
  and fcp.concurrent_program_name ='&program_shortname';
-------------------------------------------------
cursor rg_group_val is
select
  rg.request_group_name          request_group
, fa.application_short_name      req_app_name
, fcp.concurrent_program_name    program_name
, fa2.application_short_name     prog_app_name
from fnd_request_group_units     rgu
   , fnd_request_groups          rg
   , fnd_application             fa
   , , fnd_application           fa2
   , fnd_concurrent_programs     fcp
where fa.application_id   = rg.application_id
and  rgu.request_group_id = rg.request_group_id
and rgu.request_unit_id = fcp.concurrent_program_id
and fcp.application_id  = fa2.application_id
and fcp.concurrent_program_name ='&&program_shortname' ;
-------------------------------------------------
l_init             init_values%rowtype ;
l_program          program_val%rowtype ;
invalid_user       exception ;
BEGIN
  open init_values ;
 fetch init_values into l_init_val ;
 close init_values ;
 --------------------------
  open program_val ;
 fetch program_val into l_program ;
 close program_val ;
 if l_init.user_id is not null then

   if init_values%isopen then
     close init_values ;
   end if;
   if l_program.program_name is null then
      raise invalid_program ;
   End if;
   ----inicializar valores
   FND_GLOBAL.apps_initialize( l_init.user_id, l_init.resp_id, l_init.resp_appl_id, l_init.security_group_id, -1);
   FND_PROGRAM.set_session_mode( 'customer_data') ;
   for r in  rg_group_val
   loop
      dbms_output.put_line(' remover del group '||r.request_group);
      fnd_program.remove_from_group( r.program_name,r.prog_app_name, r.request_group, r.req_app_name );
   end loop ;
   dbms_output.put_line(' borrar programa: '||l_program.program_name);
   fnd_program.delete_program( l_program.program_name, l_program.prog_app_name );
   dbms_output.put_line(' borrar executable: '||l_program.exec_name);
   fnd_program.delete_executable( l_program.exec_name, l_program.exec_app_name );
   commit;
   dbms_output.put_line(' programa borrado exitosamente!!');
 else
    raise invalid_user ;
 end if;
exception
when invalid_program then
   dbms_output.put_line(' invalid program name '||'&&program_shortname');
   if program_val%isopen then
      close program_val ;
   end if;
when invalid_user then
   dbms_output.put_line(' invalid user name '||'&&user_name');
   if init_val%isopen then
      close init_val ;
   end if;
end ;
Comentarios
  1. [...] Articulo Indexado en la Blogosfera de Sysmaya En ocaciones hay que borrar programas concurrentes por lo regular los de pruebas. este es el api declare cursor init_values Is select us.user_id ,rg.responsibility_id resp_id ,rg.responsibility_application_id res En ocaciones hay que borrar programa .. [...]

Deja un comentario

Fill in your details below or click an icon to log in:

Logo de WordPress.com

You are commenting using your WordPress.com account. Log Out / Cambiar )

Twitter picture

You are commenting using your Twitter account. Log Out / Cambiar )

Facebook photo

You are commenting using your Facebook account. Log Out / Cambiar )

Connecting to %s