cancel
Showing results for 
Search instead for 
Did you mean: 

Inventory Counting with method GetDataInterfaceFromXMLFile using DIAPI C#

former_member807459
Discoverer
0 Kudos
331

Dear SAP Experts,

Greetings!!!

In our product we are having a SAP B1 connector through which we are connecting to SAP B1 server via DIAPI provided. Currently we have a requirement of connecting to InventoryCountingService & perform the all CRUD operations.

For this we have created a sample request for connecting to SAP B1 server & through which we are now able to create a object of InventoryCounting object using GetDataInterfaceFromXMLFile method. Using which we want to add the data in bulk (Usually which we do in our product.

I am able to generate the object using XML but when I try to add it in SAP B1 it gives the error as,

540020003 - Missing document type

Find the code below & suggest the answer to resolve this issue

static void Main(string[] args)

{

try

{

SAPbobsCOM.Company _company = new SAPbobsCOM.Company();

_company.Server = @"Server Address";

_company.CompanyDB = "sbodemo-us";

_company.UserName = "manager";

_company.Password = "manager";

_company.LicenseServer = "server address:30000";

_company.language = (SAPbobsCOM.BoSuppLangs)

Enum.Parse(typeof(SAPbobsCOM.BoSuppLangs), "ln_English_Gb");

_company.DbServerType = (SAPbobsCOM.BoDataServerTypes)

Enum.Parse(typeof(SAPbobsCOM.BoDataServerTypes), "15");

_company.DbUserName = "sa";

_company.DbPassword = "sa";

int returnVal = _company.Connect();

SAPbobsCOM.CompanyService oCS = (SAPbobsCOM.CompanyService)_company.GetCompanyService();

SAPbobsCOM.InventoryCountingsService oICS = oCS.GetBusinessService(SAPbobsCOM.ServiceTypes.InventoryCountingsService);

SAPbobsCOM.InventoryCounting oIC = oICS.GetDataInterfaceFromXMLFile("c:\\Temp\\Test.xml");

DateTime dt = DateTime.Now;

oIC.CountDate = DateTime.Now;

//This is the error line

SAPbobsCOM.InventoryCountingParams oInventoryCountingParams = oICS.Add(oIC);

}

catch (Exception ex)

{

Console.WriteLine(ex.Message.ToString());

Console.WriteLine(ex.StackTrace.ToString());

}

}

Accepted Solutions (0)

Answers (0)