<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.huazheng.project.hana.mapper.SapMapper">
	
    <select id="selectVbapNew" parameterType="Vbap" resultType="Vbap">
		select top 20 "$rowid$" as rowids,
			p.vbeln, p.posnr, p.matnr, p.mandt, p.matkl, p.spart, p.kwmeng, p.netwr, p.mwsbp, p.waerk, p.vrkme, p.abgru, 
			p.uebto, p.untto, p.werks, p.vstel, p.mvgr1, p.plavo, p.mvgr4, p.mvgr5, p.ulxh, p.zma_ftb_02, p.zma_ftb_03, 
			p.zma_ftb_45, p.zma_ftb_06, p.zma_ftb_07, p.zma_ftb_08, p.zma_jyb_02, p.zma_jyb_03, p.zma_jyb_45, 
			p.zma_jyb_06, p.zma_jyb_07, p.zma_ljb_03, p.zma_ljb_04, p.zma_ljb_06, p.zma_ljb_07, p.zma_ljb_08, 
			p.zma_ljb_11, p.zma_ljb_12, p.zma_ljb_13, p.zma_yhbg_02, p.zma_yhbg_04, p.zma_yhbg_05, p.zma_yhbg_06, 
			p.tbpz, p.ws, p.cu_maktx, p.cu_pcdst, p.ztype, p.barcode, p.gdno, p.lh, p.dgxx, p.zklx, p.erdat, p.erzet, p.netpr, p.aedat,q.pernr
		from ${hana_user}.vbap p 
		left join (
			select a.vbeln,a.posnr,a.pernr from ${hana_user}.vbpa a
				left join ${hana_user}.vbak b on a.vbeln = b.vbeln
			where a.mandt = '800' and a.pernr != '00000000' and a.parvw = 'VE'
			group by a.vbeln,a.posnr,a.pernr
		) q on p.vbeln = q.vbeln and p.posnr = q.posnr
		where p."$rowid$" &gt; #{rowids} and p.mandt = '800'
    	order by p."$rowid$"
    </select>
	<select id="selectBsidNew" parameterType="Bsid" resultType="Bsid">
    	select top 20 a."$rowid$" as rowids,
    		a.vbeln,a.mandt,a.bukrs,a.kunnr,a.umsks,a.umskz,a.augdt as augdts,a.augbl,a.zuonr,a.gjahr,a.belnr,a.buzei,a.buzei as buzeis,
    		a.blart,a.waers,a.wrbtr,a.shkzg,a.budat as budats,a.zfbdt as zfbdts,a.zterm
    	from ${hana_user}.bsid a
		where a."$rowid$" &gt; #{rowids} and a.mandt = '800'
		order by a."$rowid$"
    </select>
    <select id="selectBsadNew" parameterType="Bsad" resultType="Bsad">
		select top 20 a."$rowid$" as rowids,
    		a.vbeln,a.mandt,a.bukrs,a.kunnr,a.umsks,a.umskz,a.augdt as augdts,a.augbl,a.zuonr,a.gjahr,a.belnr,a.buzei,a.buzei as buzeis,
    		a.blart,a.waers,a.wrbtr,a.shkzg,a.budat as budats,a.zfbdt as zfbdts,a.zterm
    	from ${hana_user}.bsad a
		where a."$rowid$" &gt; #{rowids} and a.mandt = '800'
		order by a."$rowid$"
    </select>
    <select id="selectPa0002New" parameterType="Pa0002" resultType="Pa0002">
    	select top 20 "$rowid$" as rowids,
    		mandt,pernr,subty,objps,sprps,endda,begda,seqnr,nachn,vorna,aedtm
    	from ${hana_user}.Pa0002
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectVbpaNew" parameterType="Vbpa" resultType="Vbpa">
    	select top 20 "$rowid$" as rowids,
    		mandt, vbeln, posnr, parvw, pernr
    	from ${hana_user}.Vbpa 
    	where "$rowid$" &gt; #{rowids} and parvw = 'VE' ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectTvkbtNew" parameterType="Tvkbt" resultType="Tvkbt">
    	select top 20 "$rowid$" as rowids,
			mandt,spras,vkbur,bezei
    	from ${hana_user}.Tvkbt 
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectAufmNew" parameterType="Aufm" resultType="Aufm">
    	select top 20 "$rowid$" as rowids,
    		mblnr, mjahr, zeile, bldat, budat, bwart, matnr, werks, lgort, 
			charg, sobkz, lifnr, kdauf, kdpos, shkzg, menge, bwtar, aufnr, mandt
    	from ${hana_user}.aufm 
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectVbrkNew" parameterType="Vbrk" resultType="Vbrk">
    	select top 20 "$rowid$" as rowids,
    		vbeln,fkart,waerk,erdat,erzet,zterm,kunrg,bstnk_vf,
			zbillty,zbz01,zbz02,zdc_flg,bukrs,ktgrd,fkdat,inco1,
			inco2,netwr,mwsbk,aedat,mandt
    	from ${hana_user}.Vbrk
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectVbrpNew" parameterType="Vbrp" resultType="Vbrp">
    	select top 20 "$rowid$" as rowids,
    		vbeln,posnr,fkimg,meins,vgbel,vgpos,aubel,aupos,matnr,
			arktx,matkl,spart,zarktx_js,zfkimg_js,zvrkme_js, mandt,netwr,mwsbp
    	from ${hana_user}.Vbrp
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectS066New" parameterType="S066" resultType="S066">
    	select top 20 "$rowid$" as rowids,
    	    mandt, ssour, vrsio, kkber, knkli, spmon, sptag as sptags, spwoc, spbup, oeikw,
    		spwoc as spwocs, spbup as spbups, spmon as spmons
    	from ${hana_user}.S066
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectS067New" parameterType="S067" resultType="S067">
    	select top 20 "$rowid$" as rowids,
    	    mandt, ssour, vrsio, kkber, knkli, spmon, sptag as sptags, spwoc, spbup, olikw, ofakw,
    		spwoc as spwocs, spbup as spbups, spmon as spmons
    	from ${hana_user}.S067
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
	<select id="selectVbukNew" parameterType="Vbuk" resultType="Vbuk">
    	select top 20 "$rowid$" as rowids,
    	    vbeln, wbstk, kostk, mandt
    	from ${hana_user}.vbuk
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectLikpNew" parameterType="Likp" resultType="Likp">
    	select top 20 "$rowid$" as rowids,
			vbeln, mandt, erdat, wadat_ist, ctlpc, kunnr, aedat,lfuhr
    	from ${hana_user}.likp
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectKonvNew" parameterType="Konv" resultType="Konv">
    	select top 20 "$rowid$" as rowids,
			mandt,knumv,kposn,stunr,zaehk,kntyp,kbetr
    	from ${hana_user}.konv
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectLipsNew" parameterType="Lips" resultType="Lips">
    	select top 20 "$rowid$" as rowids,
       		vbeln, posnr, vgbel, vgpos, mandt, matnr, matkl, arktx, werks, lgort, 
    		charg, lfimg, uebto, untto, erdat, erzet, aedat
    	from ${hana_user}.lips
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectAfkoNew" parameterType="Afko" resultType="Afko">
    	select top 20 "$rowid$" as rowids,
       		aufnr, mandt, gltrp, gamng, plnbez, gmein, plnnr, plnal, 
    		stlnr, cy_seqnr, gstrp, aufpl, aplzt
    	from ${hana_user}.afko
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectAfpoNew" parameterType="Afpo" resultType="Afpo">
    	select top 20 "$rowid$" as rowids,
       		kdauf, kdpos, aufnr, mandt, posnr, psmng, wemng, meins, matnr, 
    		uebto, untto, pwerk, verid, dwerk, dauat, krsnr, sernr, plnum
    	from ${hana_user}.Afpo
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectVbepNew" parameterType="Vbep" resultType="Vbep">
    	select top 20 "$rowid$" as rowids,
       		vbeln, posnr, edatu, ettyp, wmeng, bmeng, mandt, etenr, aufnr
    	from ${hana_user}.vbep
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectT023tNew" parameterType="T023t" resultType="T023t">
    	select top 20 "$rowid$" as rowids,
       		mandt,spras,matkl,wgbez,wgbez60
    	from ${hana_user}.T023t
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectKna1New" parameterType="Kna1" resultType="Kna1">
    	select top 20 "$rowid$" as rowids,
       		kunnr, name1, name2, mandt, ktokd, updat
    	from ${hana_user}.Kna1
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectKnvvNew" parameterType="Knvv" resultType="Knvv">
    	select top 20 "$rowid$" as rowids,
       		mandt, kunnr, vkorg, vtweg, spart, waers, klabc
    	from ${hana_user}.Knvv
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectAfvcNew" parameterType="Afvc" resultType="Afvc">
    	select top 20 "$rowid$" as rowids,
       		mandt, aufpl, aplzl, steus
    	from ${hana_user}.Afvc
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectBkpfNew" parameterType="Bkpf" resultType="Bkpf">
    	select top 20 "$rowid$" as rowids,
       		mandt, bukrs, belnr, gjahr, blart, bldat, budat, monat, cpudt, cputm, 
			aedat, upddt
    	from ${hana_user}.Bkpf
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectKnvpNew" parameterType="Knvp" resultType="Knvp">
    	select top 20 "$rowid$" as rowids,
       		mandt, kunnr, vkorg, vtweg, spart, parvw, parza, kunn2, pernr, knref, pernr as pernr1
    	from ${hana_user}.Knvp
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectAuspNew" parameterType="Ausp" resultType="Ausp">
    	select top 20 "$rowid$" as rowids,
       		mandt, objek, atinn, atzhl, mafid, klart, adzhl, atwrt
    	from ${hana_user}.Ausp
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectAfruNew" parameterType="Afru" resultType="Afru">
    	select top 20 "$rowid$" as rowids,
       		mandt, rueck, rmzhl, ersda, wablnr, aufnr, stokz, stzhl
    	from ${hana_user}.Afru
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectTspatNew" parameterType="Tspat" resultType="Tspat">
    	select top 20 "$rowid$" as rowids,
       		mandt, spras, spart, vtext
    	from ${hana_user}.Tspat
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectZpoeditNew" parameterType="Zpoedit" resultType="Zpoedit">
    	select top 20 "$rowid$" as rowids,
       		mandt, pwerk, aufnr, reason
    	from ${hana_user}.Zpo_edit
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectMkpfNew" parameterType="Mkpf" resultType="Mkpf">
    	select top 20 "$rowid$" as rowids,
       		mandt, mblnr, mjahr, bldat, cputm
    	from ${hana_user}.Mkpf
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectMsegNew" parameterType="Mseg" resultType="Mseg">
    	select top 20 "$rowid$" as rowids,
       		mandt, mblnr, mjahr, zeile, bwart, charg, menge, budat_mkpf, cputm_mkpf, aufnr,kdauf, kdpos, matnr
    	from ${hana_user}.Mseg
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectKnkkNew" parameterType="Knkk" resultType="Knkk">
    	select top 20 "$rowid$" as rowids,
       		mandt,kunnr,kkber,klimk,skfor,ssobl,aedat
    	from ${hana_user}.Knkk
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectMaraNew" parameterType="Mara" resultType="Mara">
    	select top 20 "$rowid$" as rowids,
       		matnr, mandt, ersda, ernam, laeda, aenam, vpsta, pstat, mtart, mbrsh, matkl, 
    		bismt, meins, bstme, wrkst, brgew, ntgew, gewei, spart, kzkfg, extwg, cuobf 
    	from ${hana_user}.Mara
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectMaktNew" parameterType="Makt" resultType="Makt">
    	select top 20 "$rowid$" as rowids,
       		matnr, mandt, spras, maktx
    	from ${hana_user}.Makt
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectZsd06New" parameterType="Zsd06" resultType="Zsd06">
    	select top 20 "$rowid$" as rowids,
       		vbeln, posnr, mandt, datum, uname, crt_uname, crt_datum, 
    		crt_time, cha_name, cha_datum, cha_time
    	from ${hana_user}.Zsd_06
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectZmdpcNew" parameterType="Zmdpc" resultType="Zmdpc">
    	select top 20 "$rowid$" as rowids,
       		vbeln,posnr,f_plant,plant,x_plant,mandt
    	from ${hana_user}.Zmdpc
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectVbakNew" parameterType="Vbak" resultType="Vbak">
		select top 20 "$rowid$" as rowids,
			a.vbeln, a.mandt, a.vbtyp, a.audat, a.waerk, a.kalsm, a.ctlpc, a.kunnr, a.bukrs_vf, a.bstnk, 
			a.bname, a.telf1, a.netwr, a.vkbur, a.knumv, a.vkorg, a.vtweg, a.kkber, a.auart, a.aedat, 
			a.erdat, a.erzet, a.spart
		from ${hana_user}.vbak a 
		where "$rowid$" &gt; #{rowids} and a.mandt = '800'
		order by "$rowid$"
    </select>
    <select id="selectAufkNew" parameterType="Aufk" resultType="Aufk">
    	select top 20 "$rowid$" as rowids,
       		kdauf,kdpos,mandt,aufnr,erdat,erfzeit,ernam,aenam,bukrs,loekz,auart,werks,
    		aedat
    	from ${hana_user}.aufk
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectT001wNew" parameterType="T001w" resultType="T001w">
    	select top 20 "$rowid$" as rowids,
       		mandt, werks, name1, bwkey
    	from ${hana_user}.T001w
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectMskaNew" parameterType="Mska" resultType="Mska">
    	select top 20 "$rowid$" as rowids,
       		vbeln, posnr, mandt, matnr, werks, lgort, charg, sobkz, kaspe, kalab
    	from ${hana_user}.Mska
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectZsdfhzlNew" parameterType="Zsdfhzl" resultType="Zsdfhzl">
    	select top 20 "$rowid$" as rowids,
       		vbeln, posnr, mandt, vgbel, vgpos, uname, matnr, fmenge, cdate, ctime, fh_date, werks, cha_datum
    	from ${hana_user}.zsd_fhzl
    	where "$rowid$" &gt; #{rowids} ${hana_mandt}
    	order by "$rowid$"
    </select>
    
    
    
    <!-- 第一次修改的，后期要改成时间一天内的，还要删除原始的那个更新逻辑 --> 
    <select id="selectKnkkCheckByUpdate" parameterType="Knkk" resultType="Knkk">
    	select top 20 "$rowid$" as rowids,
       		mandt,kunnr,kkber,klimk,skfor,ssobl,aedat
    	from ${hana_user}.Knkk
    	where "$rowid$" &gt; #{rowids} and aedat != '00000000' ${hana_mandt}
    	order by "$rowid$"
    </select>
    
    <!-- 第二次修改的,限制时间今天内的，以后更新逻辑按照这个模式来做 -->
    <select id="selectAufkCheckByUpdate" parameterType="Aufk" resultType="Aufk">
    	select top 20 "$rowid$" as rowids,
       		kdauf,kdpos,mandt,aufnr,erdat,erfzeit,ernam,aenam,bukrs,loekz,auart,werks,
    		aedat
    	from ${hana_user}.aufk
    	where "$rowid$" &gt; #{rowids} and aedat != '00000000' and aedat = CURRENT_DATE ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectBkpfCheckByUpdate" parameterType="Bkpf" resultType="Bkpf">
    	select top 20 "$rowid$" as rowids,
       		mandt, bukrs, belnr, gjahr, blart, bldat, budat, monat, cpudt, cputm, 
			aedat, upddt
    	from ${hana_user}.Bkpf
    	where "$rowid$" &gt; #{rowids} and aedat != '00000000' and aedat = CURRENT_DATE ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectKna1CheckUpdate" parameterType="Kna1" resultType="Kna1">
		select top 20 "$rowid$" as rowids,
       		kunnr, name1, name2, mandt, ktokd, updat
    	from ${hana_user}.Kna1
    	where "$rowid$" &gt; #{rowids} and updat != '00000000' and updat = CURRENT_DATE ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectLikpCheckByUpdate" parameterType="Likp" resultType="Likp">
    	select top 20 "$rowid$" as rowids,
			vbeln, mandt, erdat, wadat_ist, ctlpc, kunnr, aedat,lfuhr
    	from ${hana_user}.likp
    	where "$rowid$" &gt;#{rowids} and aedat != '00000000' and aedat = CURRENT_DATE ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectLipsCheckByUpdate" parameterType="Lips" resultType="Lips">
    	select top 20 "$rowid$" as rowids,
       		vbeln, posnr, vgbel, vgpos, mandt, matnr, matkl, arktx, werks, lgort, 
    		charg, lfimg, uebto, untto, erdat, erzet, aedat
    	from ${hana_user}.lips
    	where "$rowid$" &gt; #{rowids} and aedat != '00000000' and aedat = CURRENT_DATE ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectPa0002CheckByUpdate" parameterType="Pa0002" resultType="Pa0002">
    	select top 20 "$rowid$" as rowids,
    		mandt,pernr,subty,objps,sprps,endda,begda,seqnr,nachn,vorna,aedtm
    	from ${hana_user}.Pa0002
    	where "$rowid$" &gt; #{rowids} and aedtm != '00000000' and aedtm = CURRENT_DATE ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectVbakCheckByUpdate" parameterType="Vbak" resultType="Vbak">
    	select top 20 a."$rowid$" as rowids,
			a.vbeln, a.mandt, a.vbtyp, a.audat, a.waerk, a.kalsm, a.ctlpc, a.kunnr, a.bukrs_vf, a.bstnk, 
			a.bname, a.telf1, a.netwr, a.vkbur, a.knumv, a.vkorg, a.vtweg, a.kkber, a.auart, a.aedat, 
			a.erdat, a.erzet, a.spart
		from ${hana_user}.vbak a 
		where "$rowid$" &gt; #{rowids} and a.aedat != '00000000' and a.aedat = CURRENT_DATE and a.mandt = '800'
		order by "$rowid$"
    </select>
    <select id="selectVbrkCheckByUpdate" parameterType="Vbrk" resultType="Vbrk">
    	select top 20 "$rowid$" as rowids,
    		vbeln,fkart,waerk,erdat,erzet,zterm,kunrg,bstnk_vf,
			zbillty,zbz01,zbz02,zdc_flg,bukrs,ktgrd,fkdat,inco1,
			inco2,netwr,mwsbk,aedat,mandt
    	from ${hana_user}.Vbrk
    	where "$rowid$" &gt; #{rowids} and aedat != '00000000' and aedat = CURRENT_DATE ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectZsd06CheckByUpdate" parameterType="Zsd06" resultType="Zsd06">
    	select top 20 "$rowid$" as rowids,
       		vbeln, posnr, mandt, datum, uname, crt_uname, crt_datum, 
    		crt_time, cha_name, cha_datum, cha_time
    	from ${hana_user}.Zsd_06
    	where "$rowid$" &gt; #{rowids} and cha_datum != '00000000' and cha_datum = CURRENT_DATE ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectZsdfhzlCheckByUpdate" parameterType="Zsdfhzl" resultType="Zsdfhzl">
    	select top 20 "$rowid$" as rowids,
       		vbeln, posnr, mandt, vgbel, vgpos, uname, matnr, fmenge, cdate, ctime, fh_date, werks, cha_datum
    	from ${hana_user}.zsd_fhzl
    	where "$rowid$" &gt; #{rowids} and cha_datum != '00000000' and cha_datum = CURRENT_DATE ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectMaraCheckByUpdate" parameterType="Mara" resultType="Mara">
    	select top 20 "$rowid$" as rowids,
       		matnr, mandt, ersda, ernam, laeda, aenam, vpsta, pstat, mtart, mbrsh, matkl, 
    		bismt, meins, bstme, wrkst, brgew, ntgew, gewei, spart, kzkfg, extwg, cuobf 
    	from ${hana_user}.Mara
    	where "$rowid$" &gt; #{rowids} and laeda != '00000000' and laeda = CURRENT_DATE ${hana_mandt}
    	order by "$rowid$"
    </select>
    <select id="selectVbapCheckByUpdate" parameterType="Vbap" resultType="Vbap">
    	select top 20 "$rowid$" as rowids,
			p.vbeln, p.posnr, p.matnr, p.mandt, p.matkl, p.spart, p.kwmeng, p.netwr, p.mwsbp, p.waerk, p.vrkme, p.abgru, 
			p.uebto, p.untto, p.werks, p.vstel, p.mvgr1, p.plavo, p.mvgr4, p.mvgr5, p.ulxh, p.zma_ftb_02, p.zma_ftb_03, 
			p.zma_ftb_45, p.zma_ftb_06, p.zma_ftb_07, p.zma_ftb_08, p.zma_jyb_02, p.zma_jyb_03, p.zma_jyb_45, 
			p.zma_jyb_06, p.zma_jyb_07, p.zma_ljb_03, p.zma_ljb_04, p.zma_ljb_06, p.zma_ljb_07, p.zma_ljb_08, 
			p.zma_ljb_11, p.zma_ljb_12, p.zma_ljb_13, p.zma_yhbg_02, p.zma_yhbg_04, p.zma_yhbg_05, p.zma_yhbg_06, 
			p.tbpz, p.ws, p.cu_maktx, p.cu_pcdst, p.ztype, p.barcode, p.gdno, p.lh, p.dgxx, p.zklx, p.erdat, p.erzet, p.netpr, p.aedat,q.pernr
		from ${hana_user}.vbap p 
		left join (
			select a.vbeln,a.posnr,a.pernr from ${hana_user}.vbpa a
				left join ${hana_user}.vbak b on a.vbeln = b.vbeln
			where a.mandt = '800' and a.pernr != '00000000' and a.parvw = 'VE'
			group by a.vbeln,a.posnr,a.pernr
		) q on p.vbeln = q.vbeln and p.posnr = q.posnr
    	where p."$rowid$" &gt; #{rowids} and p.aedat != '00000000' and p.aedat = CURRENT_DATE and p.mandt = '800'
    	order by p."$rowid$"
    </select>
    
    
    
    <select id="cascadeKnvvByKna1" parameterType="Kna1" resultType="Knvv">
    	select
       		mandt, kunnr, vkorg, vtweg, spart, waers, klabc
    	from ${hana_user}.Knvv
    	where kunnr = #{kunnr} ${hana_mandt}
    </select>
    <select id="cascadeAfkoByAufk" parameterType="Aufk" resultType="Afko">
    	select 
       		aufnr, mandt, gltrp, gamng, plnbez, gmein, plnnr, plnal, 
    		stlnr, cy_seqnr, gstrp, aufpl, aplzt
    	from ${hana_user}.afko
    	where aufnr = #{aufnr} ${hana_mandt}
    </select>
    <select id="cascadeAfpoByAufk" parameterType="Aufk" resultType="Afpo">
    	select 
    		kdauf, kdpos, aufnr, mandt, posnr, psmng, wemng, meins, matnr, 
    		uebto, untto, pwerk, verid, dwerk, dauat, krsnr, sernr, plnum
    	from ${hana_user}.afpo
    	where aufnr = #{aufnr} ${hana_mandt}
    </select>
    <select id="cascadeAuspByMara" parameterType="Mara" resultType="Ausp">
    	select 
       		mandt, objek, atinn, atzhl, mafid, klart, adzhl, atwrt
    	from ${hana_user}.Ausp
    	where objek = #{matnr} ${hana_mandt}
    </select>
    <select id="cascadeVbrpByVbrk" parameterType="Vbrk" resultType="Vbrp">
    	select
    		vbeln,posnr,fkimg,meins,vgbel,vgpos,aubel,aupos,matnr,
			arktx,matkl,spart,zarktx_js,zfkimg_js,zvrkme_js, mandt,netwr,mwsbp
    	from ${hana_user}.Vbrp
    	where vbeln = #{vbeln} ${hana_mandt}
    </select>
    <select id="cascadeKonvByVbak" parameterType="Vbak" resultType="Konv">
    	select 
			mandt,knumv,kposn,stunr,zaehk,kntyp,kbetr
    	from ${hana_user}.konv
    	where knumv = #{knumv} ${hana_mandt}
    </select>
    <select id="cascadeMaktByMara" parameterType="Mara" resultType="Makt">
    	select 
       		matnr, mandt, spras, maktx
    	from ${hana_user}.Makt
    	where matnr = #{matnr} ${hana_mandt}
    </select>
    <select id="cascadeVbukByLips" parameterType="Lips" resultType="Vbuk">
    	select 
    	    vbeln, wbstk, kostk, mandt
    	from ${hana_user}.vbuk
    	where vbeln = #{vbeln} ${hana_mandt}
    </select>
    <select id="cascadeZpoeditByAufk" parameterType="Aufk" resultType="Zpoedit">
    	select 
       		mandt, pwerk, aufnr, reason
    	from ${hana_user}.Zpo_edit
    	where aufnr = #{aufnr} ${hana_mandt}
    </select>
    <select id="cascadeBsadByBkpf" parameterType="Bkpf" resultType="Bsad">
    	select 
    		a.vbeln,a.mandt,a.bukrs,a.kunnr,a.umsks,a.umskz,a.augdt as augdts,a.augbl,a.zuonr,a.gjahr,a.belnr,a.buzei,a.buzei as buzeis,
    		a.blart,a.waers,a.wrbtr,a.shkzg,a.budat as budats,a.zfbdt as zfbdts,a.zterm
    	from ${hana_user}.bsad a
		where a.bukrs = #{bukrs} and a.belnr = #{belnr} and a.gjahr = #{gjahr} and a.mandt = '800'
    </select>
    <select id="cascadeBsidByBkpf" parameterType="Bkpf" resultType="Bsid">
    	select 
    		a.vbeln,a.mandt,a.bukrs,a.kunnr,a.umsks,a.umskz,a.augdt as augdts,a.augbl,a.zuonr,a.gjahr,a.belnr,a.buzei,a.buzei as buzeis,
    		a.blart,a.waers,a.wrbtr,a.shkzg,a.budat as budats,a.zfbdt as zfbdts,a.zterm
    	from ${hana_user}.bsid a
		where a.bukrs = #{bukrs} and a.belnr = #{belnr} and a.gjahr = #{gjahr} and a.mandt = '800'
    </select>
    <select id="cascadeVbepByVbap" parameterType="Vbap" resultType="Vbep">
    	select 
       		vbeln, posnr, edatu, ettyp, wmeng, bmeng, mandt, etenr, aufnr
    	from ${hana_user}.vbep
    	where vbeln=#{vbeln} and posnr=#{posnr} ${hana_mandt}
    </select>
    <select id="cascadeVbpaByVbap" parameterType="Vbap" resultType="Vbpa">
    	select 
    		mandt, vbeln, posnr, parvw, pernr
    	from ${hana_user}.Vbpa 
    	where vbeln=#{vbeln} and posnr = #{posnr} and parvw = 'VE' ${hana_mandt}
    </select>
    <select id="cascadeZmdpcByVbap" parameterType="Vbap" resultType="Zmdpc">
    	select 
       		vbeln,posnr,f_plant,plant,x_plant,mandt
    	from ${hana_user}.Zmdpc
    	where vbeln=#{vbeln} and posnr=#{posnr} ${hana_mandt}
    </select>
    
    
    
    
    <select id="selectAfkoById" parameterType="Afko" resultType="Afko">
    	select
    		aufnr, mandt, gltrp, gamng, plnbez, gmein, plnnr, plnal, 
    		stlnr, cy_seqnr, gstrp, aufpl, aplzt
    	from ${hana_user}.afko where aufnr = #{aufnr} and mandt = '800'
    </select>
	<select id="selectAfpoById" parameterType="Afpo" resultType="Afpo">
    	select 
    		kdauf, kdpos, aufnr, mandt, posnr, psmng, wemng, meins, matnr, 
    		uebto, untto, pwerk, verid, dwerk, dauat, krsnr, sernr, plnum
    	from ${hana_user}.afpo 
    	where aufnr = #{aufnr} and posnr = #{posnr} and mandt = '800'
    </select>
    <select id="selectAufkById" parameterType="Aufk" resultType="Aufk">
    	select kdauf,kdpos,mandt,aufnr,erdat,erfzeit,ernam,aenam,bukrs,loekz,auart,werks,
    	    aedat
    	from ${hana_user}.aufk 
    	where mandt = '800' and aufnr = #{aufnr}
    </select>
    <select id="selectKna1ById" parameterType="Kna1" resultType="Kna1">
    	select kunnr, name1, name2, mandt, ktokd, updat
    	from ${hana_user}.kna1 
    	where kunnr = #{kunnr} and mandt = '800'
    </select>
	<select id="selectKnkkById" parameterType="Knkk" resultType="Knkk">
    	select mandt,kunnr,kkber,klimk,skfor,ssobl,aedat
    	from ${hana_user}.Knkk 
    	where kunnr = #{kunnr} and kkber = #{kkber} and mandt = '800'
    </select>
	<select id="selectKnvvById" parameterType="Knvv" resultType="Knvv">
    	select mandt, kunnr, vkorg, vtweg, spart, waers, klabc
    	from ${hana_user}.Knvv 
    	where mandt = '800' and kunnr = #{kunnr} and vkorg = #{vkorg} and vtweg = #{vtweg} and spart = #{spart}
    </select>
	<select id="selectAfvcById" parameterType="Afvc" resultType="Afvc">
    	select mandt, aufpl, aplzl, steus
    	from ${hana_user}.Afvc 
    	where mandt = '800' and aufpl = #{aufpl} and aplzl = #{aplzl}
    </select>
    <select id="selectKnvpById" parameterType="Knvp" resultType="Knvp">
    	select mandt, kunnr, vkorg, vtweg, spart, parvw, parza, kunn2, pernr, knref, pernr as pernr1
    	from ${hana_user}.Knvp 
    	where mandt = '800' and kunnr = #{kunnr} and vkorg = #{vkorg} and vtweg = #{vtweg} and spart = #{spart} and parvw = #{parvw} and parza = #{parza}
    </select>
    <select id="selectAuspById" parameterType="Ausp" resultType="Ausp">
    	select mandt, objek, atinn, atzhl, mafid, klart, adzhl, atwrt
    	from ${hana_user}.Ausp 
    	where mandt = '800' and objek = #{objek} and atinn = #{atinn} and atzhl = #{atzhl} and mafid = #{mafid} and klart = #{klart} and adzhl = #{adzhl}
    </select>
    <select id="selectTspatById" parameterType="Tspat" resultType="Tspat">
    	select mandt, spras, spart, vtext
    	from ${hana_user}.Tspat 
    	where mandt = '800' and spras = #{spras} and spart = #{spart}
    </select>
    <select id="selectZpoeditById" parameterType="Zpoedit" resultType="Zpoedit">
    	select mandt, pwerk, aufnr, reason
    	from ${hana_user}.Zpo_edit 
    	where mandt = '800' and pwerk = #{pwerk} and aufnr = #{aufnr}
    </select>
	<select id="selectKonvById" parameterType="Konv" resultType="Konv">
    	select mandt,knumv,kposn,stunr,zaehk,kntyp,kbetr
    	from ${hana_user}.Konv 
    	where mandt = '800' and knumv = #{knumv} and kposn = #{kposn} and stunr = #{stunr} and zaehk = #{zaehk}
    </select>
   	<select id="selectLikpById" parameterType="Likp" resultType="Likp">
    	select 
    		vbeln, mandt, erdat, wadat_ist, ctlpc, kunnr, aedat,lfuhr
    	from ${hana_user}.likp 
    	where vbeln = #{vbeln} and mandt = '800'
    </select>
    <select id="selectBkpfById" parameterType="Bkpf" resultType="Bkpf">
    	select mandt, bukrs, belnr, gjahr, blart, bldat, budat,monat,cpudt, cputm, 
    		aedat, upddt
    	from ${hana_user}.Bkpf 
    	where mandt = '800' and bukrs = #{bukrs} and belnr = #{belnr} and gjahr = #{gjahr}
    </select>
	<select id="selectLipsById" parameterType="Lips" resultType="Lips">
    	select 
    		vbeln, posnr, vgbel, vgpos, mandt, matnr, matkl, arktx, werks, lgort, 
    		charg, lfimg, uebto, untto, erdat, erzet, aedat
    	from ${hana_user}.lips 
    	where vbeln = #{vbeln} and posnr = #{posnr} and mandt = '800'
    </select>
	<select id="selectMaktById" parameterType="Makt" resultType="Makt">
    	select matnr, mandt, spras, maktx from ${hana_user}.makt 
    	where matnr = #{matnr} and mandt = '800' and spras = #{spras}
    </select>
    <select id="selectMaraById" parameterType="Mara" resultType="Mara">
    	select 
    		matnr, mandt, ersda, ernam, laeda, aenam, vpsta, pstat, mtart, mbrsh, matkl, 
    		bismt, meins, bstme, wrkst, brgew, ntgew, gewei, spart, kzkfg, extwg, cuobf 
    	from ${hana_user}.mara 
    	where matnr = #{matnr} and mandt = '800'
    </select>
	<select id="selectMskaById" parameterType="Mska" resultType="Mska">
    	select 
    		vbeln, posnr, mandt, matnr, werks, lgort, charg, sobkz, kaspe, kalab
    	from ${hana_user}.mska 
    	where mandt = '800' and matnr = #{matnr} and werks = #{werks} and lgort = #{lgort} 
			and charg = #{charg} and sobkz = #{sobkz} and vbeln = #{vbeln} and posnr = #{posnr}
    </select>
    <select id="selectPa0002ById" parameterType="Pa0002" resultType="Pa0002">
    	select mandt,pernr,subty,objps,sprps,endda,begda,seqnr,nachn,vorna,aedtm
    	from ${hana_user}.Pa0002 
    	where mandt = '800' and pernr = #{pernr} and subty = #{subty} and objps = #{objps}
			and sprps = #{sprps} and endda = #{endda} and begda = #{begda} and seqnr = #{seqnr}
    </select>
	<select id="selectS066ById" parameterType="S066" resultType="S066">
    	select mandt, ssour, vrsio, kkber, knkli, spmon, sptag as sptags, spwoc, spbup, oeikw,
    		spwoc as spwocs, spbup as spbups, spmon as spmons
    	from ${hana_user}.S066 
    	where mandt = '800' and ssour = #{ssour} and vrsio = #{vrsio} and kkber = #{kkber} and
			knkli = #{knkli} and spmon = #{spmons} and sptag = #{sptags} and spwoc = #{spwocs} and spbup = #{spbups}
    </select>
    <select id="selectS067ById" parameterType="S067" resultType="S067">
    	select mandt, ssour, vrsio, kkber, knkli, spmon, sptag as sptags, spwoc, spbup, olikw, ofakw,
    		spwoc as spwocs, spbup as spbups, spmon as spmons
    	from ${hana_user}.S067
    	where mandt = '800' and ssour = #{ssour} and vrsio = #{vrsio} and kkber = #{kkber} and
			knkli = #{knkli} and spmon = #{spmons} and sptag = #{sptags} and spwoc = #{spwocs} and spbup = #{spbups}
    </select>
    <select id="selectT001wById" parameterType="T001w" resultType="T001w">
    	select mandt, werks, name1, bwkey
    	from ${hana_user}.T001w 
    	where werks = #{werks} and mandt = '800'
    </select>
	<select id="selectT023tById" parameterType="T023t" resultType="T023t">
    	select mandt,spras,matkl,wgbez,wgbez60
    	from ${hana_user}.T023t 
    	where mandt = '800' and spras = #{spras} and matkl = #{matkl}
    </select>
    <select id="selectVbakById" parameterType="Vbak" resultType="Vbak">
		select 
		 a.vbeln, a.mandt, a.vbtyp, a.audat, a.waerk, a.kalsm, a.ctlpc, a.kunnr, a.bukrs_vf, a.bstnk, 
		 a.bname, a.telf1, a.netwr, a.vkbur, a.knumv, a.vkorg, a.vtweg, a.kkber, a.auart, a.aedat, b.pernr, 
		 a.erdat, a.erzet, a.spart
		from ${hana_user}.vbak a 
		left join (
			select q.vbeln,r.pernr from ${hana_user}.vbap q 
				left  join (
					select vbeln,posnr,pernr from ${hana_user}.vbpa where mandt = '800' and pernr != '00000000' group by vbeln,posnr,pernr
				) r on q.vbeln = r.vbeln and q.posnr = r.posnr 
			where q.mandt = '800' and r.pernr is not null
			group by q.vbeln,r.pernr
		) b on a.vbeln = b.vbeln
		where a.vbeln = #{vbeln} and a.mandt = '800'
    </select>
	<select id="selectVbepById" parameterType="Vbep" resultType="Vbep">
    	select vbeln, posnr, edatu, ettyp, wmeng, bmeng, mandt, etenr, aufnr
    	from ${hana_user}.vbep 
    	where vbeln = #{vbeln} and posnr = #{posnr} and etenr = #{etenr} and mandt = '800'
    </select>
	<select id="selectVbpaById" parameterType="Vbpa" resultType="Vbpa">
    	select mandt, vbeln, posnr, parvw, pernr
    	from ${hana_user}.Vbpa 
    	where vbeln = #{vbeln} and posnr = #{posnr} and mandt = '800' and parvw = #{parvw}
    </select>
    <select id="selectVbrkById" parameterType="Vbrk" resultType="Vbrk">
    	select 
			vbeln,fkart,waerk,erdat,erzet,zterm,kunrg,bstnk_vf,
			zbillty,zbz01,zbz02,zdc_flg,bukrs,ktgrd,fkdat,inco1,
			inco2,netwr,mwsbk,aedat,mandt
    	from ${hana_user}.Vbrk 
    	where vbeln = #{vbeln} and mandt = '800' 
    </select>
	<select id="selectVbrpById" parameterType="Vbrp" resultType="Vbrp">
    	select vbeln,posnr,fkimg,meins,vgbel,vgpos,aubel,aupos,matnr,
			arktx,matkl,spart,zarktx_js,zfkimg_js,zvrkme_js, mandt,netwr,mwsbp
    	from ${hana_user}.Vbrp 
    	where vbeln = #{vbeln} and posnr = #{posnr} and mandt = '800' 
    </select>
	<select id="selectVbukById" parameterType="Vbuk" resultType="Vbuk">
    	select vbeln, wbstk, kostk, mandt
    	from ${hana_user}.vbuk 
    	where vbeln = #{vbeln} and mandt = '800'
    </select>
	<select id="selectZmdpcById" parameterType="Zmdpc" resultType="Zmdpc">
    	select vbeln,posnr,f_plant,plant,x_plant,mandt
    	from ${hana_user}.Zmdpc 
    	where vbeln = #{vbeln} and posnr = #{posnr} and mandt = '800'
    </select>
    <select id="selectZsd06ById" parameterType="Zsd06" resultType="Zsd06">
    	select vbeln, posnr, mandt, datum, uname, crt_uname, crt_datum, 
    	crt_time, cha_name, cha_datum, cha_time
    	from ${hana_user}.zsd_06 
    	where vbeln = #{vbeln} and posnr = #{posnr} and mandt = '800'
    </select>
    <select id="selectZsdfhzlById" parameterType="Zsdfhzl" resultType="Zsdfhzl">
    	select vbeln, posnr, mandt, vgbel, vgpos, uname, matnr, fmenge, cdate, ctime, fh_date, werks, cha_datum
    	from ${hana_user}.zsd_fhzl 
    	where vbeln = #{vbeln} and posnr = #{posnr} and mandt = '800'
    </select>
	<select id="selectBsidById" parameterType="Bsid" resultType="Bsid">
    	select 
    		a.vbeln,a.mandt,a.bukrs,a.kunnr,a.umsks,a.umskz,a.augdt as augdts,a.augbl,a.zuonr,a.gjahr,a.belnr,a.buzei,a.buzei as buzeis,
   		a.blart,a.waers,a.wrbtr,a.shkzg,a.budat as budats,a.zfbdt as zfbdts,a.zterm
    	from ${hana_user}.Bsid a
    	where a.mandt = '800'
			and a.bukrs = #{bukrs} and a.kunnr = #{kunnr} and a.umsks = #{umsks} and a.umskz = #{umskz} 
			and a.augdt = #{augdts} and a.augbl = #{augbl} and a.zuonr = #{zuonr} and a.gjahr = #{gjahr} 
			and a.belnr = #{belnr} and a.buzei = #{buzeis}
    </select>
    <select id="selectBsadById" parameterType="Bsad" resultType="Bsad">
    	select 
    		a.vbeln,a.mandt,a.bukrs,a.kunnr,a.umsks,a.umskz,a.augdt as augdts,a.augbl,a.zuonr,a.gjahr,a.belnr,a.buzei,a.buzei as buzeis,
   		a.blart,a.waers,a.wrbtr,a.shkzg,a.budat as budats,a.zfbdt as zfbdts,a.zterm
    	from ${hana_user}.Bsad a
    	where a.mandt = '800'
			and a.bukrs = #{bukrs} and a.kunnr = #{kunnr} and a.umsks = #{umsks} and a.umskz = #{umskz} 
			and a.augdt = #{augdts} and a.augbl = #{augbl} and a.zuonr = #{zuonr} and a.gjahr = #{gjahr} 
			and a.belnr = #{belnr} and a.buzei = #{buzeis}
    </select>
	<select id="selectVbapById" parameterType="Vbap" resultType="Vbap">
		select
			p.vbeln, p.posnr, p.matnr, p.mandt, p.matkl, p.spart, p.kwmeng, p.netwr, p.mwsbp, p.waerk, p.vrkme, p.abgru, 
			p.uebto, p.untto, p.werks, p.vstel, p.mvgr1, p.plavo, p.mvgr4, p.mvgr5, p.ulxh, p.zma_ftb_02, p.zma_ftb_03, 
			p.zma_ftb_45, p.zma_ftb_06, p.zma_ftb_07, p.zma_ftb_08, p.zma_jyb_02, p.zma_jyb_03, p.zma_jyb_45, 
			p.zma_jyb_06, p.zma_jyb_07, p.zma_ljb_03, p.zma_ljb_04, p.zma_ljb_06, p.zma_ljb_07, p.zma_ljb_08, 
			p.zma_ljb_11, p.zma_ljb_12, p.zma_ljb_13, p.zma_yhbg_02, p.zma_yhbg_04, p.zma_yhbg_05, p.zma_yhbg_06, 
			p.tbpz, p.ws, p.cu_maktx, p.cu_pcdst, p.ztype, p.barcode, p.gdno, p.lh, p.dgxx, p.zklx, p.erdat, p.erzet, p.netpr, p.aedat,q.pernr
		from ${hana_user}.vbap p 
		left join (
			select a.vbeln,a.posnr,a.pernr from ${hana_user}.vbpa a
				left join ${hana_user}.vbak b on a.vbeln = b.vbeln
			where a.mandt = '800' and a.pernr != '00000000' and a.parvw = 'VE'
			group by a.vbeln,a.posnr,a.pernr
		) q on p.vbeln = q.vbeln and p.posnr = q.posnr
		where p.vbeln = #{vbeln} and p.posnr = #{posnr} and p.mandt = '800' and p.erdat = #{erdat}
    </select>
    <select id="selectTvkbtById" parameterType="Tvkbt" resultType="Tvkbt">
    	select mandt,spras,vkbur,bezei
    	from ${hana_user}.Tvkbt 
		where mandt = '800' and spras = #{spras} and vkbur = #{vkbur}
    </select>
    
    
    <select id="selectMsegById" parameterType="Mseg" resultType="Mseg">
    	select mandt, mblnr, mjahr, zeile, bwart, charg, menge, budat_mkpf, cputm_mkpf, aufnr,kdauf, kdpos, matnr
    	from ${hana_user}.Mseg 
    	where mandt = #{mandt} and mblnr = #{mblnr} and mjahr = #{mjahr} and zeile = #{zeile}
    </select>
	<select id="selectMkpfById" parameterType="Mkpf" resultType="Mkpf">
    	select mandt, mblnr, mjahr, bldat, cputm
    	from ${hana_user}.Mkpf 
    	where mandt = #{mandt} and mblnr = #{mblnr} and mjahr = #{mjahr}
    </select>
	<select id="selectAfruById" parameterType="Afru" resultType="Afru">
    	select mandt, rueck, rmzhl, ersda, wablnr, aufnr, stokz, stzhl
    	from ${hana_user}.Afru 
    	where mandt = #{mandt} and rueck = #{rueck} and rmzhl = #{rmzhl}
    </select>
	<select id="selectAufmById" parameterType="Aufm" resultType="Aufm">
    	select 
			mblnr, mjahr, zeile, bldat, budat, bwart, matnr, werks, lgort, 
			charg, sobkz, lifnr, kdauf, kdpos, shkzg, menge, bwtar, aufnr, mandt
    	from ${hana_user}.aufm 
    	where mblnr = #{mblnr} and mandt = #{mandt}  and mjahr = #{mjahr} and zeile = #{zeile}
    </select>





	<!-- vbak修改join连接后的子查询 -->
	<select id="selectVbak4Join" parameterType="Vbak" resultType="map">
		select top 1 q.vbeln,r.pernr from ${hana_user}.vbap q 
			left  join (
				select vbeln,posnr,pernr from ${hana_user}.vbpa where mandt = '800' and pernr != '00000000' group by vbeln,posnr,pernr
			) r on q.vbeln = r.vbeln and q.posnr = r.posnr 
		where q.mandt = '800' and r.pernr is not null and q.vbeln = #{vbeln}
		group by q.vbeln,r.pernr
	</select>



</mapper>
