View Single Post
  #1  
Old 14th July 2017, 12:37
bansaanu bansaanu is offline
Member
 
Join Date: Mar 2010
Posts: 67
bansaanu is on a distinguished road
Baan: BaaN IV and ERP - DB: Oracle - OS: Unix and Window
XML File Parsing

Hi,

I have following structure of the xml file:



Code:
<?xml version="1.0" encoding="UTF-8"?>
<SyncMaterialIssue1 xmlns="http://schema.infor.com/InforOAGIS/2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" releaseID="2" xsi:schemaLocation="http://schema.infor.com/2.13.x/InforOAGIS http://schema.infor.com/2.13.x/InforOAGIS/BODs/SyncMaterialIssue1.xsd">
   <ApplicationArea>
      <Sender>
         <LogicalID>lid://infor.ln.dev-ln-900</LogicalID>
         <ComponentID>erp</ComponentID>
         <ConfirmationCode>OnError</ConfirmationCode>
      </Sender>
      <CreationDateTime>2017-07-13T14:26:52Z</CreationDateTime>
      <BODID>infor-nid:infor:900:S_900:MN0000001:?MaterialIssue1&amp;verb=Sync</BODID>
   </ApplicationArea>
   <DataArea>
      <Sync>
         <TenantID>infor</TenantID>
         <AccountingEntityID>900</AccountingEntityID>
         <LocationID>S_900</LocationID>
         <ActionCriteria>
            <ActionExpression actionCode="Change" />
         </ActionCriteria>
      </Sync>
      <MaterialIssue1>
         <ProductionOrderNumber variationID="25">MN0000001</ProductionOrderNumber>
         <Lines>
            <Item>KSRMFG002-R</Item>
            <EstimatedQuantity>1</EstimatedQuantity>
            <Operation>10</Operation>
         </Lines>
         <Lines>
            <Item>KSRMFG002-R</Item>
            <EstimatedQuantity>0</EstimatedQuantity>
            <Operation>20</Operation>
         </Lines>
         <Lines>
            <Item>KSRMFG002-R</Item>
            <EstimatedQuantity>0</EstimatedQuantity>
            <Operation>30</Operation>
         </Lines>
         <Lines>
            <Item>KSRMFG002-R</Item>
            <EstimatedQuantity>0</EstimatedQuantity>
            <Operation>40</Operation>
         </Lines>
      </MaterialIssue1>
   </DataArea>
</SyncMaterialIssue1>



I want to read this file so that it reads all production orders and lines under each one of them. I have following code to read the same:


Code:
long ret_val,ret_val2, ret_val3, savepono, ret
domain    tcmcs.str50    savepdno,saveitem,saveqnty


ret_val =  xmlFindFirst  ("ProductionOrderNumber", i.request)
ret_val2 =  xmlGetDataElement(ret_val, "ProductionOrderNumber",savepdno)

ret_val3 = xmlGetRightSibling(ret_val)

select Max(ticst001.pono):savepono
from ticst001
where ticst001._index1 = {:savepdno}
selectdo
endselect

while ret_val3 <> 0
ret_val2 =  xmlGetDataElement(ret_val, "Item",saveitem)
ret_val2 =  xmlGetDataElement(ret_val, "Quantity",saveqnty)
savepono = savepono + 10
dal.new.object("ticst001")
dal.set.field("ticst001.pdno", savepdno)
dal.set.field("ticst001.pono", savepono)
dal.set.field("ticst001.sitm", saveitem)
dal.set.field("ticst001.ques", val(saveqnty))
dal.set.field("ticst001.opno", 10)
ret = dal.save.object("ticst001")

if ret = 0 then
    commit.transaction()
else
    abort.transaction()
endif
ret_val3 = xmlGetRightSibling(ret_val3)
endwhile
But system is not reading ProductionOrderNumber element at all. Also, can you please verify if rest of the other code is fine as well? Can you please suggest if you find any issue?


Thanks,
Anubhav

Last edited by bhushanchanda : 17th July 2017 at 11:25. Reason: added code tags
Reply With Quote