<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: waiwaids  
    $Date: 2011-8-22 上午1:12:38  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                  select eou.unit_id,
		             eou.company_id,
		             eou.unit_code,
		             eou.description,
		             ywu.parent_unit_id,
		             ywu.parent_unit_code,
		             ywu.parent_desc
		          from exp_org_unit_vl eou,
		             (select ywn.unit_id,
		                 ywn.parent_unit_id,
		                 parent_eou.unit_code parent_unit_code,
		                 parent_eou.description parent_desc
		              from fnd_inter_company_unit ywn, exp_org_unit_vl parent_eou
		             where ywn.parent_unit_id = parent_eou.unit_id) ywu
					       #WHERE_CLAUSE#  order by eou.unit_code
                 ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="unit_code" queryExpression="eou.unit_code like ${@unit_code}"/>
        <bm:query-field name="description" queryExpression="eou.description like ${@description}"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="eou.unit_id = ywu.unit_id(+) and eou.company_id = ${/session/@company_id}"/>
    </bm:data-filters>
</bm:model>
