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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Job to check the offset set account name

(0) ShareShare
ReportReport
Posted on by 371

Want to know that can we find the the offset account name to write a job in ax 2012

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    faheem Ahmed Profile Picture
    450 on at

    What’s the context means if you are fetching data from LedgerJournalTrans there is display method offsetAccountName you can use that.

  • CU02060633-1 Profile Picture
    371 on at

    actualy i want to write a job in that the offset account is ledger want to know the ledger account number using particular voucher number

  • Suggested answer
    faheem Ahmed Profile Picture
    450 on at

    this will help

    sumitsaxfactor.wordpress.com/.../getting-ledger-transactions-in-ax-2012

  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi Vinay Tak,

    Please be aware that there is no single offset account and consequently no single offset account name, as AX allows recording m:n vouchers.

    As an example: debiting two accounts that credit seven accounts is a valid transaction in AX. For that reason you must specify first what your 'account' and 'offset account' is.

    Otherwise, you might get into trouble when you apply your job to more complex transactions that are created for example when creating production postings, foreign currency revaluation postings and alike.

    Best regards,

    Ludwig

  • CU02060633-1 Profile Picture
    371 on at

    i have written a code in that it show the main account name i want buiness unit and epartment name also

    static void To_get_offset_accountname_bank(Args _args)

    {

       LedgerJournalTrans                  LedgerJournalTrans;

       DimensionAttributeValuecombination   DimensionAttributeValuecombination;

      /// bankaccounttable                  bankaccounttable;

       BankAccountTrans                    BankAccountTrans;

      MainAccount                            MainAccount;

      GeneralJournalAccountEntry               GeneralJournalAccountEntry;

           while select LedgerJournalTrans where LedgerJournalTrans.Voucher =='GNJL000787'

          join DimensionAttributeValuecombination where DimensionAttributeValuecombination.RecId == LedgerJournalTrans.OffsetLedgerDimension

          join MainAccount where MainAccount.RecId==DimensionAttributeValuecombination.MainAccount

             info(strfmt("%1",mainaccount.Name));

       }

    ledger account number is - 200190-001-022

  • Mea_ Profile Picture
    60,286 on at

    Hey Vinay Tak,

    Take a look at this blog post sumitsaxfactor.wordpress.com/.../getting-individual-dimension-combination-valuesusing-views-ax-2012 it shows how to get individual dimensions from LedgerDimension.

  • CU02060633-1 Profile Picture
    371 on at

    how to ind it by the general vouchr number and 2 nd   thing is that the name of the ledger account number is - 200190-001-022 through  code it have to show

    MainAccount: 200190, Accrued Purchases

    BusinessUnit: 001, Home

    Department: 022, Sales & Marketing

    but the thing is that  it come when i give the hard code of the rech id of this dimensional

    static void getDimensionCombinationValues(Args _args)

    {

       // DimensionAttributeValueCombination stores the combinations of dimension values

       // Any tables that uses dimension  combinations for main account and dimensions

       // Has a reference to this table’s recid

       DimensionAttributeValueCombination  dimAttrValueComb;

       //GeneralJournalAccountEntry is one such tables that refrences DimensionAttributeValueCombination

       GeneralJournalAccountEntry          gjAccEntry;

       // Class Dimension storage is used to store and manipulate the values of combination

       DimensionStorage        dimensionStorage;

       // Class DimensionStorageSegment will get specfic segments based on hierarchies

       DimensionStorageSegment segment;

       int                     segmentCount, segmentIndex;

       int                     hierarchyCount, hierarchyIndex;

       str                     segmentName, segmentDescription;

       SysDim                  segmentValue;

       ;

       //Get one record for demo purpose

       gjAccEntry = GeneralJournalAccountEntry::find(5637720848); //rec id

       setPrefix("Dimension values fetching");

       //Fetch the Value combination record

       dimAttrValueComb = DimensionAttributeValueCombination::find(gjAccEntry.LedgerDimension);

       setPrefix("Breakup for " + dimAttrValueComb.DisplayValue);

       // Get dimension storage

       dimensionStorage = DimensionStorage::findById(gjAccEntry.LedgerDimension);

       if (dimensionStorage == null)

       {

           throw error("@SYS83964");

       }

       // Get hierarchy count

       hierarchyCount = dimensionStorage.hierarchyCount();

       //Loop through hierarchies to get individual segments

       for(hierarchyIndex = 1; hierarchyIndex <= hierarchyCount; hierarchyIndex++)

       {

           setPrefix(strFmt("Hierarchy: %1", DimensionHierarchy::find(dimensionStorage.getHierarchyId(hierarchyIndex)).Name));

           //Get segment count for hierarchy

           segmentCount = dimensionStorage.segmentCountForHierarchy(hierarchyIndex);

           //Loop through segments and display required values

           for (segmentIndex = 1; segmentIndex <= segmentCount; segmentIndex++)

           {

               // Get segment

               segment = dimensionStorage.getSegmentForHierarchy(hierarchyIndex, segmentIndex);

               // Get the segment information

               if (segment.parmDimensionAttributeValueId() != 0)

               {

                   // Get segment name

                   segmentName = DimensionAttribute::find(DimensionAttributeValue::find(segment.parmDimensionAttributeValueId()).DimensionAttribute).Name;

                   //Get segment value (id of the dimension)

                   segmentValue        = segment.parmDisplayValue();

                   //Get segment value name (Description for dimension)

                   segmentDescription  = segment.getName();

                   info(strFmt("%1: %2, %3", segmentName, segmentValue, segmentDescription));

               }

           }

       }

    }

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans