Skip to Content
avatar image
Former Member

SAP Business One - import AlertnativeItem - error

this a code :

--------------------------

try
{
if (Connect() == 0)
{
SAPbobsCOM.CompanyService oCompanyService;
SAPbobsCOM.AlternativeItemsService AltItemsService;
SAPbobsCOM.OriginalItem OriItem;
SAPbobsCOM.OriginalItemParams OriItemParams;
SAPbobsCOM.AlternativeItem AltItem;

//oCompanyService = vCmp.GetCompanyService();
oCompanyService = vCmp.GetCompanyService();

AltItemsService = (SAPbobsCOM.AlternativeItemsService)(oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.AlternativeItemsService));

OriItem = (SAPbobsCOM.OriginalItem)(AltItemsService.GetDataInterface(SAPbobsCOM.AlternativeItemsServiceDataInterfaces.aisOriginalItem));

OriItemParams = (SAPbobsCOM.OriginalItemParams)(AltItemsService.GetDataInterface(SAPbobsCOM.AlternativeItemsServiceDataInterfaces.aisOriginalItemParams));


//'Item A00003
OriItem.ItemCode = "A00003";

// add 1
OriItem.AlternativeItems.Add();
AltItem = OriItem.AlternativeItems.Item(0);
AltItem.AlternativeItemCode = "A00002";
AltItem.MatchFactor = 200;

//OriItemParams = AltItemsService.AddItem(OriItem);

// add 2
OriItem.AlternativeItems.Add();
AltItem = OriItem.AlternativeItems.Item(1);
AltItem.AlternativeItemCode = "A00001";
AltItem.MatchFactor = 400;

// add all
//OriItemParams = AltItemsService.AddItem(OriItem);
OriItemParams = AltItemsService.AddItem(OriItem);

..................................................................................

when i debug a have an error:

‡ System.Exception.Message.get returned "1). [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting the nvarchar value 'A00003\tA00002' to data type int.\n" string

please help

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 28, 2017 at 12:21 PM

    Hi Bogumil,

    It seems that you have something incorrect on your store procedure transaction notification. Try to comment the customize code on your transaction notification and run your code again.

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 28, 2017 at 08:58 AM

    but i woould like to add.

    there is error but 2 items was added. Why is there error ?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 28, 2017 at 01:54 PM

    Iit did not help :(

    Add comment
    10|10000 characters needed characters exceeded