Custom Search

Wednesday 12 December 2012

Creating a read only Responsibility

Here I am going to show you 2 ways to create a read only resposibility:

1. Form Function Method
2. custom.pll

Form Function Method:
1. Identify the menu attached to the responsibility that you wish to make it a Read only Responsibility
2. Identify the form functions that are attached to this menu.
3. Define a new form function exactly similar to the existing one but with the option QUERY_ONLY="YES" at the location "Application"-->"function"-->"Form"-->"Parameter".
4. The Parameter sets the function in Query Only mode.
5. Final step is to create a custom menu with the new read only functions created and attach the menu to the  new responsibility.

CUSTOM.pll (Reference metalink note: 363298.1)
1.Open the CUSTOM.pll in the form builder
2.Add the following sample code in the procedure event for the event ‘WHEN-NEW-FORM-INSTANCE’

BEGIN

IF event_name = 'WHEN-NEW-FORM-INSTANCE' THEN
   IF FND_PROFILE.VALUE('USER_NAME')='<USER_NAME>' THEN

      BEGIN -- Begin Query Only Mode

      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_PROPERY(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 Query Only Mode

   END IF;
END IF;

END;

3. Compile the Custom.pll and place it under the directory $AU_TOP/resource



Print This Post

No comments:

Post a Comment