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;

    DataAreaId    eskiDataArea;

    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: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Dahlsgaard Jan
Sent: Wednesday, October 15, 2008 11:27 AM
To: [email protected]
Subject: SV: [development-axapta] switching companies in Axapta with X++ -
Error

 

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

________________________________

Fra: [email protected]
<mailto:development-axapta%40yahoogroups.com>
[mailto:[email protected]
<mailto:development-axapta%40yahoogroups.com> ] På vegne af eldj_joax
Sendt: 14. oktober 2008 19:51
Til: [email protected]
<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/


Reply via email to