AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 14.04.2015, 21:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
emeadaxsupport: Calling the BudgetTransactionService on AX 2012
Источник: http://blogs.msdn.com/b/axsupport/ar...n-ax-2012.aspx
==============

We recently had a request for an example of how to call the BudgetTransactionService AIF create operation which allows you to created budget register entries.

Setup: Create an inbound AIF port using the first 10 steps (Setup with AX) from the Budget entries import in AX2012 (http://blogs.msdn.com/b/axsupport/ar...in-ax2012.aspx) to create a NetTcp AIF inbound port. Create a new C# console application project in Visual Studio, adding a service reference to the AIF inbound port you created. My project was named BudgetTransactionServiceExample and my service reference was named BudgetService. The following code creates one register for FY2015 with one budget line, including only the required fields.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// Add a using statement for the service reference.
using BudgetTransactionServiceExample.BudgetService;

namespace BudgetTransactionServiceExample
{
class Program
{

static void Main(string[] args)
{
// Calling the create operation.
CreateOperation();
}

private static void CreateOperation()
{
// Instantiate an instance of the service client class.
BudgetTransactionServiceClient service = new BudgetTransactionServiceClient();

CallContext context = new CallContext();
context.Company = "usmf";

// Create an instance of the document class.
AxdBudgetTransaction bTran = new AxdBudgetTransaction();

// Create instances of the entities that are used in the service and
// set the needed fields on those entities.
AxdEntity_BudgetTransHeader bHeader = new AxdEntity_BudgetTransHeader();
bHeader.BudgetModelId = "FY2015";
bHeader.BudgetTransactionCode = "Original Budget";
bHeader.PrimaryLedger = "usmf";

AxdType_DimensionAttributeValue dimVal = new AxdType_DimensionAttributeValue();
dimVal.Name = "MainAccount";
dimVal.Value = "401100";

AxdType_BudgetAccount bAccount = new AxdType_BudgetAccount();
bAccount.DisplayValue = "Manufacturing Profit and Loss";
bAccount.AccountStructure = "Manufacturing P&L";

AxdEntity_BudgetTransLine bLine = new AxdEntity_BudgetTransLine();
bLine.TransactionCurrency = "USD";
bLine.LedgerDimension = bAccount;

// Add the sub-entity instances to their parent entities as an array
// of the sub-entity type.
bAccount.Values = new AxdType_DimensionAttributeValue[1] { dimVal };
bHeader.BudgetTransLine = new AxdEntity_BudgetTransLine[1] { bLine };
bTran.BudgetTransHeader = new AxdEntity_BudgetTransHeader[1] { bHeader };

try
{
// Call the create method on the service passing in the document.
var ret = service.create(context, bTran);

// The create method returns an EntityKey which contains the IDs for the budget register.
Console.WriteLine("Create successful. {0}:{1} {2}:{3}", ret[0].KeyData[0].Field, ret[0].KeyData[0].Value, ret[0].KeyData[1].Field, ret[0].KeyData[1].Value);
}
catch (Exception e)
{
Console.WriteLine("Create failed.");
Console.WriteLine(e.Message);
}
finally
{
Console.ReadLine();
}
}

}
} Notice:

"Microsoft provides programming examples for illustration only, without warranty expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. This mail message assumes that you are familiar with the programming language that is being demonstrated and the tools that are used to create and debug procedures."

This has not been officially tested by Microsoft and should be fully tested before implementation.




Источник: http://blogs.msdn.com/b/axsupport/ar...n-ax-2012.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: Upgrading from AX 2012 / AX 2012 Feature Pack to AX 2012 R2 Blog bot DAX Blogs 0 22.12.2012 03:14
emeadaxsupport: Calling the FinancialDimensionValidation Service in AX 2012 Blog bot DAX Blogs 0 22.11.2012 07:11
emeadaxsupport: Preliminary Microsoft Dynamics AX 2012 R2 content now on TechNet and MSDN! Blog bot DAX Blogs 0 10.11.2012 08:20
ax-erp: Creating SSRS-Reports in Dynamics AX 2012 – What’s no longer possible in AX-reports Blog bot DAX Blogs 0 18.07.2012 12:11
emeadaxsupport: Calling the HcmWorkerImportService in AX 2012 to Import Employees Blog bot DAX Blogs 0 31.03.2012 00:12
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 16:27.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.