忙裏偷閑

很多事情很多心情寫了也就記下了; 不寫,以後可能就忘了.
個人資料
正文

Blocking menus items, buttons and certain functionalities for sp

(2010-04-20 13:33:27) 下一個

Overview:

In many cases, we need to disable certain menus, buttons and functionalities in Oracle forms in order to avoid certain standard actions.
One good example, if we have Project module, all project related invoices should be created in project module and interface to finance module for billing. These invoices should not be modified in finance module. Credit memos referencing to these invoices should be done in project module too and can’t be created in finance module. Furthermore, all related actions like menus:  Adjust,  Copy to, Credit, Installments, credit installments, buttons like Incomplete in AR transaction form and buttons like Adjust, Credit, Copy to in Transaction Summary form should be greyed out too.
To realize all these, we should go for form personalization and custom PLLs.
For actions like blocking modifications (insert, update) on fields of forms, and disabling buttons on forms, form personalization is enough to take care; form disable certain menus, custom pll needs to be created.

Examples:
Requirements:
For all invoices that have SOURCE = PROJECTS INVOICES then:
1) From menu Actions remove Adjust, Applications, Copy to, Credit and Credit instalments
2) From Transaction summary screen disable the following buttons :  ADJUST, CREDIT, COPY TO and INCOMPLETE
3) From Transaction screen disable INCOMPLETE button
4) From Credit Transactions screen disable all modification possibilities (put in read only mode)

Form personalization should be done on form: ARXTWMAI

Menu: Help -> Diagnostics -> Custom Code -> Personalize
1) Disable modification abilities:
Description: Disable Copy Transactions form if source = PROJECTS INVOICES
Level: Form
Condition:
 Trigger Event: WHEN-NEW-BLOCK-INSTANCE
 Trigger Object: TCPY_TRX
 Condition: TCPY_TRX.BS_BATCH_SOURCE_NAME= 'PROJECTS INVOICES'
 Processing mode:  both
Actions:
 Seq: 10
 Type: Property
 Object Type: Block
 Target Object: TCPY_TRX
 Property Name: INSERT_ALLOWED
 Value: FALSE

 Seq: 11
 Type: Property
 Object Type: Block
 Target Object: TCPY_TRX
 Property Name: UPDATE_ALLOWED
 Value: FALSE

 Seq: 12
 Type: Property
 Object Type: Block
 Target Object: TCPY_SCHEDULE
 Property Name: INSERT_ALLOWED
 Value: FALSE

 Seq: 13
 Type: Property
 Object Type: Block
 Target Object: TCPY_SCHEDULE
 Property Name: UPDATE_ALLOWED
 Value: FALSE

2) Disable buttons:
Description: Disable buttons in Transactions Summary form if source = 'PROJECTS INVOICES'
Level: Form
Condition:
 Trigger Event: WHEN-NEW-RECORD-INSTANCE
 Trigger Object: TGW_HEADER
 Condition: :TGW_HEADER.BS_BATCH_SOURCE_NAME= 'PROJECTS INVOICES'
 Processing mode:  Not in Entry-Query Mode
Actions:
 Seq: 10
 Type: Property
 Description: disable credit button
 Object Type: Item
 Target Object: TGW_HEADER.SUMMARY_CREDIT
 Property Name: ENABLED
 Value: FALSE

 Seq: 11
 Type: Property
 Description: disable Adjust button
 Object Type: Item
 Target Object: TGW_HEADER.SUMMARY_ADJUST
 Property Name: ENABLED
 Value: FALSE

 Seq: 12
 Type: Property
 Description: disable copy to button
 Object Type: Item
 Target Object: TGW_HEADER.SUMMARY_COPY
 Property Name: ENABLED
 Value: FALSE

 Seq: 13
 Type: Property
 Description: disable Installments button
 Object Type: Item
 Target Object: TGW_HEADER.SUMMARY_HISTORY
 Property Name: ENABLED
 Value: FALSE

Description: Disable Incomplate button if source = 'PROJECTS INVOICES'
Level: Form
Condition:
 Trigger Event: WHEN-NEW-BLOCK-INSTANCE
 Trigger Object: TGW_HEADER
