order by BTR_link into cursor temp2~M
>>>>sele FIELD_LIST ; >>>> from TBALE1 ; >>>> join TABLE2 ; >>>> join TABLE3 ; >>>> where something ; >>>> AND something else ; >>>> UNION ; >>>>sele FIELD_LIST >>>> from TBALE1 ; >>>> join TABLE2 ; >>>> join TABLE3 ; >>>> where something ; >>>> AND something else ; >>>> into cursor temp2 nofilter >>>>>>>
>>set engine 80 >> >>* Get the cash lines >>sele BTR_link ; >> , BTR_per ; >> , BTR_supref ; >> , BMA_name ; >> , BTR_short ; >> , BTR_netval as xNet ; >> , BTR_vatval as xVat ; >> , BTR_exchg ; >> , BTR_curr ; >> , round(BTR_netval/BTR_exchg,2) as xValue ; >> , BTR_ordref ; >> , BTR_ourref ; >> , BTR_invref ; >> , BTR_invdat ; >> , BTR_bnkref ; >> , BTR_bnkval ; >> , space(25) as BDE_stkref ; >> , space(10) as BDE_nom ; >> , space(10) as BDE_cc ; >> , A_rectyp ; >> , A_tratyp ; >> , A_nomctrl ; >> , A_nccreve ; >> , A_nomreve ; >> from kfbtr ; >> join kflli on BTR_short = a_short and a_rectyp = "10" ; >> join kfbma on BTR_supref = BMA_ref ; >> where BTR_per >= 201601 AND BTR_per <= 201612 ; >> AND BTR_stage = "70" ; >> AND (a_tratyp = "C" OR a_tratyp = "J") ; >> UNION ; >>sele BTR_link ; >> , BTR_per ; >> , BTR_supref ; >> , BMA_name ; >> , BTR_short ; >> , BDE_linval as xNet ; >> , BDE_linvat as xVat ; >> , BTR_exchg ; >> , BTR_curr ; >> , round(BDE_linval/BTR_exchg,2) as xValue ; >> , BTR_ordref ; >> , BTR_ourref ; >> , BTR_invref ; >> , BTR_invdat ; >> , BTR_bnkref ; >> , BTR_bnkval ; >> , BDE_stkref ; >> , BDE_nom ; >> , BDE_cc ; >> , A_rectyp ; >> , A_tratyp ; >> , A_nomctrl ; >> , A_nccreve ; >> , A_nomreve ; >> from kfbtr ; >> outer join kfbde on btr_link = bde_link ; >> join kflli on BTR_short = a_short and a_rectyp = "10" ; >> join kfbma on BTR_supref = BMA_ref ; >> where BTR_per >= 201601 AND BTR_per <= 201612 ; >> AND BTR_stage = "70" ; >> AND a_tratyp = "I" ; >> into cursor temp2 >>