AX Consulting

Just another site

How to register Item In Ax 2009 code (using X++)

Last days user created transfer Order to transfer Qty from warehouse to new warehouse, but unfortunately the new warehouse not has default location so The QTY already shipped but could not received at new warehouse.


1- Create default location for new warehouse.

2- Assign default location to each line in transfer order by go to Inventory —> registration


3- Set Default location for new warehouse


4- select auto check box

5- Then click post all.

All steps above you have to it for each line in transfer order, so in case you have many transfer orders it will be tuff task.

In that case I have create below job to register items automatically for transfer order

static void InventTransRegistrationFromCode(Args _args)
    InventTransWMS_Register inventTransWMS_register;
    InventTrans             inventTrans ;

    InventDim               inventDim  ;

    TmpInventTransWMS       tmpInventTransWMS;

    inventmovement          movement;
    Common common;
    InventTransferTable     transferTable;
    inventTransferLine      transferLine;
    int                     row;


    while select transferline where Transferline.TransferId == ‘TRO-180587’

        inventtrans = inventtrans::findTransId(transferline.InventTransIdReceive) ;

        if(inventTrans.StatusReceipt == StatusReceipt::Registered)
            continue ;

        inventDim = inventTrans.inventDim();
        if(!(inventdim.InventLocationId == ‘28995’ && inventDim.wMSLocationId == ”))
            continue ;


        tmpInventTransWMS.InventQty = inventTrans.Qty;
        inventDim.wMSLocationId = ’00’;
        tmpInventTransWMS.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;

        Common = inventTrans ;

        movement = InventMovement::construct(common);

        if (movement.newMovement_TransferReceipt())
            movement = movement.newMovement_TransferReceipt();
            movement = movement.newMovement_TransferIssueReceive() ? movement.newMovement_TransferIssueReceive() : movement;
            movement = movement.newMovement_TransferReceipt() ? movement.newMovement_TransferReceipt() : movement;

        inventTransWMS_register = new inventTransWMS_register( movement , tmpInventTransWMS);

        inventTransWMS_register::updateInvent(inventTransWMS_register, tmpInventTransWMS);



Hint: Kindly in case you have comment or alternative solution please added below.

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: