How to set TXID in rawtransaction?
You cannot choose the TXID of your transaction, really. It is calculated by SHA256d hashing the serialized transaction bytes. If you did happen to get miraculously lucky enough to get a transaction with the same hash as a different transaction, then it would be refused by the network for attempting to overwrite a transaction. 

There used to be a bug in bitcoin that coinbase transactions could have the same TXID sometimes. This was fixed by BIP34.