Getting Individual Dimension Combination Values–Using Views [AX 2012]

In my previous post, I had illustrated how we can get individual dimension combination values using DimensionStorage class. In this post, I will provide another job that utilizes a view to get individual values for a ledger dimension.

The view that has been used in DimensionAttributeLevelValueAllView. Here is the job

static void sgxIndividualDimensionValuesUsingView(Args _args)

{

    GeneralJournalAccountEntry          generalJournalAccountEntry; //Table that stores ledger transactions

    DimensionAttributeLevelValueAllView dimAttrView; //View that will display all values for ledger dimensions

    DimensionAttribute                  dimAttr; //Main dimension attribute table

    int i;

   

    setPrefix(‘Ledger dimension breakup’);

    while select generalJournalAccountEntry

    {

        i++;

        if (i > 100)

            break;

       

        setPrefix(int2str(i) + “. “ + DimensionAttributeValueCombination::find(generalJournalAccountEntry.LedgerDimension).DisplayValue);

        while select DisplayValue from dimAttrView   

            where dimAttrView.ValueCombinationRecId == generalJournalAccountEntry.LedgerDimension

            join BackingEntityType from dimAttr

                where dimAttr.RecId == dimAttrView.DimensionAttribute

        {

            switch (dimAttr.BackingEntityType)

            {

                case tableNum(DimAttributeMainAccount):

                    info(strFmt(“Main Account: %1”, dimAttrView.DisplayValue));

                    break;

               

                case tableNum(DimAttributeOMBusinessUnit):

                    info(strFmt(“Business Unit: %1”, dimAttrView.DisplayValue));

                    break;

 

                case tableNum(DimAttributeCustTable):

                    info(strFmt(“Customer: %1”, dimAttrView.DisplayValue));

                    break;

 

                case tableNum(DimAttributeOMDepartment):

                    info(strFmt(“Department: %1”, dimAttrView.DisplayValue));

                    break;

 

                case tableNum(DimAttributeHcmWorker):

                    info(strFmt(“Worker: %1”, dimAttrView.DisplayValue));

                    break;

            }   

        }

    }

   

}

 

Here is the output.

image

Advertisements

4 thoughts on “Getting Individual Dimension Combination Values–Using Views [AX 2012]

  1. Hi Sumit,

    I have a requirement where i need to copy header information to lines while creating the lines

    I have a site and warehouse fields in header.And in the lines i have inventdimid field (which has relation with inventdim)
    .
    While i create lines (using catalog items), i need to

    copy the header site and warehouse to lines. Also when the header inormaion is edited, the same should

    be updated to lines. I need to do this modification in enterprise portal.

    Here the header and lines are related to Purchase requisition.

    I tried to do changes in datasets but iam unable to do this

    Do you have any idea on how this can be acheived

    Thanks in advance

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s