Thank you for your answer!

Can you please explain to me what it %Document.Object exactly does? I have searched in the documentation but I didn't really find something.
And also the following part:

%ExecDirect(,"call %SQL_Util.CSV(,?,?)",.rowtype,.fileIn),"res")

Thank you in advance.

Hi Sergei,

great, thank you.
Do you have some examples (or example code) anywhere so I can follow it?