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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to print Bar Code for Batch number instead of Item number in Ax 2012 R3

(0) ShareShare
ReportReport
Posted on by 4

Hello Guys,

I want to print Bar code  for Batch Number instead of Item number in Ax 2012 R3 .

Is there any option to achieve this ? 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Naveen,

    Not sure if it helps, but for Purchasing - product receipt (stock items) we are using Document Routing/Layouts under Warehouse Management - Setup - Document Routing. We designed our own label  to be printed when the goods arrive on site, including Batch number with bar code etc.

    Regards,

    V

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    I am not sure about the data you want to print, but you can use the following query to display bar code based on batch number along with its associated ItemId.

    static void BarCode(Args _args)
    {
        InventTable inventTable;
        InventItemBarcode inventItemBarCode, barCode;
        InventDim inventDim, dim;
        InventBatch inventBatch;
        
        while select inventItemBarCode
            group by itemBarCode
            join inventDim
            group by inventBatchId
            where inventItemBarCode.inventDimId == inventDim.inventDimId        
        {
            select barCode
                join dim
                where dim.inventDimId == barCode.inventDimId
                && dim.inventBatchId == inventDim.inventBatchId
                && barCode.itemBarCode == inventItemBarCode.itemBarCode; 
                
            info(strFmt("ItemId: %1, batchId: %2, barCode: %3", barCode.itemId, inventDim.inventBatchId, inventItemBarCode.itemBarCode));    
        }
    }
  • SKT Profile Picture
    5 on at

    Hi Chaitanya,

    Interested to know will this query work during product receipt with multiple batch numbers

    Scenario : Barcode for batch number to be generated while product receipt, the steps to follow during product receipt given below

    1. Purchase registration process (registered qty 50 with Batch number 001 and 2nd registered qty is 25 with batch number 002, and 3rd registered qty is 25 with batch number 003)

    2. Checked the print product label field during product receipt

    3. Select the relevant report in the print product label screen

    4. Out of box functionality doesn't show up the batch number in the print screen displayed.

    Would like to know is this query will work while product receipt of purchase order ?

    Did you implemented the query and is that works ?

    Thanks.

  • Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    I don't think we can use this query.Let me check and provide you the updated one.

  • Naveen Mishra Profile Picture
    4 on at

    HI SKT,

    Have you use any query during product receipt with single batch numbers ?

  • Verified answer
    Naveen Mishra Profile Picture
    4 on at

    Hello guys,

    I have done this solution, want to share.

    For print Bar Code for Batch number instead of Item number in we need to create a new method in RetailLabelDP class like below.

    private BarCodeString batchbarCodeStr(InventBatchId _inventBatchId)
    {

    Barcode cBarcode;
    str barcodeString;

    barcodeString=_inventBatchId;

    cBarcode = Barcode::construct(BarcodeType::Code128);

    if (cBarcode.validateBarcode(barcodeString))
    {
    cBarcode.string(true, barcodeString, BarcodeContentType::Item);
    cBarcode.encode();

    RetailTracer::Info('Retail label', funcName(), strFmt('Barcode %1 is validated successfully', barcodeString));
    }
    else
    {
    RetailTracer::Error('Retail label', funcName(), strfmt("@RET5019", barcodeString));
    // When a barcode is not valid, an error should be thrown here
    throw(error(strfmt("@RET5019", barcodeString)));
    }

    return cBarcode.barcodeStr();

    }

    Now Declare InventBatchId iid; and call this method in RetailLabelDP >insertTmpTable like below.

    iid = (select firstOnly inventBatchId from inventBatch order by inventBatchId desc where inventBatch.itemId == _table.ItemId).inventBatchId;

    tmpTable.ItemBarCode = this.batchbarCodeStr(iid);

    Thanks.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans