BOM question - exchange parts/components

hi guys, 

need to pick your brains on this one:

M(aster item) = A + B + C + D

In one single transaction, we would like to swap (exchange) D with X, in other words:

M = A + B + C - D + X

How do we achieve this without first "disassemble" then "assemble"?

Please help.