Re: [development-axapta] switching companies in Axapta with X++ - Error

2008-12-10 Thread Setiaji Kurniawan
Yes, thats correct, all variable must be set to null everytime you 
change the company.

For example :
changecompany(abc)
{
  salestable = null;
}

- setiaji -

mudit mittal wrote:
 
 
 Make sure all buffers used inside changecompany are initialized to null.
  
 Changecompany(abc)
 {
 salesTable =
 }


Re: [development-axapta] switching companies in Axapta with X++ - Error

2008-12-09 Thread mudit mittal
Make sure all buffers used inside changecompany are initialized to null.
 
Changecompany(abc)
{
salesTable = 
}

--- On Tue, 10/14/08, eldj_joax [EMAIL PROTECTED] wrote:

From: eldj_joax [EMAIL PROTECTED]
Subject: [development-axapta] switching companies in Axapta with X++ - Error
To: development-axapta@yahoogroups.com
Date: Tuesday, October 14, 2008, 11:20 PM






I am trying to switch between companies for a special report in AX 
4.0 SP2. 

I try to change to one of the 12 companies. I am able to change with 
the first 2 companies, but with the third one, for some reason, I am 
getting the following error information:

Unable to change company for Sales orders (SalesTable) .
The buffer contains a record which has been selected from the 
original company.

The company ID I am using to change companies is fetched from the 
table VirtualDataAreaList so I am sure it is part of a virtual 
company and also a valid CompanyID.

Help please!

 














  

[Non-text portions of this message have been removed]



RE: [development-axapta] switching companies in Axapta with X++ - Error

2008-10-16 Thread Murat Bal
You writing two metot .

 

First Metod calling  second method.

And second method is creating  new sales table J

For example my code

 

And you must Look  for virtual  company  !qdataarea.isVirtual 

See you 

Murat  Bal

 

 

First method code 

 

static void LedgerDataAreaUpdateWhile(Ledgertable  _Ledgertable)

{

dataarea   qdataarea;

DataAreaIdeskiDataArea;

Ledgertable TLedgertable ;

LedgerTableInterval  sLedgerTableInterval, tLedgerTableInterval;

recid hedefrecid;

;

eskiDataArea = companyinfo::find().dataAreaId;

while select qdataarea where qdataarea.Id !=
companyinfo::find().KonsilideSirket 

 qdataarea.Id != curext() 

 !qdataarea.isVirtual

{

 

entegrasyon::LedgerDataAreaUpdate(_Ledgertable,qdataarea);

 

}

}

 

Second method code

static void LedgerDataAreaUpdate(Ledgertable  _Ledgertable,DataArea
_DataArea)

{

  Ledgertable TLedgertable ;

   LedgerTableInterval  sLedgerTableInterval, tLedgerTableInterval;

 recid hedefrecid;

   ;

 

 

//öncelikle hedefte mevcut mu ya bakýcaz

changeCompany(_DataArea.Id)

{

Select ForUpdate TLedgertable

  where TLedgertable.Accountnum ==
_Ledgertable.Accountnum

   TLedgertable.dataAreaId == _DataArea.Id;

if (TLedgertable )

{

ttsbegin;

buf2buf (_Ledgertable,TLedgertable);

TLedgertable.update();

 accountRecId uyumsuzluðu nedeniyle interval kayýtlarý
silinip yeniden oluþturulacak

if (TLedgertable.AccountPlType == LedgerAccountType::sum)

{

while select forupdate TLedgerTableInterval

where TLedgerTableInterval.AccountRecID ==
TLedgertable.RecId 

   TLedgerTableInterval.dataAreaId ==
_DataArea.Id

{

 TLedgerTableInterval.delete();

}

}

ttscommit;

}

hedefrecid = TLedgerTable.RecId;

}

/ alt kayýtlarý yeniden ekleyelim. 

if (_Ledgertable.AccountPlType == LedgerAccountType::sum)

{

while select forupdate sLedgerTableInterval

where  sLedgerTableInterval.AccountRecID ==
_Ledgertable.RecId {

changeCompany(_DataArea.Id)

{

TLedgerTableInterval.selectForUpdate(True);

Buf2Buf(sLedgerTableInterval,TLedgerTableInterval);

TLedgerTableInterval.AccountRecID = hedefrecid;

TLedgerTableInterval.insert();

}

}

}

 

}

 

From: development-axapta@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Dahlsgaard Jan
Sent: Wednesday, October 15, 2008 11:27 AM
To: development-axapta@yahoogroups.com
Subject: SV: [development-axapta] switching companies in Axapta with X++ -
Error

 

Try null-ing the table-buffer: salestable=null before you change company.



Fra: development-axapta@yahoogroups.com
mailto:development-axapta%40yahoogroups.com
[mailto:development-axapta@yahoogroups.com
mailto:development-axapta%40yahoogroups.com ] På vegne af eldj_joax
Sendt: 14. oktober 2008 19:51
Til: development-axapta@yahoogroups.com
mailto:development-axapta%40yahoogroups.com 
Emne: [development-axapta] switching companies in Axapta with X++ - Error

I am trying to switch between companies for a special report in AX 
4.0 SP2. 

I try to change to one of the 12 companies. I am able to change with 
the first 2 companies, but with the third one, for some reason, I am 
getting the following error information:

Unable to change company for Sales orders (SalesTable).
The buffer contains a record which has been selected from the 
original company.

The company ID I am using to change companies is fetched from the 
table VirtualDataAreaList so I am sure it is part of a virtual 
company and also a valid CompanyID.

Help please!

[Non-text portions of this message have been removed]

 



[Non-text portions of this message have been removed]




Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/development-axapta/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/




RE: [development-axapta] switching companies in Axapta with X++ - Error

2008-10-15 Thread Malcolm Burtt
Hi

You need to call the clear() method on the SalesTable buffer variable before 
you call the code to change company.

Regards

Malcolm Burtt
Product Development Manager
Touchstone

From: development-axapta@yahoogroups.com [EMAIL PROTECTED] On Behalf Of 
eldj_joax [EMAIL PROTECTED]
Sent: 14 October 2008 18:50
To: development-axapta@yahoogroups.com
Subject: [development-axapta] switching companies in Axapta with X++ - Error


I am trying to switch between companies for a special report in AX
4.0 SP2.

I try to change to one of the 12 companies. I am able to change with
the first 2 companies, but with the third one, for some reason, I am
getting the following error information:

Unable to change company for Sales orders (SalesTable).
The buffer contains a record which has been selected from the
original company.

The company ID I am using to change companies is fetched from the
table VirtualDataAreaList so I am sure it is part of a virtual
company and also a valid CompanyID.

Help please!