cancel
Showing results for 
Search instead for 
Did you mean: 

diapi update failed from xml.

0 Kudos

i have a xml file which is receiver <PayLoad> segment generated from b1i telegraph.

i want to update corrspoding entry using this xml file by diapi with dotnet.

but it failed. following is my code.

anyone can give me suggestion ?

xml file:

<?xmlversion="1.0"encoding="UTF-16"?>
<BOM>
 <BO>
 <AdmInfo>
 <Object>22</Object>
 <Version>2</Version>
 </AdmInfo>
 <QueryParams>
 <DocEntry>5917</DocEntry>
 </QueryParams>
 <Documents>
 <row>
 <DocEntry>5917</DocEntry>
 <CardCode>S2422</CardCode>
 <NumAtCard>10285810</NumAtCard>
 <DocDueDate>20170905</DocDueDate>
 <Confirmed>tYES</Confirmed>
 <Comments>hello world</Comments>
 </row>
 </Documents>
 <Document_Lines>
 <row>
 <LineNum>0</LineNum>
 <ItemCode>4933</ItemCode>
 <Quantity>4710</Quantity>
 </row>
 </Document_Lines>
 </BO>
</BOM>

way 1:

for (int i = 0; i < Company.GetXMLelementCount(FilePath); i++)
                       {
                           var objectType = Company.GetXMLobjectType(FilePath, i);
                           var bo = (Documents)Company.GetBusinessObject(objectType);
                           bo.UpdateFromXML(FilePath);
                       }

way 2:

for (int i = 0; i < Company.GetXMLelementCount(FilePath); i++)
                        {
                            var bo = (Documents)Company.GetBusinessObjectFromXML(FilePath,i);
                            bo.Update();
                        }
former_member185682
Active Contributor
0 Kudos

Hi Eric,

What error did you catch?

Call your update with the following validation:

if (bo.Update() != 0)
{
    MessageBox.Show(Company.GetLastErrorDescription());
}

After this, share your error.

Hope it helps.

Kind Regards,

Diego Lother

0 Kudos

i certainly know how to catch the exception, but still thank you for your answer.

i guess this xml format cannot be processed with default update method of DIAPI.

Accepted Solutions (0)

Answers (0)