Condition: TGW_HEADER.BS_BATCH_SOURCE_NAME= 'PROJECTS INVOICES' and ${item.tgw_header.header_uncomplete.displayed}='TRUE' and ${item.tgw_header.header_uncomplete.enabled} ='TRUE'
(Incomplete button has to be displayed before disable it. Otherwise error would be generated.)
 Processing mode:  Not in Entry-Query Mode
Actions:
 Seq: 10
 Type: Property
 Description: disable imcomplete button in transaction form.
 Object Type: Item
 Target Object: TGW_HEADER.HEADER_UNCOMPLETE
 Property Name: ENABLED
 Value: FALSE

 Seq: 20
 Type: Property
 Description: disable imcomplete button in Transaction Summary form.
 Object Type: Item
 Target Object: TGW_HEADER.SUMMARY_UNCOMPLETE
 Property Name: ENABLED
 Value: FALSE

3) Disable Menus:

a. xx_ARXTWMAI_custom.pll is created in Oracle Form Builder,
PACKAGE BODY xx_ARXTWMAI_custom IS
procedure DISABLE_ACTION_MENU_ITEM(p_event varchar2) is
form_name VARCHAR2(30) := NAME_IN('system.current_form');
block_name VARCHAR2(30) := NAME_IN('system.current_block');
param_to_pass1 VARCHAR2(255);
param_to_pass2 VARCHAR2(255);

begin
  IF p_event = 'WHEN-NEW-RECORD-INSTANCE' and block_name = 'TGW_HEADER' then
    IF  name_in('TGW_HEADER.BS_BATCH_SOURCE_NAME') = 'PROJECTS INVOICES' THEN
     app_special2.disable('SPECIAL34'); --Adjust
     app_special2.disable('SPECIAL37'); --Credit
     app_special2.disable('SPECIAL36'); --Copy to
     app_special2.disable('SPECIAL35'); --Applications
     app_special2.disable('SPECIAL38'); --Installments
    ELSE
      app_special2.enable('SPECIAL34'); --Adjust
      app_special2.enable('SPECIAL37'); --Credit
      app_special2.enable('SPECIAL36'); --Copy to
      app_special2.enable('SPECIAL35'); --Applications
      app_special2.enable('SPECIAL38'); --Installments
    END IF;
  END IF;
end DISABLE_ACTION_MENU_ITEM;
procedure event(event_name varchar2) is
   --vl_user_name varchar2(60) := fnd_profile.value('USERNAME');
   vl_block_name varchar2(30) := name_in('system.current_block');
   vl_item_name  varchar2(60) := name_in('system.current_item');
begin 
        DISABLE_ACTION_MENU_ITEM(event_name);     
exception
     when FORM_TRIGGER_FAILURE then
        raise FORM_TRIGGER_FAILURE;
     when OTHERS then
        message('Error in WHEN OTHERS in event ' ||SQLERRM);
        raise;
end event;
END xx_ARXTWMAI_custom;

b. CUSTOM.pll is modified to add the calling process.
procedure event(event_name varchar2) is
form_name      varchar2(30) := name_in('system.current_form');
  block_name     varchar2(30) := name_in('system.cursor_block');  
begin
    IF form_name = 'APXINWKB' THEN
       XX_APXINWKB_CUSTOM.event(event_name);
    ELSIF form_name = 'APXIISIM' THEN
      XX_APXIISIM_CUSTOM.event(event_name);
    ELSIF form_name = 'ARXTWMAI' THEN
       XX_ARXTWMAI_CUSTOM.event(event_name);
    ELSE
     null;
   END IF;
  end event;

c. XX_ARXT ARXTWMAI_CUSTOM.pll is attached to CUSTOM.pll.

d. Both PLLs are compiled on server.
$ORACLE_HOME/bin/frmcmp_batch.sh userid=apps/apps@OBA module=$AU_TOP/resource/XX_ARXTWMAI_CUSTOM.pll output_file=$AU_TOP/resource/XX_ARXTWMAI_CUSTOM.plx module_type=library batch=no compile_all=yes
$ORACLE_HOME/bin/frmcmp_batch.sh userid=apps/apps@OBA module=$AU_TOP/resource/CUSTOM.pll output_file=$AU_TOP/resource/CUSTOM.plx module_type=library batch=no compile_all=yes

[ 打印 ]
閱讀 ()評論 (0)
評論
目前還沒有任何評論
登錄後才可評論.