zoukankan      html  css  js  c++  java
  • 在R12中实现多OU编程

    A.首先最重要的是要在pre-form中初始化多OU

    BEGIN

        APP_STANDARD.EVENT(‘PRE-FORM’);

    //必须在APP_STANDARD.EVENT()后执行

    MO_GLOBAL.init ('INV');--参数可以使’S’—OU’M’-OU,或者已经注册过的应用简称

    END;

    B.初始化后获取OU的信息,在Pre-form中获取OU信息,或在块上When-Create-Record获取OU信息

    Pre-form

    DECLARE

    l_default_org_id number;

    l_default_ou_name varchar2(240);

    l_ou_count number;

    BEGIN

    ...

    mo_utils.get_default_ou(l_default_org_id, l_default_ou_name, l_ou_count);

    :PARAMETER.mo_default_org_id) := l_default_org_id;

    :PARAMETER.mo_default_ou_name := l_default_ou_name;

    :PARAMETER.mo_ou_count := l_ou_count;

    ...

    END;

    When-Create-Record

    IF :parameter.mo_default_org_id is not null and :block.org_id is null THEN

    :block.org_id := :parameter.mo_default_org_id);

    :block.operating_unit := :parameter.mo_default_ou_name;

    END IF;

    C.在各个触发器实现多OU的支持的代码

    When-Create-Record Trigger of Operating Unit Field Block

    IF (:parameter.mo_default_org_id IS NOT NULL ) THEN

       -- Defaulting org_id from profile option

       :block.org_id := :parameter.mo_default_org_id;

       :block.operating_unit := :parameter.mo_default_ou_name;

       -- Set policy context

       mo_global.set_policy_context('S’,:block.org_id);

    ELSE

      mo_global.set_policy_context('M', null);

    END IF;

    IF :<your block name.org_id> is not null\

     IF :<block name.org_id> <> nvl(:<parameter.old_org_id>,-99) THEN

       -- Get the cache for current org

     END IF;

    ELSE

     -- Refresh the cache

    ...

    END IF;

    When-Validate-Item Trigger of Operating Unit field

    IF (:<your block name.org_id> IS NOT NULL ) THEN

     IF :<block name.org_id> <> nvl(:<parameter.old_org_id>,-99) THEN

        mo_global.set_policy_context('S', :block.org_id);

        -- Get the cache for the current org

     END IF;

    ELSE -- :block.org_id is null

     mo_global.set_policy_context('M', null);

     -- Refresh the cache

    END IF;

    When-New-Record-Instance Trigger of Operating Unit Field Block

    IF (:<your block name.org_id> IS NOT NULL ) THEN

     IF :<block name.org_id> <> nvl(:<parameter.old_org_id>,-99) THEN

       mo_global.set_policy_context('S', :block.org_id);

       -- Get the cache for the current org

     END IF;

    ELSE -- :block.org_id is null, so set the context to multiple

     mo_global.set_policy_context('M', null);

     -- Refresh the cache

    END IF;

    Pre-Insert Trigger of Operating Unit Field Block

    Use this trigger if the form allows the user to commit multiple records.

    IF (:<your block name.org_id> IS NOT NULL ) THEN

     IF :<block name.org_id> <> nvl(:<parameter.old_org_id>,-99) THEN

       mo_global.set_policy_context('S', :block.org_id);

       -- Get the cache for the current org

     END IF;

    ELSE -- :block.org_id is null, so set the context to multiple

     mo_global.set_policy_context('M', null);

     -- Refresh the cache

    END IF;

    Pre-Query Trigger of Operating Unit Field Block

    BEGIN

     IF :parameter.mo_ou_count = 1 THEN

       mo_global.set_policy_context(‘S’,:parameter.mo_default_org_id);

     ELSE

       mo_global.set_policy_context('M', null);

     END IF;

     -- Other Code

    END;

    Pre-Record Trigger of Operating Unit Field Block

    use this trigger if the form forces the user to commit each record.

    IF (:parameter.current_record is not null and

        :parameter.current_record != :system.trigger_record) THEN

      IF (:system.form_status in ('CHANGED','INSERT')) THEN

        mo_global.set_policy_context('S', :parameter.old_org_id);

        -- Get the cache for the current org

        -- raise error message to the user to commit;

        -- raise form_trigger_failure;

      ELSE

        -- No pending commits.

        -- Reset the current record variable.

        :parameter.current_record := '';

      END IF;

    ELSE

      -- User has not navigated to another record.

      -- Do not reset the current record variable.

      null;

    END IF;

    Pre-Update Trigger

    Use this trigger if the form allows the user to commit multiple records commits that are in different operating units.

    IF (:<your block name.org_id> IS NOT NULL ) THEN

      IF :<block name.org_id> <> nvl(:<parameter.old_org_id>,-99) THEN

        mo_global.set_policy_context('S', :block.org_id);

        -- Get the cache for the current org

      END IF;

    END IF;

  • 相关阅读:
    Language Integrated Query
    为什么说 LINQ 要胜过 SQL
    LINQ(Language Integrated Query)
    Rx (Reactive Extensions)介绍
    ReactiveX Operators
    ReactiveX
    给 iOS 开发者的 RxSwift(一)
    The features of Swift
    RxSwift源码与模式分析一:基本类
    智力
  • 原文地址:https://www.cnblogs.com/liuweicong39/p/2530620.html
Copyright © 2011-2022 走看看