Friday, 4 July 2014

Make all responsibilities read-only for a user

Objective: Make all responsibilities read-only for a user

Step 1: Download the CUSTOM.pll from the server to your local machine.
            /u04/maxprod/apps/apps_st/appl/au/12.0.0/resource


Step 2:  Open CUSTOM.pll in Form Builder. You will notice that the only attached library is FNDSQF.
Step 3:  You need to attach the APPCORE2 library so that the code in the CUSTOM.pll works. To do that, first click on Attached Libraries and then click on the green plus icon on the left to open the Attach Library window. Browse for APPCORE2.pll on your local machine and attach it to CUSTOM.pll.
Once that is done, APPCORE2.dll will be displayed in the list of attached libraries.


Step 4: In procedure event of the CUSTOM.pll body, comment out the following three lines

Step 5: and add the following code

formname varchar2(30);
blockname varchar2(30);

begin
IF event_name = 'WHEN-NEW-FORM-INSTANCE' THEN
IF FND_PROFILE.VALUE('USERNAME')='LOKANADHAM' THEN
BEGIN
COPY('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) LOOP
IF (GET_BLOCK_PROPERTY(blockname, BASE_TABLE) is not NULL) THEN
SET_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;
END IF;
END IF;

end event;


Step 6: Save the CUSTOM.pll and transfer it back to the server.

Step 7:  Login to putty, go to /u04/maxprod/apps/apps_st/appl/au/12.0.0/resource.
             Compile it using the following command to genrate plx file from pll.

frmcmp_batch module=CUSTOM.pll userid=apps/appsmaxmani output_file=CUSTOM.plx compile_all=special module_type=LIBRARY batch=yes




Step 8:  Login Application with user name(LOKANADHAM)


Step 9: Forms for all responsibilities will now become read-only for the LOKANADHAM user

Step 10: For Other Users Forms for all responsibilities will  behave normally.