Quantcast
Viewing all articles
Browse latest Browse all 73760

Unable to create Item using AIF

Hi,

I am trying to create Items using AIF-AX2009. The create schema looks like below:

<?xmlversion="1.0"encoding="UTF-8"?>

<Envelopexmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">

  <Header>

    <MessageId>{2002A291-8AA4-4405-BC10-183C30376F26}</MessageId>

    <Action>http://tempuri.org/AWItem2Service/create</Action>

  </Header>

  <Body>

 

    <MessagePartsxmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">

      <AWItem2xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/AWItem2">

        <SenderId>cow</SenderId>

        <InventTableclass="entity">

          <ABCContributionMargin>None</ABCContributionMargin>

          <ABCRevenue>None</ABCRevenue>

          <ABCTieUp>None</ABCTieUp>

          <ABCValue>C</ABCValue>

          <BOMUnitId></BOMUnitId>

          <DimGroupId>Warehouse</DimGroupId>

          <GallonEquivalency>2.5000</GallonEquivalency>

          <grossDepth>0.00</grossDepth>

          <grossHeight>0.00</grossHeight>

          <grossWidth>0.00</grossWidth>

          <ItemGroupId>Bill-Thru</ItemGroupId>

          <ItemId>604025</ItemId>

          <ItemName>PRODUCER'S SPRING WATER           2.5 GA</ItemName>

          <ItemStatusId>New_</ItemStatusId>

          <ItemType>Item</ItemType>

          <ModelGroupId>Bill-Thru</ModelGroupId>

          <NameAlias>04025</NameAlias>

          <NetWeight>1.00</NetWeight>

          <ProdFlushingPrincip>Start</ProdFlushingPrincip>

          <ProfitClass>091</ProfitClass>

          <ProfitSubClass>0</ProfitSubClass>

          <PurchModel>Yes</PurchModel>

          <ReqGroupId>Other</ReqGroupId>

          <SalesModel>None</SalesModel>

          <sortCode>0</sortCode>

          <TaraWeight>0</TaraWeight>

          <UnitVolume>1.00</UnitVolume>

          <UseAltItemId>Never</UseAltItemId>

          <Salesclass="entity">

            <ItemId>604025</ItemId>

            <Markup>0</Markup>

            <ModuleType>Sales</ModuleType>

            <OverDeliveryPct>5</OverDeliveryPct>

            <Price>0</Price>

            <PriceDate>2012-12-13</PriceDate>

            <PriceQty>0</PriceQty>

            <PriceUnit>1</PriceUnit>

            <UnderDeliveryPct>0</UnderDeliveryPct>

            <UnitId>GA</UnitId>

          </Sales>

          <Purchclass="entity">

            <ItemId>604025</ItemId>

            <Markup>0</Markup>

            <ModuleType>Purch</ModuleType>

            <OverDeliveryPct>10</OverDeliveryPct>

            <Price>0</Price>

            <PriceDate>2012-12-13</PriceDate>

            <PriceQty>0</PriceQty>

            <PriceUnit>1</PriceUnit>

            <UnderDeliveryPct>0</UnderDeliveryPct>

            <UnitId>GA      </UnitId>

          </Purch>

          <Inventclass="entity">

            <ItemId>604025</ItemId>

            <Markup>0</Markup>

            <ModuleType>Invent</ModuleType>

            <OverDeliveryPct>15</OverDeliveryPct>

            <Price>0</Price>

            <PriceDate>2012-12-13</PriceDate>

            <PriceQty>0</PriceQty>

            <PriceUnit>1</PriceUnit>

            <UnderDeliveryPct>0</UnderDeliveryPct>

            <UnitId>GA      </UnitId>

          </Invent>

          <InventItemLocationclass="entity">

            <inventDimId>AXAPTA</inventDimId>

            <ItemId>604025</ItemId>

            <InventDimclass="entity">

              <inventDimId>AXAPTA</inventDimId>

              <InventLocationId>Dairy</InventLocationId>

            </InventDim>

          </InventItemLocation>

          <InventTxtclass="entity">

            <InventDimId>AXAPTA</InventDimId>

            <ItemId>604025</ItemId>

            <LanguageId>en-us</LanguageId>

          </InventTxt>

          <InventTableDocuRefclass="entity"></InventTableDocuRef>

          <InventItemSalesSetupclass="entity">

            <InventDimId>AXAPTA</InventDimId>

            <InventDimIdDefault>AXAPTA</InventDimIdDefault>

            <ItemId>604025</ItemId>

            <LowestQty>2.5</LowestQty>

            <MultipleQty>002</MultipleQty>

            <Stopped>Yes</Stopped>

            <InventDimSalesSetupclass="entity"></InventDimSalesSetup>

            <DefaultInventDimSalesSetupclass="entity">

              <inventDimId>AXAPTA</inventDimId>

              <InventLocationId>Dairy</InventLocationId>

            </DefaultInventDimSalesSetup>

          </InventItemSalesSetup>

          <InventItemPurchSetupclass="entity">

            <InventDimId>AXAPTA</InventDimId>

            <InventDimIdDefault>AXAPTA</InventDimIdDefault>

            <ItemId>604025</ItemId>

            <LowestQty>2.5     </LowestQty>

            <MultipleQty>002</MultipleQty>

            <Stopped>Yes</Stopped>

            <InventDimPurchSetupclass="entity">

              <inventDimId>AXAPTA</inventDimId>

              <InventLocationId>Dairy</InventLocationId>

            </InventDimPurchSetup>

            <DefaultInventDimPurchSetupclass="entity">

              <inventDimId>AXAPTA</inventDimId>

              <InventLocationId>Dairy</InventLocationId>

            </DefaultInventDimPurchSetup>

          </InventItemPurchSetup>

          <InventItemInventSetupclass="entity">

            <InventDimId>AXAPTA</InventDimId>

            <InventDimIdDefault>AXAPTA</InventDimIdDefault>

            <ItemId>604025</ItemId>

            <LowestQty>2.5     </LowestQty>

            <MultipleQty>002</MultipleQty>

            <StandardQty>002</StandardQty>

            <Stopped>Yes</Stopped>

            <InventDimInventSetupclass="entity">

              <inventDimId>AXAPTA</inventDimId>

              <InventLocationId>Dairy</InventLocationId>

            </InventDimInventSetup>

            <DefaultInventDimInventSetupclass="entity">

              <inventDimId>AXAPTA</inventDimId>

              <InventLocationId>Dairy</InventLocationId>

            </DefaultInventDimInventSetup>

          </InventItemInventSetup>

          <InventItemBarcodeclass="entity">

            <BarcodeSetupId>GTIN</BarcodeSetupId>

            <Description>00078255030257</Description>

            <InventDimId>AXAPTA</InventDimId>

            <ItemBarCode>00078255030257</ItemBarCode>

            <ItemId>604025</ItemId>

          </InventItemBarcode>

        </InventTable>

      </AWItem2>

    </MessageParts>

  </Body>

</Envelope>

 

First error I was getting is, runtime error in AXInventTableModule.Save(). Code looks as below

public void save()
{
;

axInventTable.save();
}

I was getting axInventTable object not initialized. As suggested in some of the blogs, I have commented the line and added super().

 Run time error is resolved and now I am geeting record already exists error for InventTableModule. 

During the deserialize of InventTable, AXInventTable/Write is being called. Code looks as below.

protected void write()
{
    super();

    axInventTableModule_Sales.write();
    axInventTableModule_Invent.write();
    axInventTableModule_Purch.write();
    axInventItemLocation.write();

}

 

 

 

 Because of the highlighted code, a record is being created in AXInventTableModule with ModuleType as sales, purch and invent respectively.

But, When the sub entity, <Salesclass="entity"> is being deserialized, and trying to create a record, an error is thrown saying record already exists for item id xxx, module sales as it was aleady created due to a call in AXInventTable.write(). 

 Similarly, it is happenig for InventItemLocation, as InventTable.Insert() creating a default record in InventItemLocation.

 

 Can anyone please suggest the solution or a workaround for this?

 

Regards,

Gopala Krishna.M

 


Viewing all articles
Browse latest Browse all 73760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>