Baanboard.com

Go Back   Baanboard.com > Forum > BB Language Forums > Nederlandstalig forum

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 16th May 2014, 13:46
Rickman's Avatar
Rickman Rickman is offline
Junior Member
 
Join Date: Sep 2005
Posts: 16
Rickman is on a distinguished road
Baan: BaaNIVc4 - DB: SQL - OS: NT
switch.to.company werkt niet

Ik gebruik in een reportscript de functie 'switch.to.company'.
Kort na deze functie volgt een update in tccom010 maar ondanks dat er geen error ontstaat bij bovengenoemde functie, wordt de update in hetzelfde (verkeerde) bedrijf gedaan. Kortom, er wordt niet van bedrijf gewisseld.

Zou iemand mij kunnen vertellen waar het precies fout gaat?

Met vriendelijke groet,

Jan
Attached Images
File Type: jpg voorbeeld script.jpg (59.8 KB, 16 views)
Reply With Quote
  #2  
Old 16th May 2014, 13:57
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,272
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Use this:-

Code:
db.set.to.default(ttccom010)

switch.to.company(target_comp)
db.set.retry.point()

select tccom010.*
from   tccom010 for update
as set with 1 rows
selectdo
....
...
...
db.update()
endselect

commit.transaction()

OR

Code:

db.set.retry.point()
db.set.to.default(ttccom010)
select tccom010.*
from   tccom010 for update
where tccom010._compnr = :target_comp
as set with 1 rows
selectdo
....
...
...
db.update()
endselect

commit.transaction()
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
Sponsored Links
  #3  
Old 20th May 2014, 15:03
Rickman's Avatar
Rickman Rickman is offline
Junior Member
 
Join Date: Sep 2005
Posts: 16
Rickman is on a distinguished road
Baan: BaaNIVc4 - DB: SQL - OS: NT
It is not working

No matter which way I try, it is not working.

Maybe i't will be more clear if I attach the whole script.

The script is creating debtors, based on records in pampa003
The value of pampa002.ctpc of the first record is "015", so according the case statement the target_comp = 212. The first record is processed the way it should be (a debtor is created in company 212). The second record has a pampa002.ctpc value of "016", the target_comp is set to 118. But during the update in table tccom010 (after function 'switch.to.├žompany'
the record is inserted in company 212 instead of company 118.

That's the problem.
Attached Files
File Type: txt script aanmaken debiteuren.txt (4.8 KB, 17 views)
Reply With Quote
  #4  
Old 20th May 2014, 15:22
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,272
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi,

Check whether field pampa002.ctpc is added in Report Input Fields. Also check all other fields which you are using in your report script.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #5  
Old 20th May 2014, 17:35
vamsi_gujjula's Avatar
vamsi_gujjula vamsi_gujjula is offline
Senior Member
 
Join Date: Nov 2011
Location: hyderabad ; india
Posts: 240
vamsi_gujjula is on a distinguished road
Baan: ERPLN fp3 and 10.4 - DB: oracle - OS: Aix , Redhat linux 6
i would recommend .. to debug the report script

Moreover i would prefer using compnr.check with if else

if compnr.check (target.comp) then
.... do xyz
else
error while switching
endif
__________________
Regards,
Vamsi
Reply With Quote
  #6  
Old 20th May 2014, 20:06
JaapJD's Avatar
JaapJD JaapJD is offline
Guru
 
Join Date: Sep 2002
Location: Netherlands
Posts: 721
JaapJD will become famous soon enoughJaapJD will become famous soon enough
Baan: BaanIV, BaanERP, ERP LN 6.1 - DB: Oracle, SQL Server - OS: Unix, Windows
Ensure that the package combinations of 118 and 212 are equal to your current package combination. Probably 212 is, but 118 is not. If you check the return value of switch.to.company, you will see it failing.
Note that you can use different package combinations, but the data model (tables, domains, CDF, timestamps, MLE) need to be the same.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AFS and switch.to.company Juergen AFS/DDC/OLE: Function servers 12 24th May 2005 16:19
switch.to.company & return values zamarlab Tools Development 2 14th January 2004 15:29
switch.to.company and VB zamarlab AFS/DDC/OLE: Function servers 4 18th December 2003 11:55
switch.to.company pparamo Tools Development 2 15th January 2003 23:44


All times are GMT +2. The time now is 02:33.


©2001-2017 - Baanboard.com - Baanforums.com