Options

Financial Dimension Journal Line import for Customer/Vendor

TonyHTonyH Member Posts: 223
edited 2012-10-19 in Dynamics AX
Becky Newell has a fantastic blog that has been great in helping me resolve issues around import dimension data into AX 2012 for journal postings.

In this blog ;-

http://blogs.msdn.com/b/axsupport/archi ... -2012.aspx

She gives a great description of how to get the RecID for the associated DimensionAttributeValueCombination record, and this works great for journal lines of type ledger.

Here's an example from a job in the CEU company of the demo AX 2012 database
info(strfmt('%1',AxdDimensionUtil::getLedgerAccountId(['200120-10-06','200120','BusinessUnit','10','CostCenter','06'])));

However I want to import financial dimension for customer and vendor.

I've seen a number of posts vaguely describe using the AxdDimensionUtil::getMultiTypeAccountId method. However I cannot seem to get this to work. If I pass it into the LedgerDimension field of the journal trans it correctly show me the customer account however the dimensions do not come through.

Example again in the CEU company demo AX 2012 database.
info(strFmt('%1',AxdDimensionUtil::getMultiTypeAccountId(enumNum(LedgerJournalACType),LedgerJournalACType::Cust,['2014-10-06','2014','BusinessUnit','10','CostCenter','06'])));

This returns a RecID of 5747269819, which correctly is the customer 2014 but the dimensions are not there, If I change this up (cost center 3 instead of 6) and run it again
info(strFmt('%1',AxdDimensionUtil::getMultiTypeAccountId(enumNum(LedgerJournalACType),LedgerJournalACType::Cust,['2014-10-03','2014','BusinessUnit','10','CostCenter','03'])));
It returns the same RecID 5747269819, so I know for sure that the dimensions I am passing as parameters are not having an impact.
Am I using this function wrong? If so what is the best way to set financial dimension for a journal line when importing Customer or Vendor type accounts?

