Skip to Content
0
Former Member
Nov 20, 2017 at 07:21 AM

Import XML with multiple items using vb.net

271 Views

Hi experts,

I was able to add a single item to SAPB1 via a vb.net using an XML, however, I can't seem to use the same XML structure to add multiple items or even two items, below is TEST 1 and TEST 2, only TEST 1 is added to SAPB1.

 oSO = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
 oSO.Browser.ReadXml("C:\TEMP\sales-order2.xml", 0)
 oSO = oCompany.GetBusinessObjectFromXML("C:\TEMP\sales-order2.xml", 0)
 oCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode
 lRetCode = oSO.Add()
<?xml version="1.0" encoding="UTF-16" ?>
<BOM>
  <BO>
    <AdmInfo>
      <Object>17</Object>
    </AdmInfo>
    <ORDR>
      <row>
        <CardCode>1</CardCode>
        <DocDueDate>20171120</DocDueDate>
        <NumAtCard>344312</NumAtCard> 
       <Comments>
         TEST 1
       </Comments>
      </row>
    </ORDR>
    <RDR1>
      <row>
        <ItemCode>1213</ItemCode>     
        <Quantity>1</Quantity>
      </row>
      <row>
        <ItemCode>2100</ItemCode>     
        <Quantity>1</Quantity>
      </row>
    </RDR1>
    <ORDR>
      <row>
        <CardCode>1</CardCode>
        <DocDueDate>20171120</DocDueDate>
        <NumAtCard>344313</NumAtCard>
        <Comments>
           TEST 2
        </Comments>
      </row>
    </ORDR>
    <RDR1>
      <row>
        <ItemCode>1213</ItemCode>
        <Quantity>1</Quantity>
      </row>
      <row>
        <ItemCode>2100</ItemCode>
        <Quantity>1</Quantity>
      </row>
    </RDR1>
    <OSRI />
    <OIBT />
  </BO>
</BOM>