SBM 340 Rear Main Cap

Yes, the 318 main caps are shorter than 340 caps, but are still useable- just not as strong, but in a non-max street build the difference is negligible.
To use the 318 caps you need to use the 318 bolts, shorten the 340 bolts, use a main stud kit, or use hardened washers under the heads of the 340 bolts (this is what DC/MP used to accommodate the differences in their windage tray main bolt kits).
No matter which route you opt for, the block will need to be line honed or bored, depending how close the tolerances work out.
A good thread on the subject:
340 main caps