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)

Inventory Transaction not created for Movement Journal

(0) ShareShare
ReportReport
Posted on by 435

Hi there,

I have uploaded records in movement journal from excel template using X++.

For the first line only its creating inventory transactions, and for remaining lines its not creating inventory transaction lines.

Any suggestion why its not creating invent trans lines. Its complete standard system and no customization done.

Thanks, 

*This post is locked for comments

I have the same question (0)
  • Rustem Galiamov Profile Picture
    8,072 on at
    RE: Inventory Transaction not created for Movement Journal

    Hi, which lines?

  • AhsanZia Profile Picture
    30 on at
    RE: Inventory Transaction not created for Movement Journal

    Hi,

    Can you specify where to add these last 2 lines?

  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at
    RE: Inventory Transaction not created for Movement Journal

    You can mark question as verified if it was helpful.

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at
    RE: Inventory Transaction not created for Movement Journal

    You are welcome!

    Yes, you may do the same, but in transfer journal you should fill inventDimId and ToInventDimId.

  • Mohammed Altaf Profile Picture
    435 on at
    RE: Inventory Transaction not created for Movement Journal

    Thanks @Rustem Galiamov i tried your suggestion its worked for me.

    Do we need to do the same in Transfer Joruanl?

    Thanks.

  • Mohammed Altaf Profile Picture
    435 on at
    RE: Inventory Transaction not created for Movement Journal

    @Crispin John i will try with your suggested link.

    @Rustem, I have added a button on movement journal lines form. and from there i am passing _args.record() to get record id.

    I will try as you suggested and update the result.

    Thanks.

  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at
    RE: Inventory Transaction not created for Movement Journal

    What is InventJournalTrans = _args.record(); mean?

    I think you should initialize InventJournalTrans from InventJournalTable:

    inventJournalTrans.clear();
    inventJournalTrans.initValue();
    inventJournalTrans.initFromInventJournalTable(inventJournalTable);


    and 

    inventJournalTrans.inventMovement().JournalSetQty();
    inventJournalTrans.insert();


  • Mohammed Altaf Profile Picture
    435 on at
    RE: Inventory Transaction not created for Movement Journal

    @Crispin Thank for your reply.

    below is the class method i am using for upload.

    public void movementJournalUpload(Args _args)

    {

       InventJournalTrans          InventJournalTrans;

       InventDim                   InventDim;

       int dec=0, Line=1;

       ItemId                      ItemId;

       InventDimId                 InventDimId;

       BOMQty                      Qty;

       WrkCtrConsumption           WrkCtrConsumption;

       ItemId     UnitId;

       EcoResItemConfigurationName configId;

       ConfigGroupId               ConfigGroupId;

       EcoResItemColorName         InventColorId;

       InventLocationId            InventLocationId;

       EcoResItemStyleName         InventStyleid;

       InventSiteId                InventSiteId;

       EcoResItemSizeName          InventsizeId;

       InventBatchId               InventBatchId;

       InventSerialId              InventSerialId;

       WMSLocationId               WMSLocationId;

       BOMQtySerie                 BOMQtySerie;

       ItemCostPrice               CostPrice;

       CostAmount                  CostAmount;

       TransDate                   TransDate;

       MainAccountNum              offsetAccount;

       int64 st;

       DimensionValue              Department;

       DimensionValue              Project;

       DimensionValue              costCenter;

       container                   offSetPattern;

       InventBatch                 inventBatch;

       InventSerial                inventSerial;

       WMSLocation                 location;

       WMSAisle                    aisle;

       Dialog                      dialog;

       Filename                    filename;

       DialogField                 dialogFilename;

        //To filter the files while selecting

       container conFilter = ["Microsoft Excel 97-2003 Worksheet (.xls)" ,"*.xlsx"];

       //Excel

       SysExcelApplication         application;

       SysExcelWorkbooks           workbooks;

       SysExcelWorkbook            workbook;

       SysExcelWorksheets          worksheets;

       SysExcelWorksheet           worksheet;

       SysExcelCells               cells;

       COMVariantType              type;

       int row=1;

       application = SysExcelApplication::construct();

       workbooks = application.workbooks();

       InventJournalTrans = _args.record();

       dialog = new dialog();

       dialog.caption("select a file");

       dialogFilename = dialog.addField(extendedTypeStr(FilenameOpen));

       //To filter the files while selecting

       dialog.filenameLookupFilter(conFilter);

       dialog.run();

       if(dialog.closedOk())

       {

           filename = dialogFileName.value();

       }

       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++;

           TransDate            = cells.item(row,1).value().date();

           ItemId               = cells.item(row,2).value().bStr();

           InventsizeId         = cells.item(row,3).value().bStr();

           InventColorId        = cells.item(row,4).value().bStr();

           InventStyleid        = cells.item(row,5).value().bStr();

           InventSiteId         = cells.item(row,6).value().bStr();

           InventLocationId     = cells.item(row,7).value().bStr();

           InventBatchId        = cells.item(row,8).value().bStr();

           WMSLocationId        = cells.item(row,9).value().bStr();

           InventSerialId       = cells.item(row,10).value().bStr();

           Qty                  = cells.item(row,11).value().double();

           CostPrice            = cells.item(row,12).value().double();

           CostAmount           = Qty * CostPrice;//cells.item(row,13).value().double();

           offsetAccount        = cells.item(row,14).value().bStr();//cells.item(row,14).value().bStr();

           Department           = cells.item(row,15).value().bStr();

           Project              = cells.item(row,16).value().bStr();

           costCenter           = cells.item(row,17).value().bStr();

           configId             = cells.item(row,18).value().bStr();

           if(InventTable::find(ItemId))

           {

                   InventDim.InventSiteId      = "10";//InventSiteId;

                   InventDim.InventSizeId      = InventsizeId;

                   InventDim.InventColorId     = InventColorId;

                   InventDim.InventLocationId  = InventLocationId;

                   InventDim.wMSLocationId     = WMSLocationId;

                   InventDim.configId          = configId;

                   inventDim = InventDim::findOrCreate(inventDim);

                   InventJournalTrans.InventDimId      = inventDim.inventDimId;

                   InventJournalTrans.TransDate        = TransDate;

                   InventJournalTrans.ItemId           = ItemId;

                   InventJournalTrans.Qty              = Qty;

                   InventJournalTrans.CostPrice        = CostPrice;

                   InventJournalTrans.CostAmount       = decRound(InventJournalTrans.CostPrice * InventJournalTrans.Qty,2);// CostAmount;

                   InventJournalTrans.LineNum          = line;

                   offSetPattern                       = [offsetAccount, offsetAccount, 0];

                   InventJournalTrans.LedgerDimension  = AxdDimensionUtil::getLedgerAccountId(offSetPattern);

                   InventJournalTrans.DefaultDimension = InventTable::find(ItemId).DefaultDimension;//this.getDefaultDimension(Department,"",Project,"",costCenter);

                   InventJournalTrans.insert();

               line++;

           }

           else

           {

               info(strFmt("No Item %1 in AX", ItemId));

           }

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

       }

       while(type != COMVariantType::VT_EMPTY);

       ttsCommit;

       }

       catch

       {

           info(strFmt("Problem with Item %1", ItemId));

       }

       workbooks.close();

       application.quit();

       info("Operation/Processing Completed");

    }

  • Rustem Galiamov Profile Picture
    8,072 on at
    RE: Inventory Transaction not created for Movement Journal

    Hi Mohammed Altaf!

    Try to check InventTransId field value in InventJournalTrans table. If this filed is empty or not?

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
Rahul Shah Profile Picture

Rahul Shah 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans