forSelect ENT_DET_ARTICULO, ENT_DET_CANTIDAD, ENT_DET_LARGO, ENT_DET_ANCHO from ENTALMACENDET
where ENT_DET_FOLIO = :FOLIO into roducto, :cantidad, ;Existencia, :Ancho :Largo dobegin
aux1 = '';
aux2 = '';
select MAT_ANCHO, MAT_LARGO from MATERIAL_DET where MAT_ID:=producto into :aux1, :aux2;
if (aux1 = ''and aux2 = '') theninsertinto tabla (lo que sea)
elseupdate tabla (lo que sea)