on 01-08-2014 11:46 AM
Hi Guys,
We are building some functionality to import sales orders and deleveries from an other company to a new database.
Now the creating of the sales orders works fine, by using the code below.
Now i'm looking for example code to update the orders the same way.
I found some different ways to do this.
Can anyone tell me what the best option will be to update sales order.
Please provide some example code.
I would also like to know which version of sbo xml syntax to use.
For example
<AdmInfo>
<Object>17</Object>
<Version>2</Version>
</AdmInfo>
<Documents>
<row>
or
<AdmInfo>
<Object>17</Object>
</AdmInfo>
<ORDR>
<row>
Thanks in advance
public static void CreateSalesOrderFromXML(String xmlString, SAPbobsCOM.Company company)
{
company.XMLAsString = true;
company.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode;
int elements = company.GetXMLelementCount(xmlString);
for (int i = 0; i < elements; i++)
{
if (company.GetXMLobjectType(xmlString, i) == BoObjectTypes.oOrders)
{
IDocuments salesOrder = (IDocuments)company.GetBusinessObjectFromXML(xmlString, i);
try
{
Int32 result = 0;
if (!SalesOrderExistsByDocNum(company, salesOrder.DocNum))
result = salesOrder.Add();
if (result != 0)
throw new Exception(company.GetLastErrorDescription());
}
finally
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(salesOrder);
salesOrder = null;
}
}
}
}
Hi William,
The xml schema relates to the Company.XmlExportType property in the DI API. You can use either format you've listed but you need to set the XmlExportType property accordingly (if the format you choose is not the default). More details on the formats can be found in the SDK documentation (look for the BoXmlExportTypes enumeration).
I believe the first syntax is the preferred one for import and export of data (and it's the one used by B1if).
Kind Regards,
Owen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi william,
Regarding the syntax, the easiest is to start by exporting an existing object then to duplicate its header.
A sales order is first a document and the version tag is mandatory. So version 1?
Regards,
Eric
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.