Juergen
26th January 2005, 10:01
Hi,
I have a big problem with the function switch.to.company and AFS.
We build up a connector between our EDM System ProfiDB and our Baan system (IVc4 SP 14). Item and BOM information from the EDM System will be automatically transferd (via ASCII files) to Baan. On the Baan side main parts in the session are done using AFS. This is working very well.
The only problem is that we have two companies in Baan (company A and company B). Depending on two fields in the ASCII files the data must be inserted in company A or in company B or into both companies.
The last option is the problem. The Baan session is running in company A. If now the data must be inserted into both companies the session first insert the data in company A and in a second loop insert the data in company B.
To do this I use the function switch.to.company before calling the AFS functions.
function create.edmitm(domain tccomp comp)
{
if get.compnr() <> comp then
ret.sw = switch.to.company(comp)
endif
stpapi.put.field("tiedm0110m000", "tiedm010.eitm", in.item)
....
....
ret = stpapi.insert("tiedm0110m000", 1, error.mess)
....
stpapi.end.session("tiedm0110m000")
switch.to.company returns 1 (o.k) but stpapi.insert returns 0 (failed) with error.mess "Record already exists" for insert the data into company B.
The error does not occur if the data needs olny be inserted into company B and the session is running in company A. So the switch.to.company itself is working. The error only occur if the data needs to be inserted into both companies in one run.
After hours of debugging and checking (e.g. AFS.LOG) now I am helpless.
In some other threads regarding AFS and switch.to.company I found nothing what can be the problem. Normally it must work.
Maybe someone out there knows more or has the same problems in the past?
Regards,
Juergen
I have a big problem with the function switch.to.company and AFS.
We build up a connector between our EDM System ProfiDB and our Baan system (IVc4 SP 14). Item and BOM information from the EDM System will be automatically transferd (via ASCII files) to Baan. On the Baan side main parts in the session are done using AFS. This is working very well.
The only problem is that we have two companies in Baan (company A and company B). Depending on two fields in the ASCII files the data must be inserted in company A or in company B or into both companies.
The last option is the problem. The Baan session is running in company A. If now the data must be inserted into both companies the session first insert the data in company A and in a second loop insert the data in company B.
To do this I use the function switch.to.company before calling the AFS functions.
function create.edmitm(domain tccomp comp)
{
if get.compnr() <> comp then
ret.sw = switch.to.company(comp)
endif
stpapi.put.field("tiedm0110m000", "tiedm010.eitm", in.item)
....
....
ret = stpapi.insert("tiedm0110m000", 1, error.mess)
....
stpapi.end.session("tiedm0110m000")
switch.to.company returns 1 (o.k) but stpapi.insert returns 0 (failed) with error.mess "Record already exists" for insert the data into company B.
The error does not occur if the data needs olny be inserted into company B and the session is running in company A. So the switch.to.company itself is working. The error only occur if the data needs to be inserted into both companies in one run.
After hours of debugging and checking (e.g. AFS.LOG) now I am helpless.
In some other threads regarding AFS and switch.to.company I found nothing what can be the problem. Normally it must work.
Maybe someone out there knows more or has the same problems in the past?
Regards,
Juergen