DCP

Friday 15 November 2013

A Simple Zoom Example








package body custom is 
  -- 
  -- Customize this package to provide specific responses to events 
  -- within Oracle Applications forms. 
  -- 
  -- Do not change the specification of the CUSTOM package in any way. 
  -- You may, however, add additional packages to this library. 
  -- 
  -------------------------------------------------------------------- 
  function zoom_available return boolean is 
  -- 
  -- Real code starts here 
  --
  form_name  varchar2(30) := name_in('system.current_form'); 
  block_name varchar2(30) := name_in('system.cursor_block');  
    
     
  begin 
    if (form_name = 'APXVDMVD' and block_name = 'VNDR') OR
       (form_name = 'APXINWKB' and block_name = 'INV_SUM_FOLDER')  --OR
       THEN
         return TRUE;
     else
        return FALSE; 
     end if;

  end zoom_available; 

  -------------------------------------------------------------------- 

  function style(event_name varchar2) return integer is 
  -- 
  -- 
  -- Real code starts here 
  -- 
  begin 
    return custom.standard; 
  end style; 




FUNCTION get_zoom_lov_value (i_sql_stmt IN VARCHAR2,
                            i_grp_name IN VARCHAR2)
RETURN VARCHAR2 IS  

i_group_id RECORDGROUP;
i_outcome             NUMBER ;
i_value_chosen        BOOLEAN := FALSE;
l_grp_name            VARCHAR2 (30);

BEGIN
i_group_id := find_group(i_grp_name);

  IF id_null(i_group_id) THEN
     i_group_id := create_group_from_query(i_grp_name,i_sql_stmt);
     set_lov_property('APPCORE_ZOOM',GROUP_NAME,i_grp_name);
  END IF;
            
  i_value_chosen := show_lov('APPCORE_ZOOM');
          
  IF i_value_chosen THEN  
   return(name_in('PARAMETER.appcore_zoom_value'));  
  ELSE
   return(null);
  END IF;
END;


  -------------------------------------------------------------------- 

  procedure event(event_name varchar2) is 
  -- 
  -- Real code starts here 
  -- 
  record_status varchar2(100);
  form_name      varchar2(30) := name_in('system.current_form'); 
  block_name     varchar2(30) := name_in('system.cursor_block');  
    
  begin 

--
-- For APXINWKB enable in r12 
--
IF(event_name = 'ZOOM')THEN

IF (form_name = 'APXINWKB') AND (block_name = 'INV_SUM_FOLDER') THEN

       DECLARE
            l_sql_stmt            VARCHAR2(2000);
            l_grp_name            VARCHAR2(30) := 'AP_ZOOM';
            l_lov_value           VARCHAR2(50);
      BEGIN
       l_sql_stmt  :=
             'select user_function_name name, ' ||
             'function_name value ' ||
             '  from fnd_form_functions_vl ' ||
             ' where function_name in (''PO_POXRQVRQ'',''DSDPOXPOVPO'', ''GLXIQACC'', ''XX_APXXXEER'', ''XX_APXXXEER'')';
           
           l_lov_value := get_zoom_lov_value (l_sql_stmt,l_grp_name);            
           
           fnd_function.execute( FUNCTION_NAME=>l_lov_value,
                      OPEN_FLAG=>'Y',
                      SESSION_FLAG=>'Y',
                      OTHER_PARAMS=>null);
          END;
END IF;
END IF;

  end event; 


BEGIN
  --
  -- You should consider updating the version information listed below as you
  -- make any customizations to this library. This information will be 
  -- displayed in the 'About Oracle Applications' window in the Forms PL/SQL
  -- section. Only change the revision, date and time sections of this string.
  --
  fdrcsid('$Header: CUSTOM.pld 120.0 2005/05/07 16:43:22 appldev ship $');

end custom;

Compiling CUSTOM.pll



Steps to Compile CUSTOM.pll in r12 environment:

1) FTP your changed file to $AU_TOP/resource
2) source environment variable in APPL_TOP
3) change directory to $AU_TOP/resource
4) Backup original CUSTOM.pll and CUSTOM.plx files. Incase your changed CUSTOM.plx file has some errors you may not be able to login to Oracle Apps (Forms session will crash). In such cases you may want to revert to the original CUSTOM.pll and CUSTOM.plx files that were shipped with the installation. So its always a good practice to back up them for instance on linux you can use 'mv' command

mv CUSTOM.pll CUSTOM.pll_orig
mv CUSTOM.plx CUSTOM.plx_orig

5) Issue the compile command i.e.
frmcmp_batch module=CUSTOM.pll userid=apps/apps output_file=CUSTOM.plx module_type=LIBRARY batch=yes compile_all=special

6) Log out and log in Oracle Appliations to see the changes