The generation of acoustic waves in structured nanobeams containing optomechanic cavities is a topic of current interest. In this paper, we theoretically study the efficient conversion of surface acoustic waves (SAW) generated on a substrate by an RF electric signal into the acoustic waves of a nanobeam. First, we demonstrate the possibility of converting the SAW generated on a silicon substrate with a thin piezoelectric AlN layer into the guided mechanical modes of a straight nanobeam with a maximum efficiency ofโ€‰โ€‰โˆ’22.6 dB. This can be achieved by using a set of inter-digitated transducers with radial fingers, which provide SAW focusing towards the nanobeam entrance. We analyse the nature of the modes created inside the nanobeam and the conversion efficiency of the SAW into the different modes. Then, we study the interaction of these waves with a one-dimensional phononic crystal nanobeam containing a cavity. The latter is constituted by an array of holes and stubs and has been proven in our recent works to be very efficient for optomechanic applications. We calculate the transmission properties of the cavity modes and discuss the efficiency of generating the cavity modes from the initial SAW.