<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-5-7 下午3:58:17  
    $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 t1.*
  FROM (SELECT li.line_id,
               li.error_message,
               li.status,
               li.header_id,
               li.line_number,
               hd.created_by,
               li.source_table,
               li.attribute_1,
               li.attribute_2,
               li.attribute_3,
               li.attribute_4,
                li.attribute_5,
               li.attribute_6,
               li.attribute_7,
               li.attribute_8,
               li.attribute_9,
               li.attribute_10,
               li.attribute_11,
               li.attribute_12,
               li.attribute_13,
               li.attribute_14,
               li.attribute_15,
               li.attribute_16,
               li.attribute_17,
               li.attribute_18,
               li.attribute_19,
               li.attribute_20,
               li.attribute_21,
               li.attribute_22,
               li.attribute_23,
               li.attribute_24,
               li.attribute_25,
               li.attribute_26
          FROM fnd_interface_headers hd,
               fnd_interface_lines   li
         WHERE hd.header_id = li.header_id
           AND hd.template_code = 'DS_SMS_LIST'
           AND li.line_number >0
        AND HD.CREATED_BY = ${/session/@user_id}
        ) t1
 #WHERE_CLAUSE#
   order by t1.line_number

]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            begin
            DS_IMPORT_CORE_PKG.sms_execute_import_check(p_header_id => ${/model/header/record/@header_id},
                                                p_batch_id => ${@batch_id},
                                                p_user_id => ${/session/@user_id});
                                                end;
]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
        begin
          DS_IMPORT_CORE_PKG.sms_execute_import(
                                    p_header_id   =>${/parameter/@header_id},
                                    p_batch_id =>${/parameter/@batch_id},
                                    p_user_id     =>${/session/@user_id});
        end;
        ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="header_id" queryExpression="t1.header_id=${@header_id}"/>
    </bm:query-fields>
</bm:model>
