Thursday, January 5, 2012

Calling the InventTransferJournalService in AX 2012

The following is the code (written by Becky Newel from Microsoft) to call the InventTransferJournalJournalService in AX 2012.

TransferJournalServiceClient client = new TransferJournalServiceClient();
CallContext context = new CallContext();
AxdTransferJournal journal = new AxdTransferJournal();
AxdEntity_InventJournalTable journalHeader = new AxdEntity_InventJournalTable();
AxdEntity_InventJournalTrans inventJournalTrans = new AxdEntity_InventJournalTrans();


journalHeader.JournalNameId = "ITrf";
inventJournalTrans.ItemId = "1000";
context.Company = "ceu";


AxdEntity_InventDimIssue inventDimIssue = new AxdEntity_InventDimIssue();
inventDimIssue.InventSiteId = "2";
inventDimIssue.InventLocationId = "21";
inventJournalTrans.InventDimIssue = new AxdEntity_InventDimIssue[1] { inventDimIssue };


AxdEntity_InventDimReceipt inventDimReceipt = new AxdEntity_InventDimReceipt();
inventDimReceipt.InventSiteId = "1";
inventDimReceipt.InventLocationId = "11";
inventJournalTrans.InventDimReceipt = new AxdEntity_InventDimReceipt[1] { inventDimReceipt };


journalHeader.InventJournalTrans = new AxdEntity_InventJournalTrans[1] {inventJournalTrans };
journal.InventJournalTable = new AxdEntity_InventJournalTable[1] { journalHeader };

 try
{            
           client.create(context, journal);
}
catch (Exception e)
{              
string error = e.Message;
Console.ReadLine();
}


Take Care!

No comments:

Post a Comment

Thank you for your thoughts. Your comment will appear in my blog shortly after review.

Have a great day!