<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" xmlns:jco="leaf.plugin.sap.jco3" trace="true">
    <a:init-procedure>
        <jco:jco-invoke function="IDOCTYPE_READ_COMPLETE">
            <jco:parameters>
                <jco:parameter name="PI_IDOCTYP" source_field="/parameter/@PI_IDOCTYP"/>
                <jco:parameter name="PI_CIMTYP" source_field="/parameter/@PI_CIMTYP"/>
                <jco:parameter name="PI_RELEASE" source_field="/parameter/@PI_RELEASE"/>
                <jco:parameter name="PI_APPLREL" source_field="/parameter/@PI_APPLREL"/>
                <jco:parameter name="PI_VERSION" source_field="/parameter/@PI_VERSION"/>
            </jco:parameters>
            <jco:structures>
                <jco:structure name="PE_HEADER" fetchAll="false" target="/model/list" type="export">
                    <jco:field-mappings>
                        <jco:field-mapping name="IDOCTYP" return_field="@IDOCTYP"/>
                        <jco:field-mapping name="CIMTYP" return_field="@CIMTYP"/>
                        <jco:field-mapping name="STRUCTTYPE" return_field="@STRUCTTYPE"/>
                        <jco:field-mapping name="DESCRP" return_field="@DESCRP"/>
                        <jco:field-mapping name="PRETYP" return_field="@PRETYP"/>
                        <jco:field-mapping name="RELEASED" return_field="@RELEASED"/>
                        <jco:field-mapping name="PRESP" return_field="@PRESP"/>
                        <jco:field-mapping name="PWORK" return_field="@PWORK"/>
                        <jco:field-mapping name="PLAST" return_field="@PLAST"/>
                        <jco:field-mapping name="APPLREL" return_field="@APPLREL"/>
                    </jco:field-mappings>
                </jco:structure>
            </jco:structures>
            <jco:tables>
                <jco:table name="PT_SEGMENTS" fetchAll="true" target="/model/list/pt_segments">
                    <jco:field-mappings>
                        <jco:field-mapping name="NR" return_field="@NR"/>
                        <jco:field-mapping name="SEGMENTTYP" return_field="@SEGMENTTYP"/>
                        <jco:field-mapping name="SEGMENTDEF" return_field="@SEGMENTDEF"/>
                        <jco:field-mapping name="QUALIFIER" return_field="@QUALIFIER"/>
                        <jco:field-mapping name="SEGLEN" return_field="@SEGLEN"/>
                        <jco:field-mapping name="PARSEG" return_field="@PARSEG"/>
                        <jco:field-mapping name="PARPNO" return_field="@PARPNO"/>
                        <jco:field-mapping name="PARFLG" return_field="@PARFLG"/>
                        <jco:field-mapping name="MUSTFL" return_field="@MUSTFL"/>
                        <jco:field-mapping name="OCCMIN" return_field="@OCCMIN"/>
                        <jco:field-mapping name="OCCMAX" return_field="@OCCMAX"/>
                        <jco:field-mapping name="HLEVEL" return_field="@HLEVEL"/>
                        <jco:field-mapping name="DESCRP" return_field="@DESCRP"/>
                        <jco:field-mapping name="GRP_MUSTFL" return_field="@GRP_MUSTFL"/>
                        <jco:field-mapping name="GRP_OCCMIN" return_field="@GRP_OCCMIN"/>
                        <jco:field-mapping name="GRP_OCCMAX" return_field="@GRP_OCCMAX"/>
                        <jco:field-mapping name="REFSEGTYP" return_field="@REFSEGTYP"/>
                    </jco:field-mappings>
                </jco:table>
                <jco:table name="PT_FIELDS" fetchAll="true" target="/model/list/pt_fields">
                    <jco:field-mappings>
                        <jco:field-mapping name="SEGMENTTYP" return_field="@SEGMENTTYP"/>
                        <jco:field-mapping name="FIELDNAME" return_field="@FIELDNAME"/>
                        <jco:field-mapping name="INTLEN" return_field="@INTLEN"/>
                        <jco:field-mapping name="EXTLEN" return_field="@EXTLEN"/>
                        <jco:field-mapping name="FIELD_POS" return_field="@FIELD_POS"/>
                        <jco:field-mapping name="BYTE_FIRST" return_field="@BYTE_FIRST"/>
                        <jco:field-mapping name="BYTE_LAST" return_field="@BYTE_LAST"/>
                        <jco:field-mapping name="ROLLNAME" return_field="@ROLLNAME"/>
                        <jco:field-mapping name="DOMNAME" return_field="@DOMNAME"/>
                        <jco:field-mapping name="DATATYPE" return_field="@DATATYPE"/>
                        <jco:field-mapping name="DESCRP" return_field="@DESCRP"/>
                        <jco:field-mapping name="ISOCODE" return_field="@ISOCODE"/>
                        <jco:field-mapping name="VALUETAB" return_field="@VALUETAB"/>
                    </jco:field-mappings>
                </jco:table>
                <jco:table name="PT_FVALUES" fetchAll="true" target="/model/list/pt_fvalues">
                    <jco:field-mappings>
                        <jco:field-mapping name="STRNAME" return_field="@STRNAME"/>
                        <jco:field-mapping name="FIELDNAME" return_field="@FIELDNAME"/>
                        <jco:field-mapping name="FLDVALUE_L" return_field="@FLDVALUE_L"/>
                        <jco:field-mapping name="FLDVALUE_H" return_field="@FLDVALUE_H"/>
                        <jco:field-mapping name="DESCRP" return_field="@DESCRP"/>
                    </jco:field-mappings>
                </jco:table>
                <jco:table name="PT_MESSAGES" fetchAll="true" target="/model/list/pt_messages">
                    <jco:field-mappings>
                        <jco:field-mapping name="MESTYP" return_field="@MESTYP"/>
                        <jco:field-mapping name="DESCRP" return_field="@DESCRP"/>
                        <jco:field-mapping name="IDOCTYP" return_field="@IDOCTYP"/>
                        <jco:field-mapping name="CIMTYP" return_field="@CIMTYP"/>
                        <jco:field-mapping name="RELEASED" return_field="@RELEASED"/>
                    </jco:field-mappings>
                </jco:table>
            </jco:tables>
        </jco:jco-invoke>
        <a:batch-apply sourcepath="/model/list/pt_segments">
            <a:model-update model="db.fnd_sap_sync_idoc_pkg.insert_segments"/>
        </a:batch-apply>
        <a:batch-apply sourcepath="/model/list/pt_fields">
            <a:model-update model="db.fnd_sap_sync_idoc_pkg.insert_fields"/>
        </a:batch-apply>
    </a:init-procedure>
    <a:service-output output="/model/list"/>
</a:service>