Thursday, December 18, 2008

Intercompany with buf2buf

Intercompany with buf2buf
When discussing the “Basics of changecompany” we copied table records from one company to another through X++ code. Using buf2buf makes this is a lot easier.
Buf2buf is used to copy one recordbuffer to another:
       buf2buf(Common _from, Common _to)
If we apply this to the code we used in “Basics of changecompany” we get:
 static void FO_changecompany(Args _args)
  {
      FO_TestTable    table, table2;
      ;
 
      while select table
      {
 
          changecompany("FO1")
          {
              table2 = null;
 
              ttsbegin;
 
              buf2buf(table, table2);
              table2.insert();
 
              ttscommit;
          }
      }
  }




No comments:

How to identify the user that was used to change an object from AOT in AX2012

Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...