• 在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;

             

                成长

           /      |     \

        学习   总结   分享

    QQ交流群:122230156

  • 相关阅读:
    Activity跳转动画
    如何查询自己的手机版本?欧版、亚太、港行、还是国行?
    VC程序员常用工具汇总
    陈灯可重用代码段管理器VS插件版5.0发布(代码段收集器、个人代码库、代码片段管理、代码管理)
    基于OSLC的系统集成
    安桌点菜源代码
    eclipse jsp 文字设置
    ubuntu 下 netbeans平台 使用C连接mysql
    使用gdi+实时绘制picturebox(画个叉)
    思路上的转变,运用投影和一阶导数的思想
  • 原文地址:https://www.cnblogs.com/benio/p/2043549.html
Copyright © 2020-2023  润新知