Catalyzes the liberation of D-alanyl moieties present on wall teichoic acid (WTA) and lipoteichoic acid (LTA) (By similarity). Affects the methicillin resistance level and autolysis in the presence of Triton X-100 as well as the cell wall structure (PubMed:9371333, PubMed:10471551). [(4-D-Ala)-(2-GlcNAc)-Rib-ol-P]n-[Gro-P]m-beta-D-ManNAc-(1->4)-alpha-D-GlcNAc-P-peptidoglycan + n H2O = [(2-GlcNAc)-Rib-ol-P]n-[Gro-P]m-beta-D-ManNAc-(1->4)-alpha-D-GlcNAc-P-peptidoglycan + n D-alanine. Transcription is dose dependently increased by the addition of beta-lactam antibiotics, fosfomycin, and bacitracin. Inactivation of fmtA results in reduction of the methicillin resistance and in a modification of the cell wall structure.