It won't be pretty
What's the application ? Remember that you can send AWT instructions out from the serial port even when it's in System Mode. You just can't read the input buffer.
In the Logix operating system, the serial port has both a Current and Pending set of parameters. If you are going to change the Port Mode, you write to the Pending parameter set then send a "Apply Changes" message.
The "Com Driver ID" attribute of the Serial Port object is not fully tested and exposed to the user application via the GSV/SSV instructions, so you're going to need to get the full object definition from your local RA office.
I recall managing to corrupt the serial port configuration by "playing" with this object, and I have not tried to manipulate it since the serial port handler was rewritten in v16.
Send me a PM if you want to discuss that object definition.