Hi Abu,

I did something similar a while back but found it was easier to implement by 
using the Barcode class.  It already has logic to interpret a barcode scan and 
convert it to an item id and putting the code here makes it work pretty much 
everywhere.  

Below is sample code you can add to the end of Barcode.validateItemBarcode() 
just before the return.
(IS = InventSum,  ID = InventDim)
    

    select IS order by PhysicalInvent desc
      join ID where ID.inventDimId            == IS.InventDimId
                 && ID.InventSerialId         == barCodeString
    {
      item = IS.ItemId;
      dim  = ID.inventDimId;

      fieldItemId = fieldName2Id(buffer.tableId,fieldStr(InventTable,itemId));
      if (fieldItemId)
      {
          buffer.(fieldItemId) = item;
          ret = true;
      }

      if (ID.configId)
      {
          fieldConfigId = 
fieldName2Id(buffer.tableId,fieldStr(ConfigTable,ConfigId));
          if (fieldConfigId)
          {
              buffer.(fieldConfigId) = ID.configId;
              ret = true;
          }
      }

      if (fieldItemId && ID.inventDimId != InventDim::inventDimIdBlank())
      {
          fieldInventDimId = 
fieldName2Id(buffer.tableId,fieldStr(InventDim,inventDimId));
          if (fieldInventDimId)
          {
            if (fieldConfigId)
              buffer.(fieldConfigId) = ID.configId;
            buffer.(fieldInventDimId) = ID.inventDimId;
            ret = true;
          }

          fldToInventDimId = 
fieldName2Id(buffer.tableId,fieldStr(InventJournalTrans, toInventDimId));
          if (fldToInventDimId)
          // initialize the 'to' dimensions from the source dimensions
          {
            ID.InventLocationId = '';  // blank out 'to' whs
            ID.wMSLocationId = '';     // blank our 'to' bin
            buffer.(fldToInventDimId) = InventDim::findOrCreate( ID 
).inventDimId;
          }
      }
    }



Good luck,
Daryl




--- In development-axapta@yahoogroups.com, Åßü Ôwãî§ <abuow...@...> wrote:
>
> Hi,
> 
> I have done customization thru which I am taking input of serial number in
> itemid field and then thru code have replaced itemid with corresponding
> itemid and inventdim id. The customization is running successfully on Sales
> Order and Purchase Order forms but on Transfer orders it is not running
> properly and inventdimid is automatically replaced with default inventdimid.
> 
> When I debugged the code in modified method of ItemId field of Transfer
> orders form I found out that \Classes\FormStringControl\modified method is
> also called soon after this which might be resetting inventdimid.
> 
> I will be very grateful if anyone of you could help me solving this problem.
> 
> Thanks in advance.
> 
> Abu Owais
> 
> 
> [Non-text portions of this message have been removed]
>


Reply via email to