I discovered that there’s an internal script function called XML_WRITE_DOCU. It’s mentioned in the documentation of message U00020678:
U00020678 Runtime error in object '&01', line '&02'. XML_WRITE_DOCU: Cannot access object: '&04' because it is opened by user: '&06' since: '&05'.
Attempting to use this script function results in message U00020999.
U000209989 Runtime error in object '&01', line '&02': You do not have the necessary authorization for this instruction.
Perhaps XML_WRITE_DOCU will be made public in a future version.