修改CUSTOM.PLL文件调用客户化FORM&修改标准FORM

修改custom.pll文件里 的过程event;参考例子如下,修改好后上传至$AU_TOP/resource 运行编译frmcmp_batch CUSTOM apps/apps module_type=LIBRARY compile_all=YES,重新登录即可。注意修改前先做好备份

PROCEDURE event(event_name VARCHAR2) IS
  -- 
  -- This procedure allows you to execute your code at specific events 
  -- including: 
  -- 
  --    ZOOM 
  --    WHEN-NEW-FORM-INSTANCE 
  --    WHEN-NEW-BLOCK-INSTANCE 
  --    WHEN-NEW-RECORD-INSTANCE 
  --    WHEN-NEW-ITEM-INSTANCE 
  --    WHEN-VALIDATE-RECORD 
  -- 
  -- Additionally, product-specific events will be passed via this 
  -- interface (see the Applications Technical Reference manuals for  
  -- a list of events that are available).  
  -- 
  -- By default this routine must perform 'null;'. 
  -- 
  -- Oracle Corporation reserves the right to change the events  
  -- available through this interface at any time. 
  -- 
  /* Sample code:
  
    form_name      varchar2(30) := name_in('system.current_form'); 
    block_name     varchar2(30) := name_in('system.cursor_block');  
    param_to_pass1 varchar2(255); 
    param_to_pass2 varchar2(255); 
  begin 
    -- Zoom event opens a new session of a form and 
    -- passes parameter values to the new session.  The parameters
    -- already exist in the form being opened.
    if (event_name = 'ZOOM') then   
      if (form_name = 'DEMXXEOR' and block_name = 'ORDERS') then 
        param_to_pass1 := name_in('ORDERS.order_id'); 
        param_to_pass2 := name_in('ORDERS.customer_name'); 
        fnd_function.execute(FUNCTION_NAME=>'DEM_DEMXXEOR',  
                             OPEN_FLAG=>'Y',  
                             SESSION_FLAG=>'Y',  
                             OTHER_PARAMS=>'ORDER_ID="'||param_to_pass1|| 
                               '" CUSTOMER_NAME="'||param_to_pass2||'"'); 
    -- all the extra single and double quotes account for 
    -- any spaces that might be in the passed values 
      end if; 
  
    -- This is an example of a product-specific event.  Note that as
    -- of Prod 15, this event doesn't exist.
    elsif (event_name = 'OE_LINES_PRICING') then 
      get_custom_pricing('ORDERS.item_id', 'ORDERS.price'); 
  
    -- This is an example of enforcing a company-specific business
    -- rule, in this case, that all vendor names must be uppercase.
    elsif (event_name = 'WHEN-VALIDATE-RECORD') then
      if (form_name = 'APXVENDR') then
        if (block_name = 'VENDOR') then
          copy(upper(name_in('VENDOR.NAME')), 'VENDOR.NAME');       
        end if;
      end if;
    else 
      null; 
    end if; 
  end event; 
  */
  -- 
  -- Real code starts here 
  -- 
  form_name          VARCHAR2(30) := name_in('system.current_form');
  block_name     varchar2(30) := name_in('system.cursor_block');
  special_menu_name13 VARCHAR2(2000);
  special_menu_name14 VARCHAR2(2000);
  special_menu_name15 VARCHAR2(2000);
  param_to_pass1     NUMBER := NULL;
  param_to_pass2     NUMBER := NULL;
  param_to_pass3     varchar2(200) := NULL;
  param_to_pass4     number := NULL;--invoiec_id
  param_to_pass5     number := NULL;--ccid
  param_to_pass6   date := NULL;--gl_date
  param_to_pass7   number := NULL;--set_of_books_id
  V_PROPERTY VARCHAR2(30);
  
