As far as I can tell, SPMWRITE will only write state space matrices between structural DOFs. But I think I've managed to find a work around. Please copy the following APDL commands into a text file, then read that file into MAPDL with the /INPUT command. It creates an spm file, though I frankly don't know if it's valid. The "trick": I use CEs to force the values of UZ of each of two MASS21 nodes to the respective values of VOLT on the electrodes on two piezo transducers at opposite ends of a short beam. I then reference the MASS21 UZ DOFs (which equal the electrode voltages) in SPMWRITE. I hope this helps you get to where you're trying to go.
HERE'S THE APDL: