cancel
Showing results for 
Search instead for 
Did you mean: 

GetBusinessObjectFromXML - "No matching records found (ODBC -2028)"

Former Member
0 Kudos

Hi,

I am trying to add the following order using GetBusinessObjectFromXML

<BOM>

<BO>

<AdmInfo>

<Object>17</Object>

</AdmInfo>

<ORDR>

<row>

<DocType>dDocument_Items</DocType>

<DocDate>20060105</DocDate>

<DocDueDate>20060128</DocDueDate>

<CardCode>C40003</CardCode>

<DocTime>1952</DocTime>

<Confirmed>tYES</Confirmed>

<SummryType>dNoSummary</SummryType>

<PartSupply>tYES</PartSupply>

<DiscPrcnt>0.000000</DiscPrcnt>

<ReqDate>20060128</ReqDate>

<CancelDate>20060227</CancelDate>

</row>

</ORDR>

<RDR1>

<row>

<LineNum>0</LineNum>

<ItemCode>S10000</ItemCode>

<Quantity>1.000000</Quantity>

<ShipDate>20050128</ShipDate>

<Price>16000.000000</Price>

<DiscPrcnt>0.000000</DiscPrcnt>

<Commission>10.000000</Commission>

<LineTotal>16000.000000</LineTotal>

</row>

</RDR1>

</BO>

</BOM>

Getting "-2028 : No matching records found (ODBC -2028)". Any ideas?

Thanks in advance.

P.S. I really "love" the DI error messages, they are soooo helpful....NOT!

/Bruno

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

This is what solved it:

_xml.LoadXml(XmlString)
Dim _key As String
SboCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ValidNodesOnly
SboCompany.XMLAsString = True
Dim _sboObjectFromXML As Object
_sboObjectFromXML = SboCompany.GetBusinessObjectFromXML(_xml.OuterXml, 0)
If _sboObjectFromXML.Add() <> 0 Then
    Throw New Exception("Unable to Add object")
Else
    _key = SboCompany.GetNewObjectKey().ToString
End If

And this is the XML:

<?xml version="1.0" encoding="UTF-16"?>

<BOM>

<BO>

<AdmInfo>

<Object>17</Object>

<Version>2</Version>

</AdmInfo>

<Documents>

<row>

<DocType>dDocument_Items</DocType>

<DocDate>20060105</DocDate>

<DocDueDate>20060128</DocDueDate>

<CardCode>C40003</CardCode>

<CardName>Stoneware Systems</CardName>

<Address>39 Gilmore Ave

suite 100

Fairfax VA 38939

USA</Address>

<DocTime>1952</DocTime>

<SalesPersonCode>3</SalesPersonCode>

<TransportationCode>1</TransportationCode>

<DocumentsOwner>4</DocumentsOwner>

<Address2>39 Gilmore Ave

suite 100

Fairfax VA 38939

USA</Address2>

</row>

</Documents>

<Document_Lines>

<row>

<ItemCode>S10000</ItemCode>

<ItemDescription>Server Point 10000</ItemDescription>

<Quantity>12.000000</Quantity>

<ShipDate>20060128</ShipDate>

<Price>16000.000000</Price>

</row>

<row>

<ItemCode>S10000</ItemCode>

<ItemDescription>Server Point 10000</ItemDescription>

<Quantity>2.000000</Quantity>

<ShipDate>20060128</ShipDate>

<Price>17000.000000</Price>

</row>

</Document_Lines>

</BO>

</BOM>

Former Member
0 Kudos

Hi.

I haven`t tried this method.

Maybe try this: (Code in C++)


SAPbobsCOM::IBussinesPartnerPtr BP;
int ret;
long errCode;
BSTR errDesc;
m_cmp->PutBoXmlExportType(xet_ExportImportMode); 
//I don`t remember if this line is like that;
BP = m_cmp->GetBusinessObjectFromXML(FileName);

ret = BP.add();
if (ret!=0)
m_cmp->GetLastError(&errCode, &errDesc);

Try maybe this method ?

Sorry for my english.

Hope it helps.

Kamil Wydra

ret = BP.add(); <- little mistake - should be:

ret = BP->Add();

Message was edited by: Kamil Wydra

AdKerremans
Active Contributor
0 Kudos

Hi Bruno,

Are the cardcode and itemcode valid?

Error -2028 means that one ore more fields are not valid (no reference).

Did you try to add this order though the gui, most time this helps identifying the error.

Regards

Ad

Former Member
0 Kudos

Ad,

Both ItemCode and the CardCode are valid, I tried adding it thru the GUI as well, which worked fine.

/Bruno

AdKerremans
Active Contributor
0 Kudos

HI Bruno,

You could try to remove one field and type, than remove another one and so on, because the error doesn't say enough.

Ad

Former Member
0 Kudos

Hi.

Have You set XmlExportType to xet_ExportImportMode ?

It must be the same type in saving and in loading from XML.

Maybe the problem is with the path of the xml file ?

If that doesn`t solve the problem, can You show me your code ?

Sorry for my english.

Hope it helps.

Kamil Wydra