IF NOT FILE.EXISTS(FileName) THEN
IF Datei.OPEN(FileName) THEN BEGIN
Do you find the bug?
Yes? Good. Actually, there are 3 bugs!
1) The bug you found: the developer creates the file (if it doesn’t exist) and then opens it.
2) The Classic client does NOT generated an error in this case
3) The service tier does NOT behave as the classic client but just exits without an error.
This is on NAV2009R2. I didn’t check NAV2013.