Comments

  • Options
    HarishHarish Member Posts: 172
    Hi Tony,

    An example below for adding financial dimension for customer -
    localCustTable      = CustTable::find(custAccountNum);
        dimensionSpecifiers = DimensionDefaultingEngine::getDefaultDimensionSpecifiers(localCustTable.DefaultDimension);
        enumerator          = dimensionSpecifiers.getEnumerator();
    
        while (enumerator.moveNext())
        {
            dimensionAttribute  = dimensionAttribute::find(enumerator.currentKey());
            dav                 = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute::findByName(dimensionAttribute.Name), enumerator.currentValue());
            davsStorage.addItem(dav);
        }
    
        dav = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute::findByName('<Financial dimension label'), strUpr(<Financial dimension value>), true, true);
        davsStorage.addItem(dav);
        counterPartyDimension = davsStorage.save();
    
        ttsBegin;
        localCustTable.selectForUpdate(true);
        localCustTable.DefaultDimension = counterPartyDimension;
        localCustTable.update();
        ttsCommit;
    

    Hope this helps.
    Harish Mohanbabu
    Long way to go before I sleep..
  • Options
    TonyHTonyH Member Posts: 223
    Hey Harish,

    Thanks so much for the stub.

    I'll give this a run out for sure, I noticed that you were updating the CustTable DefaultDimension.

    And I didn't really explain what I was doing very; I am importing into a journal for master data load. In fact I am importing into the LedgerJournalTrans.

    However I think the principle will still work if I push this into DefaultDimension and OffsetDefaultDimension fields.

    Again, much appreciated

    t
  • Options
    HarishHarish Member Posts: 172
    Hi Tony,

    I didn't realise you are importing journal lines. Like I said, I use the routine I posted only for masters (customers, vendors etc).

    For journals I use 'AxdDimensionUtil::getLedgerAccountId' method which always does the trick for me.
    Harish Mohanbabu
    Long way to go before I sleep..
  • Options
    TonyHTonyH Member Posts: 223
    I feel like I have tried that and its not working

    Let's say for simplicity I import just the customer no., and 1 dimension values into the LedgerJournalTrans.

    Customer No. :- C100
    CostCenter :- ABC

    I build my Dimension Container the same way I do for ledger
    Container dimCon += ['C100-ABC','C100',1,'CostCenter','ABC']
    
    JournalLedgerTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(dimCon));
    

    (code simplified for easy of reading)

    give me an error that "Main Account ID C100 does not exist"

    am I using the function correctly?
  • Options
    HarishHarish Member Posts: 172
    Hi Tim,

    Try this -
    CustNo = 'C100';
    CostCenter = 'ABC';
    RefrecId   recId;
    ;
    dimcon = [strfmt('%1-%2', CustNo, CostCenter), CustNo, 1, 'CostCenter', CostCenter];
    recId = AxdDimensionUtil::getLedgerAccountId(dimcon);
    

    Please let me know how it goes.
    Harish Mohanbabu
    Long way to go before I sleep..
  • Options
    TonyHTonyH Member Posts: 223
    Hey Harish,

    Sorry for the delay in replying.

    I have been trying the method you mentioned, however I get an error that the main account does not exist.

    t
  • Options
    HarishHarish Member Posts: 172
    Hi Tony,

    You receive that error because the framework only expects main accounts.

    Please try using the code snipped I posted on 3rd Oct. Obviously instead of customer table, it has to be ledger journal trans table.
    Harish Mohanbabu
    Long way to go before I sleep..
  • Options
    lallylally Member Posts: 323
    Hi Pioneers,

    I have a question generally importing the master data is Functional consultant job or Technical consultant job ?

    If we need to import the master data like Customer , vendor , Item , Bank , Fixed assest , customer address , vendor address , Global addressess book..............

    a) In each table what are all the fields need to consider ?
    b) what would be sequence to import the data ?
    c) Do i need to use the data scripts or standard Data Migration tool of AX 2009 ?
    d) Is there any MS manual is availble which will explain about the Master data & opening balances migration process ?

    Please clarify my doubts and share your experience.

    Thanks in advance.
    lally
  • Options
    TonyHTonyH Member Posts: 223
    Harish wrote:
    Hi Tony,

    You receive that error because the framework only expects main accounts.

    Please try using the code snipped I posted on 3rd Oct. Obviously instead of customer table, it has to be ledger journal trans table.


    Hey Harish,

    I had used that code and was still getting the same error.
    In the end I engaged a nice gentleman from Fargo and here is the solution
    Container = DimCon;
    DimCon += [DimensionName, DimensionCode];
    DimCon = ConIns(DimCon, 1, int2str(conlen(DimCon)/2));
    DefaultDimensionRecID = AxdDimensionUtil::getDimensionAttributeValueSetId(DimCon);
    

    The RecID can then be passed to the defaultDimension on the LedgerJournalTrans

    So I for an example with dimensions Cost Center and Department
    Container = DimCon;
    DimCon += ['CostCenter','OU_3567'];
    DimCon += ['Deparment','OU_2310'];
    DimCon = ConIns(DimCon, 1, int2str(conlen(DimCon)/2));
    LedgerJournalTrans.DefaultDimension = AxdDimensionUtil::getDimensionAttributeValueSetId(DimCon);
    

    So for the General Journal Line I created regardless of if its a customer or a vendor or bank, that line has the financial dimensions for CostCenter OU_3567, and Department as OU_2310

    Perhaps I was mis-explaining the issue.
  • Options
    TonyHTonyH Member Posts: 223
    lally wrote:
    Hi Pioneers,

    I have a question generally importing the master data is Functional consultant job or Technical consultant job ?

    If we need to import the master data like Customer , vendor , Item , Bank , Fixed assest , customer address , vendor address , Global addressess book..............

    a) In each table what are all the fields need to consider ?
    b) what would be sequence to import the data ?
    c) Do i need to use the data scripts or standard Data Migration tool of AX 2009 ?
    d) Is there any MS manual is availble which will explain about the Master data & opening balances migration process ?

    Please clarify my doubts and share your experience.

    Thanks in advance.

    Hey Lally

    Start here :-

    http://mukesh-ax.blogspot.ca/2012/06/cr ... -2012.html

    Also the developer cookbook for AX 2012 I found useful.

    t
Sign In or Register to comment.