Thanks for your reply Mark,
Yes, it is a a custom session and you are right that there is code under the 'before.zoom:' section. But there is nothing there to set the company number. And also (verified with debugger) when calling 'zoom.to$()' from a user action this section is completely bypassed.
I have then noticed that there is also a sub-session (tipcs3410s000) and when I call that instead it is the same behaviour.
The code in the session we are zooming to is defined under the section 'form.1'. To try to avoid that part of the code I created a custom session just as a copy but then put the only available form as form number 2. Did not make any changes.
So I ended up creating my own session as a copy of the session I want to zoom to and made it with own script name. Now I could copy the standard script into that and compile. So when I do that and it crashes the debugger will show me the part of code that is wrong. This way I could figure out what variable was not correctly initialised.
Turns out in the end that if I add the below code to the 'before.zoom' section in the session I am zooming from then it works. It does not end up on the correct record but as I need to do an insert anyway this is good enough for now.
| for tipcs3140s000
tfgld102.tcom = get.compnr()
iprj = tfgld.intr.pcs
as set with 1 rows
tfgld102.leac = tfgld008.leac
Thanks a lot for taking your time Mark!!