Wednesday, April 1, 2015

Vendor Payment Journal using X++ in AX 2012

static void  VendPaymJournalCreate(Args _args)
{
    LedgerJournalTable jourTable;
    LedgerJournalTrans jourTrans;
    LedgerJournalTableData jourTableData;
    LedgerJournalTransData jourTransData;
    LedgerJournalStatic jourStatic;
    DimensionDynamicAccount ledgerDim;
    DimensionDynamicAccount offsetLedgerDim;

ttsBegin;
    ledgerDim = DimensionStorage::getDynamicAccount(
    '1002',
    LedgerJournalACType::Vend);
    offsetLedgerDim = DimensionStorage::getDynamicAccount(
    'USMF OPER',
    LedgerJournalACType::Bank);

    jourTableData = JournalTableData::newTable(jourTable);
    jourTable.JournalNum = jourTableData.nextJournalId();
    jourTable.JournalType = LedgerJournalType::Payment;
    jourTable.JournalName = 'VendPay';
    jourTableData.initFromJournalName(
    LedgerJournalName::find(jourTable.JournalName));
    jourStatic = jourTableData.journalStatic();
    jourTransData = jourStatic.newJournalTransData(
    jourTrans,
    jourTableData);
    jourTransData.initFromJournalTable();

    jourTrans.CurrencyCode ='USD';
    jourTrans.initValue();
    jourTrans.TransDate = systemDateGet();
    jourTrans.AccountType = LedgerJournalACType::Vend;
    jourTrans.LedgerDimension = ledgerDim;
    jourTrans.Txt = 'Vendor payment journal demo';
    jourTrans.OffsetAccountType = LedgerJournalACType::Bank;
    jourTrans.OffsetLedgerDimension = offsetLedgerDim;
    jourTrans.AmountCurDebit = 1000;
    jourTransData.create();
    jourTable.insert();
    ttsCommit;
    info(strFmt(
    "Journal '%1' has been created", jourTable.JournalNum));

}

9 comments:

  1. Hi eshant,
    i am not getting the reference to the class LedgerJournalTransData mentioned in your code. Can you please check it.

    ReplyDelete
    Replies
    1. Hi Manmohan,
      Please check the below link to understand the code
      http://daxingwitheshant.blogspot.in/2015/04/creating-payment-journal-using-x-in-ax.html?m=1

      Delete
    2. Hi Manmohan,
      Please check the below link to understand the code
      http://daxingwitheshant.blogspot.in/2015/04/creating-payment-journal-using-x-in-ax.html?m=1

      Delete
    3. In D365 F AND O Microsoft Update Remove LedgerJournalTransData
      this class and also remove Account and OffsetAccount from Trans Table... and if you try DimensionStorage::getDynamicsAccount method to get LedgerDimension then also you will get the error becouse it is also remove......
      you can try this way i tried this and it is working fine in D365
      https://d365code.blogspot.com/p/creating-vendor-payment-journal-using-x.html

      Enjoy....

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me. 소액결제 현금화

    ReplyDelete
  5. https://www.youtube.com/playlist?list=PLWSxgDbjVWTjxvgnaAZ0iK8o5dYHAYhrq

    Collection of Microsoft ERP Clips || ERP Licensing, Technical, Functional ,Manager Learning Videos Listing

    ReplyDelete
  6. 휴대폰 정보이용료 현금화는, 휴대폰의 정보이용료 한도를 이용해서 어플 및 영화 등 모바일 콘텐츠를 결제하여 현금화 하는 것을 정보이용료 현금화라고 합니다. 정보이용료 현금화

    ReplyDelete

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...