We present a method of both polarization and amplitude modulations on an incident beam to obtain a longitudinally polarized subwavelength-sized optical needle. A 4-f system with a spatial light modulator is used to generate experimentally a two-mode alternate cylindrical vector beam by polarization