Tuesday, 1 March 2016

Read Only Responsibility in Oracle Apps through custom.pll



Read Only Responsibility in Oracle Apps through custom.pll


BEGIN
   IF EVENT_NAME = 'WHEN-NEW-FORM-INSTANCE'
   THEN
      --Responsibility ID
      IF FND_PROFILE.VALUE ('RESP_ID') = 12345
      THEN
         BEGIN
            COPY ('Entering app_form.query_only_mode.', 'global.frd_debug');
            --QUERY_ONLY="YES"
            COPY ('YES', 'PARAMETER.QUERY_ONLY');
            --Disabling the save and accept standard menus in form
            APP_MENU2.SET_PROP ('FILE.SAVE', ENABLED, PROPERTY_OFF);
            APP_MENU2.SET_PROP ('FILE.ACCEPT', ENABLED, PROPERTY_OFF);
            -- Get the current form
            FORM_NAME := NAME_IN ('system.current_form');
            --Get the current block
            BLOCK_NAME := GET_FORM_PROPERTY (FORM_NAME, FIRST_BLOCK);

            --loop to get all datablocks in current form
            WHILE (BLOCK_NAME IS NOT NULL)
            LOOP
               IF (GET_BLOCK_PROPERTY (BLOCK_NAME, BASE_TABLE) IS NOT NULL)
               THEN
                  --Set insert, update and delete not allowed
                  SET_BLOCK_PROPERTY (BLOCK_NAME,
                                      INSERT_ALLOWED,
                                      PROPERTY_FALSE);
                  SET_BLOCK_PROPERTY (BLOCK_NAME,
                                      UPDATE_ALLOWED,
                                      PROPERTY_FALSE);
                  SET_BLOCK_PROPERTY (BLOCK_NAME,
                                      DELETE_ALLOWED,
                                      PROPERTY_FALSE);
               END IF;

               BLOCK_NAME := GET_BLOCK_PROPERTY (BLOCK_NAME, NEXTBLOCK);
            END LOOP;
         END QUERY_ONLY_MODE;
      END IF;
   END IF;

END;

No comments:

Post a Comment