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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Inventory dimension identification not specified

(0) ShareShare
ReportReport
Posted on by 1,909

Dears,

I'm trying to import Inventory Transfer journal with below job. But it gives me warning Inventory dimension identification not specified. Please let me know how to solve this issue. 

static void InventoryImportJob(Args _args)
{
   InventJournalTable journalTable;
    InventJournalTrans journalTrans;
    InventJournalTableData journalTableData;
    InventJournalTransData journalTransData;
    InventTable inventTable;
    InventDim locInventDim, _inventDim;

    Counter cnt;
    ItemIdInventoried       Itemid;
    InventSiteId            inventSiteId, toInventSiteId;
    InventLocationId        inventLocationId, toInventLocationId;
    InventBatchId           inventBatchId;
    InventQtyJournal        qty;
    ItemCostPrice           costprice;
    LedgerDimensionDefaultAccount   mainacc;
    str                20     mainaccStr;
    container            offSetEntryPattern;
    LedgerJournalId               JournalId;
    Description BusinessUnit;
    DimensionDefault defaultDim;

    SysExcelApplication             application;
    SysExcelWorkbooks               workbooks;
    SysExcelWorkbook                workbook;
    SysExcelWorksheets              worksheets;
    SysExcelWorksheet               worksheet;
    SysExcelCells                   cells;
    COMVariantType                  type;

    FilenameOpen                    filename;
    dialogField                     dialogFilename;

    Dialog                          dialog;
    Integer                         row = 1;
    int     coun;

    Mainaccount     mainaccount;
    int   _mainaccountnum; //= "111200";//"202000";
    Ledger          ledger;
    CompanyInfo     companyinfo;




    str COMVariant2Str(COMVariant       _cv)
    {
        switch (_cv.variantType())
        {
            case (COMVariantType::VT_BSTR):
                return _cv.bStr();

            case (COMVariantType::VT_R8):
              //  return _cv.toString() ;
                return _cv.bStr() ;
            case (COMVariantType::VT_DATE):
                return date2str(_cv.date(),123,2,1,2,1,4);

            case (COMVariantType::VT_EMPTY):
                return '';

            default:
                throw error(strfmt("@SYS26908", _cv.variantType()));
        }
    }
    ;

    dialog              =   new Dialog('Import Details');
    dialogFilename      =   dialog.addField(ExtendedTypeStr("FilenameOpen"));

    dialog.filenameLookupTitle('Import from excel.');
    dialog.caption('Import From Excel');

    dialogFilename.value(filename);

    if(dialog.run())
    {
        filename            =   dialogFilename.value();

        application         =   SysExcelApplication::construct();
        workbooks           =   application.workbooks();

        try
        {
            workbooks.open(filename);
        }
        catch (Exception::Error)
        {
            throw error('File cannot be opened.');
        }

        workbook            =   workbooks.item(1);
        worksheets          =   workbook.worksheets();
        worksheet           =   worksheets.itemFromNum(1);
        cells               =   worksheet.cells();

        try
        {
            ttsbegin;
            
            do
            {
                row++;
                JournalId = "";
                JournalId    = cells.item(row, 7).value().bStr();
                Select journalTable Where journalTable.JournalId == JournalId ;

            itemId                                  = cells.item(row, 1).value().bStr();
            inventSiteId                            = cells.item(row, 2).value().bStr();
            inventLocationId                        = cells.item(row, 3).value().bStr();
            qty                                     = cells.item(row, 4).value().double();
            toInventSiteId                          = cells.item(row, 5).value().bStr();
            toInventLocationId                      = cells.item(row, 6).value().bStr();



            type = cells.item(row+1, 1).value().variantType();
        

            locInventDim.inventBatchId              = inventBatchId;
            locInventDim.InventSiteId               = inventSiteId;
            locInventDim.InventLocationId           = inventLocationId;
           _inventDim.InventSiteId  = toInventSiteId;
           _inventDim.InventLocationId =  toInventLocationId;

            journalTrans.clear();
            journalTrans.initFromInventJournalTable(journalTable);
            journalTrans.TransDate                  = cells.item(row, 8).value().date();//systemDateGet();
            journalTrans.ItemId                     = itemId;
            journalTrans.JournalId                  = journalTable.JournalId;//JournalId;//

            journalTrans.InventDimId                = InventDim::findOrCreate(locInventDim).inventDimId;
            
            journalTrans.Qty                        = qty;
            

            journalTrans.insert();

            coun++;
            print(coun);
            }
            while (type != COMVariantType::VT_EMPTY);
            info(int2str(coun));
            ttscommit;
            application.quit();
        }
        catch
        {
            throw error('Error in import.');
        }
    }

}


*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at

    I think you should add value to journalTrans.ToInventDimId. I can't see it in your code.

  • Faqruddin Profile Picture
    1,909 on at

    Thanks for your prompt replies. From where I can get the ToInventDimId. InventDim Table has only InventDimId dimension. Please let me know how I can create the ToInventDimId value ?

    journalTrans.InventDimId                = InventDim::findOrCreate(locInventDim).inventDimId;

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Just do the same like with journalTrans.InventDimId.

    You should specify locToInventDim variable and set needed dimensions and then write something like this

    journalTrans.ToInventDimId = InventDim::findOrCreate(locToInventDim).inventDimId;


  • Faqruddin Profile Picture
    1,909 on at

    Thanks. But I have below warning.

    screenshot_5F00_20181129_5F00_140138.jpg

  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Check the values of toInventSiteId and toInventLocationId. And try to debug your code and check all values what you're setting.

  • Rustem Galiamov Profile Picture
    8,072 on at

    Did you solve the issue?

  • Faqruddin Profile Picture
    1,909 on at

    Still I'm working on it.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans