Wednesday, 9 March 2016

Merging financial dimensions

Merging financial dimensions:


we can merge up to four differ dimension in to one fin dimension.
we need to give priority as per priprity it will merge.

for merging we can use the below class :

DimensionDefaultingService.serviceMergeDefaultDimensions(findim1,findim2,findim3,findim4)



example:

static void Update_FinDimId_PurchaseOrders(Args _args)
{
    PurchLine              PurchLine;
    //int                    length,counter = 0;
    DimensionDefault       defauleDimensionNew,defauleDimensionPurch,defauleDimensionItem,defauleDimensionVend;
    ItemId                 ItemId;
    InventTable            InventTable;

    ttsBegin;
    While select forUpdate PurchLine //where PurchLine.PurchId == "0070027820"
    {
        defauleDimensionPurch = PurchLine.DefaultDimension;
        defauleDimensionItem  = InventTable::find(PurchLine.ItemId).DefaultDimension;
        defauleDimensionVend  = vendtable::find(PurchLine.VendAccount).DefaultDimension;

        //length = strLen(PurchLine.PurchId);
        //If (Length == 8)
        //{
            defauleDimensionNew = DimensionDefaultingService::serviceMergeDefaultDimensions(defauleDimensionPurch,defauleDimensionItem,defauleDimensionVend);
            PurchLine.DefaultDimension = defauleDimensionNew;
            PurchLine.update();
            //counter++;

        //}
    }
    ttsCommit;
    //info(strFmt("%1", counter));

No comments:

Post a Comment