Skip to Content
0
Former Member
Oct 07, 2008 at 03:55 PM

How to Convert XML data to Internal Table.

17708 Views

Hi,

Can anyone tell me how to convert XML to INTERNAL table.

HERE is the XML which i need to convert into an ABAP table.

I am confused even about the way the structure i have to use.

<?xml version="1.0" encoding="UTF-8" ?> 
- <Status>
  <ErrCode>0</ErrCode> 
  <ErrDesc>OK</ErrDesc> 
  </Status>
  <Cost>10000</Cost> 
  <Currency>GBP</Currency> 
- <Voyage v="1">
 <DEPT>ARREY</DEPT>
- <Passengers>
  <NumAdults>2</NumAdults> 
  <NumSeniors>1</NumSeniors> 
   <NumChildrenC3>1</NumChildrenC3> 
- <Passenger p="1">
  <PList>1</PList> 
  <Type>A</Type> 
  <Title>Mr</Title> 
  <Forename>RAJ</Forename> 
  <Surname>FRN</Surname> 
  <Age>30</Age> 
  <Gender>M</Gender> 
  <Nationality>INR</Nationality> 
- <PassportDetails>
  <Number>2343</Number> 
  <IssuePlace>SDFG</IssuePlace> 
  <IssueDate>34544</IssueDate> 
  <ExpiryDate>345344</ExpiryDate> 
  </PassportDetails>
  <DateOfBirth>19740401</DateOfBirth> 
  <Language>EN</Language> 
- <Address>
  <AddressLine a="1">2 The Avenue</AddressLine> 
  <AddressLine a="2">Oxford</AddressLine> 
  <AddressLine a="3" /> 
  <AddressLine a="4" /> 
  <Postcode>OX1 6AB</Postcode> 
  </Address>
- <Phones>
  <Home>34534</Home> 
  <Fax>345345</Fax> 
  <Mobile>3453453</Mobile> 
  </Phones>
  </Passenger>
  </Passengers>
- <Vehicles>
- <Vehicle v="1">
  <Type>CAR</Type> 
  <MakeModel>Ford Cortina</MakeModel> 
  <RegNum>345345</RegNum> 
  <Length>450</Length> 
  <Height>150</Height> 
  <Width>200</Width> 
  <RoofWidth>190</RoofWidth> 
  <Weight>2000</Weight> 
  <NumAxles>2</NumAxles> 
- <VehPricing>
  <Measure>feet</Measure> 
  <Number>30</Number> 
  </VehPricing>
  <Load>Animals</Load> 
- <Trailer>
  <Type>CRV</Type> 
  <MakeModel>Ifor Williams</MakeModel> 
  <Length>400</Length> 
  <Height>180</Height> 
  <Width>200</Width> 
  <RoofWidth>200</RoofWidth> 
  <Weight>2000</Weight> 
  <NumAxles>1</NumAxles> 
- <TrlPricing>
  <Measure>tons</Measure> 
  <Number>10</Number> 
  </TrlPricing>
  <Load>Animals</Load> 
  </Trailer>
  </Vehicle>
  </Vehicles>
- <Accommodations>
  <Code>A4</Code> 
  <NumItems>1</NumItems> 
  <Desc>4 berth outside cabin</Desc> 
  </Accommodation>
- <AccAllocations>
  <AccAllocation Pax="1" Code="A4" Share="1" Location="201" Cabin="3" Berth="1" /> 
  <AccAllocation Pax="2" Code="A4" Share="1" Location="201" Cabin="3" Berth="2" /> 
  <AccAllocation Pax="3" Code="A4" Share="1" Location="201" Cabin="3" Berth="3" /> 
  </AccAllocations>
  </Accommodations>
  </Voyage>

Regards,

Rajender.