смотрите форму DocuView. А в частности метод clicked() на кнопке Open. Вот фрагмент, который делает открываемый файл только для чтения:
X++:
// Does the data source allow editing (i.e. allowEdit)
if( !isTableUserEnabled(docuRef_ds.table(), AccessType::Edit))
{
// Set read-only file attribute
winapi::setFileAttributes(fname, #FILE_ATTRIBUTE_READONLY);
// Display a warning that the file is readonly
box::infoOnceEx("@SYS57813", "@SYP308", "", formstr(syslastvalue), "@SYS22719", false);
}
else
winapi::setFileAttributes(fname, #FILE_ATTRIBUTE_NORMAL);