Component (exhaust) of another model: approved according to STVO?

Hello together I’m not quite sure if this fits here or not. Case no: Please forgive me, did not know where to go with this question. It’s about the following: Is it permissible, for example, to build an exhaust system of a Mercedes S63 AMG to an S500? Both original Mercedes parts for the same series. It’s not about the sense/imusement of this action, but only about the legal situation. It’s also just an example. Important: It’s about the same model with other motorization. t Attachment of the S63 to the B-Class. Also it should be noted that I am from Switzerland – but also the legal situation in Germany would be interesting, usually this is handled similarly. Thanks in advance for all relevant information!