BEGIN
  special_menu_name13 := '返利';
  special_menu_name14 := '订单';
  special_menu_name15 := '更新';
  --FND_MESSAGE.DEBUG('CUSTOM.PLL');
  IF form_name = 'APXINWKB' AND event_name = 'WHEN-NEW-FORM-INSTANCE' THEN
    --SET_MENU_ITEM_PROPERTY('SPECIAL.MENU15',LABEL,'自动创建'); 
    set_menu_item_property('FILE.SAVE', enabled, PROPERTY_ON);-- able save menu
    app_special2.instantiate('SPECIAL13', special_menu_name13, NULL, TRUE); --添加菜单API
    app_special2.instantiate('SPECIAL14', special_menu_name14, NULL, TRUE); --添加菜单API
    app_special2.instantiate('SPECIAL15', special_menu_name15, NULL, TRUE); --添加菜单API
    RETURN;
  END IF;
  
  IF form_name = 'APXINWKB' AND event_name = 'WHEN-NEW-ITEM-INSTANCE' /*AND
     block_name = 'INV_SUM_FOLDER'*/ THEN
     IF name_in('INV_SUM_FOLDER.QUICK_PO_NUMBER') IS NULL THEN
    set_item_property('INV_SUM_CONTROL.MATCH', enabled, property_false);
     ELSE
      set_item_property('INV_SUM_CONTROL.MATCH', enabled, property_true);
     END IF;
    RETURN;
  
  END IF;
  
  IF form_name = 'APXINWKB' AND event_name = 'WHEN-NEW-BLOCK-INSTANCE' THEN
  
    --SET_MENU_ITEM_PROPERTY('SPECIAL.MENU15',LABEL,'自动创建'); 
    app_special.enable('SPECIAL1', property_on);
    app_special.enable('SPECIAL2', property_on);
    app_special.enable('SPECIAL3', property_on);
    RETURN;
  END IF;
  
  IF ((form_name = 'APXINWKB') /*and (Block_Name = 'LINES')*/
     AND (event_name = 'SPECIAL13')) THEN
    param_to_pass1 := name_in('INV_SUM_FOLDER.ORG_ID');
    param_to_pass2 := name_in('INV_SUM_FOLDER.VENDOR_ID');
    param_to_pass4 := name_in('INV_SUM_FOLDER.INVOICE_ID');
    param_to_pass5 := name_in('INV_SUM_FOLDER.ACCTS_PAY_CODE_COMBINATION_ID');
    param_to_pass6 := name_in('INV_SUM_FOLDER.GL_DATE');
    param_to_pass7 := name_in('INV_SUM_FOLDER.SET_OF_BOOKS_ID');
    --FND_MESSAGE.DEBUG('CUSTOM.PLL');
    --FND_MESSAGE.DEBUG('param_to_pass4  '||param_to_pass4);
    --FND_MESSAGE.DEBUG('param_to_pass5  '||param_to_pass5);
    --FND_MESSAGE.DEBUG('param_to_pass6  '||param_to_pass6);
    --FND_MESSAGE.DEBUG('param_to_pass7  '||param_to_pass7);
    V_PROPERTY := Get_Menu_Item_Property('FILE.SAVE',enabled);
    --FND_MESSAGE.DEBUG('V_PROPERTY  '||V_PROPERTY);
    --set_menu_item_property('FILE.SAVE', enabled, PROPERTY_OFF);-- disable save menu
    
    fnd_function.execute(function_name => 'CUXAPREBATE',
                         open_flag     => 'Y',
                         session_flag  => 'Y',
                         other_params  => 'G_ORG_ID="' || param_to_pass1 ||
                                          '" G_VENDOR_ID="' ||
                                          param_to_pass2 || /*'"'||*/
                                          '" G_INVOICE_ID="' ||
                                          param_to_pass4 || 
                                          '" G_CCID="' ||
                                          param_to_pass5 ||
                                          '" G_GL_DATE="' ||
                                          param_to_pass6 || 
                                          '" G_SET_OF_BOOKS_ID="' ||
                                          param_to_pass7 || '"');
                                          


  ELSIF ((form_name = 'APXINWKB') /*and (Block_Name = 'LINES')*/
        AND (event_name = 'SPECIAL14')) THEN
    param_to_pass3 := name_in('INV_SUM_FOLDER.QUICK_PO_NUMBER');
   fnd_function.execute(function_name => 'CUXAPPOINFOR',
                         open_flag     => 'Y',
                         session_flag  => 'Y',
                         other_params  => 'G_PO_NUMBER="' || param_to_pass3 ||
                                          '"' );                         


  ELSIF ((form_name = 'APXINWKB') /*and (Block_Name = 'LINES')*/
        AND (event_name = 'SPECIAL15')) THEN
    fnd_message.debug('Event_Name = SPECIAL15');
  ELSE
    RETURN;
  END IF;

END event;


 

你可能感兴趣的:(form,调用,custom,客户化)