找到了,这个方案很好。
http://oraclemaniac.com/2011/08/21/read-only-oracle-apps-user/
Read Only Oracle Apps forms for a user/responsibility
Posted by Abhijit Ray ⋅ August 21, 2011⋅ 2 Comments
Filed Under custom.pll, Read only, Responsibility, user
One of the challenges in all AMS projects is to view transactions and master data along with setups which have been done. Whenever an issue occurs production support personnel usually run some query in a read only schema in production instance to troubleshoot. In some cases this is inadequate and the support personnel have to ask the end user for screenshots. This can be avoided by adding a customization in CUSTOM.pll. Within the code an Oracle user needs to be specified. Once the support personnel logins with this user he/she will have access to all the responsibilities specified for the user but all forms will become read only. Also, the user will be unable to submit a concurrent program.The following has to be added to CUSTOM package body CUSTOM.pll.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
procedure event(event_name varchar2) is--.....--......--...... formname VARCHAR2(100);blockname VARCHAR2(100); BEGIN-- Read onlyIF event_name = 'WHEN-NEW-FORM-INSTANCE'THENIF fnd_profile.VALUE ('USERNAME') = 'USER2'THENBEGINCOPY ('Entering app_form.query_only_mode.', 'global.frd_debug');COPY ('YES', 'PARAMETER.QUERY_ONLY'); app_menu2.set_prop ('FILE.SAVE', enabled, property_off);app_menu2.set_prop ('FILE.ACCEPT', enabled, property_off); formname := NAME_IN ('system.current_form');blockname := GET_FORM_PROPERTY (formname, First_Block); WHILE (blockname IS NOT NULL)LOOPIF (GET_BLOCK_PROPERTY (blockname, base_table) IS NOT NULL)THENSET_BLOCK_PROPERTY (blockname,insert_allowed,property_false); SET_BLOCK_PROPERTY (blockname,update_allowed,property_false); SET_BLOCK_PROPERTY (blockname,delete_allowed,property_false);END IF; blockname := GET_BLOCK_PROPERTY (blockname, nextblock); END LOOP; END query_only_mode; END IF; END IF; --...... other events ...........--............................... END event;.
The check, IF fnd_profile.VALUE (‘USERNAME’) = ‘USER2′, checks for user name USER2. The check can be done on responsibility level as well. Eg. IF UPPER(fnd_profile.VALUE (‘RESP_NAME’)) like ‘%READ%ONLY%’. In this case any responsibility which has the name Read Only within it, will become read only.