edjofego
25th August 2008, 23:22
Hi!


I'm developing on BaaN IV a session process that will insert automatically some records in session tfcmg1110m000, which come from a .csv file and a parameters table (tfgld900), through a library that contains AFS, to do this I'm using the stpapi.put.field() for fill the required fields, when I have finish, the stpapi.insert() is called, when I process the first record, all it's okay, the information is inserted in the table, but when I process the second one or all other records the return value of the stpapi.insert() is "false" and the error message says "No se permite Divisa" ("The Currency is not allowed") obviously the currency is allowed and exists in the currencies's table but the process always should be reads the same currency, and doing a debugger the field tfgld900.ccur always brings the same value as the first record that was processed successful, when I'm debugging I put some value to the field and get the same result, the variable error message tells me that do not allow the currency, maybe I'm doing some wrong... Can U help me??

Here is the script:

tfcmg1110m000f.put.Proveedor(tfgld900.suno)
tfcmg1110m000f.put.M_todo_contabilizaci_n(tfgld900.post)
tfcmg1110m000f.put.Importe(importe)
tfcmg1110m000f.put.Referencia(col6)
tfcmg1110m000f.put.M_todo_cobros_pagos(tfgld900.paym)
tfcmg1110m000f.put.Motivo_para_pago_extranjero(tfgld900.reas)
val.insert = tfcmg1110m000f.insert(true, errorm1)
if not val.insert then
val.recover1 = tfcmg1110m000f.recover(errorm2)
else
val.save = tfcmg1110m000f.save(errorm3)
if not val.save then
val.recover2 = tfcmg1110m000f.recover(errorm4)
endif
endif

Thanx a lot!!

EdJoFeGo :D

mark_h
26th August 2008, 19:07
This is the correct forum for afs questions. Have you tried ending the session after inserting each record? Yes it causes a lot of overhead, but it may work. I don't like to do this, but sometimes it is the only way to get them to work.

edjofego
26th August 2008, 19:46
Hi mark!

Please forgive me, I saw the subforum for Function Servers after I wrote the thread, This is my first time reading and writing in this great forum, I'll be carefully next time :D

I tried your solution (end session when this inserts a new record) and everything was successful, however, the process could be a bit slow because will be read and insert many records at the same time but it doesn't even matter...

Thank you in any way for your help!! :D :D
Problem solved :cool:

mark_h
26th August 2008, 20:58
Hi mark!

Please forgive me, I saw the subforum for Function Servers after I wrote the thread, This is my first time reading and writing in this great forum, I'll be carefully next time :D

I tried your solution (end session when this inserts a new record) and everything was successful, however, the process could be a bit slow because will be read and insert many records at the same time but it doesn't even matter...

Thank you in any way for your help!! :D :D
Problem solved :cool:

No problem on the posting - that is what us moderators are for. :)

Great!!! glad it worked. And yes it can slow up processing - you might want to continually check things as you do a service pack updates. You never know when baan might fix the issue.

Let me warn you; on one session I had to do this on, it would work for around 1000 transactions - then it would abort. Somewhere in the service pack update this error or abort stopped happening. We used to split the transaction files into pieces to process them.