web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Set Default Offset Account Dimension

(0) ShareShare
ReportReport
Posted on by 563

Dear Experts,

I'm beginner developing AX 2012

I create Ledger Journal by X++ code and successfully create new Journal with Line, but can't be posted because default offset dimension is still empty

default-offset-account.PNG

How to set Default Offset Account Dimension through X++?

Thanks in advance

regards,

Bintang

*This post is locked for comments

I have the same question (0)
  • Bintang Profile Picture
    563 on at
    RE: Set Default Offset Account Dimension

    Thank you very much, that's what I need

  • Verified answer
    Sohaib Cheema Profile Picture
    48,554 User Group Leader on at
    RE: Set Default Offset Account Dimension

    There are 4 methods already available on class AxLedgerJournalTrans . find below the use for all of those.

    1) parmLedgerDimension

    Used for Account, usually combination of account and dimensions.

    From UI you can say its left side of your journal line.

    2) parmOffsetLedgerDimension

    Used for Offset Account, usually combination of account and dimensions.

    From UI, you can say its right side of your grid line in journal lines.

    3) parmDefaultDimension

    Used to assign Account Dimension. In technical language this  is called default dimension as we can also see by parameter name.

    From UI point, it is the dimension which you can modify from top of lines of journal.

    4) parmOffsetDefaultDimension

    Used to assign Offset  Account Dimension.

    So, this class AxLedgerJournalTrans  covers all 4 fields, I cannot see which method you are supposing as missing in this class. you can assign any dimensions of journal lines by using above 4 methods.

    Keeping in mind, your 1st screenshot provided, in your initial post, you have to use method #3 or #4. you are trying to add default dimension. Remember there is difference between ledger and default dimensions. AxLedgerJournalTrans   class supports both kind of dimensions.

  • Bintang Profile Picture
    563 on at
    RE: Set Default Offset Account Dimension

    Yes that's right

    If you don't mind , I follow this article to create a journal

    community.dynamics.com/.../x-code-to-create-amp-post-general-journal

    but on that article didn't tell me how to set Default Financial Dimension Offset Account

    do you have any idea?

  • Sohaib Cheema Profile Picture
    48,554 User Group Leader on at
    RE: Set Default Offset Account Dimension

    are you using AxLedgerJournalTrans class?

  • Bintang Profile Picture
    563 on at
    RE: Set Default Offset Account Dimension

    sadly no parmOffsetDefaultDimension on AxLedgerJournalTrans class, that's the reason why I ask a question to the forum :(

    I understand your code is how to get RecId, but I don't know how to set it

    I don't find function to set Default Financial Dimension Offset Account

    If you don't mind , I follow this article to create a journal

    https://community.dynamics.com/ax/b/axaptavsme/archive/2013/09/11/x-code-to-create-amp-post-general-journal

    but on that article didn't tell me how to set Default Financial Dimension Offset Account

  • Sohaib Cheema Profile Picture
    48,554 User Group Leader on at
    RE: Set Default Offset Account Dimension

    Here you go with sample code. get recid  pass it to parmDefaultDimension or pass it to ParmOffsetDefaultDimension

        container   varContainer;
        Counter     varCounter=0;
        RecId       retValueOfDefDimension;
        ;
        
        varContainer = [0];
        
        //assigning one dimension
        varContainer += ["Department","025"];
        varCounter++;//increase on assignmnet of each dimension
        
        //assigning 2nd dimension
        varContainer += ["CostCenter","010"];
        varCounter++;//increase on assignmnet of each dimension
        
        //so on.. you can pass any number of dimensions
        
        //prepare container
        varContainer = conPoke(varContainer,1,varCounter);
        
        //pass continer and get back value generated
        retValueOfDefDimension = AxdDimensionUtil::getDimensionAttributeValueSetId(varContainer);
        
        //display just for demo puprose. in real practice simply assign it to table field(s)
        if(retValueOfDefDimension)
            info(strFmt('You can verify record with RecId %1 in Table DimensionAttributeValueSetItem by filtering on field DimensionAttributeValueSet.',retValueOfDefDimension));    
        


  • Bintang Profile Picture
    563 on at
    RE: Set Default Offset Account Dimension

    if I don't missed something , that article told me how to get RecId or check availability of dimension and Create Ledger Dimension, correct me if I wrong

    Just explain me the code if there is no objection, code like this :

    axLedgerJournalTrans.parmJournalNum(axLedgerJournalTable.ledgerJournalTable().JournalNum); //To set JournalNum
    
    axLedgerJournalTrans.parmTransDate(systemDateGet()); //To set Transaction Date
    
    axLedgerJournalTrans.parmDefaultDimension(AxdDimensionUtil::getDimensionAttributeValueSetId(dimPattern1)); //To set Default Dimension Account
    
    axLedgerJournalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger ); //To Set Offset Account Type
    
    axLedgerJournalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId( offSetPattern)); //To set Offset Ledger Dimension
    
    // Is there any parmDefaultOffsetDimension or other code?

    Sorry If I slow understanding, I'm still beginner and trying to learn and understanding dynamic ax development

  • Sohaib Cheema Profile Picture
    48,554 User Group Leader on at
    RE: Set Default Offset Account Dimension

    you can set value of default dimension or offset default dimension by code.

    as I said you can use AxdDimensionUtil::getDimensionAttributeValueSetId to get recid of combination created.

    Have you seen at URL given to you in my previous reply?

    AxdDimensionUtil::getDimensionAttributeValueSetId will take a parameter from you of type container. in your container, you can pass dimensions.

  • Bintang Profile Picture
    563 on at
    RE: Set Default Offset Account Dimension

    Sorry I don't get it

    Let me try to tell the detail of my step

    The first step I read the Excel File and save it to Temporary Table

    Then, I process it to LedgerJournalTable and LedgerJournalTrans and success

    The Default Offset Account Dimension is still empty, I want to set the Default Offset Account Dimension dynamically based on my data from Excel File

    defDim = [1,"TransactionType", "TOPUP"];
        axLedgerJournalTable.parmDefaultDimension(AxdDimensionUtil::getDimensionAttributeValueSetId(defDim));


    I found this code, but only for set Default Financial Dimension Account

    how about Default Financial Dimension Offset Account? Or I can't set Default Financial Dimension Offset Account by code?

    correct me if I wrong

    Thank you

  • Sohaib Cheema Profile Picture
    48,554 User Group Leader on at
    RE: Set Default Offset Account Dimension

    you can pass a container which will contain collection of your dimensions whichever you want to pass. in your case as I can see from screenshot you have got only a single dimension so you can pass that as single container element while calling the methos of AxdDimensionUtil

    You can find many examples on googling, related to AxdDimensionUtil::getDimensionAttributeValueSetId

    e.g. you can find one here dynamics-resources.com/financial-dimensions-using-x

    Do let us know, if you find it difficult to search.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#1
Guy Terry Profile Picture

Guy Terry 2 Moderator

#1
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans