Prodataset and reading xml

Posted by derick.dewaal on 03-Aug-2011 05:21

Hi All.

We have issue with the read-xml statement.

When I load the read the xml into the temp tables using the prodataset my last table is empty.

If I however enter line feeds in before the last segment and I save the file and load it again all works fine.

If all else fails I will write a sax parser to load the file.

Any assistance will be appreciated.

Dataset definition

define dataset dsSalesMessage

    for MessageHeaderMsg,

        RecordMsg,

        HeaderMsg,

        ItemMsg,

        TrailerMsg

        data-relation drHeader

            for MessageHeaderMsg,

                RecordMsg

                relation-fields (key,key) nested

        data-relation drHeader

            for RecordMsg,

                HeaderMsg

                relation-fields (Key,key)

        data-relation drLines

            for RecordMsg,

                ItemMsg

                relation-fields (key,key)

        data-relation drTrailer

            for RecordMsg,

                TrailerMsg

                relation-fields (key,key)

        .

Load of dataset

        dataset dsSalesMessage:Read-XML ("file",

                                          w-file,

                                         "empty",

                                          ?,

                                          ?,

                                          ?,     

                                         "loose").

Here is the xml file original and the one I entered the line feed into.

This is the original xml.

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

<ns0:SalesOrderMessage xmlns:ns0="urn:sap.amka.co.za:log:salesorderdelivery">

    <MessageHeaderMsg><DateOfPreparation>20110801</DateOfPreparation><TimeOfPreparation>114829</TimeOfPreparation>

    <PartnerTransmissionNumber>4956145</PartnerTransmissionNumber><SwitchTransmissionNumber>000000000000000008</SwitchTransmissionNumber>

    </MessageHeaderMsg><RecordMsg><HeaderMsg><Delivery_Doc>0080961695</Delivery_Doc><CustomerOrderNr>aneshtest3</CustomerOrderNr>

    <Doc_Creation_Date>20110801</Doc_Creation_Date><Doc_Creation_Time>114829</Doc_Creation_Time><Sales_Org>AMKA</Sales_Org><Created_By>IMRAN</Created_By>

    <Ship_To>305482</Ship_To><Ship_To_Name>JOCK MORRISON MTUBATUBA - 1209</Ship_To_Name><Street>21 MDONI ROAD</Street><City>MTUBATUBA</City><Region>KW</Region>

    <Country>ZA</Country><Shipping_point>0000305482</Shipping_point><Plant>CON</Plant><Storage_location>CON</Storage_location></HeaderMsg>

    <ItemMsg><Item_Number>000010</Item_Number><Material>C7</Material><Shipping_Unit>SK1</Shipping_Unit><Shipping_Qty>       166.000</Shipping_Qty><Sale_Unit>ST</Sale_Unit>

    <Sales_Qty>1000.000</Sales_Qty><Base_unit>ST</Base_unit><Base_Inners>    6</Base_Inners></ItemMsg>

    <ItemMsg><Item_Number>000020</Item_Number><Material>C16</Material><Shipping_Unit>SK1</Shipping_Unit><Shipping_Qty>         2.000</Shipping_Qty>

    <Sale_Unit>SK1</Sale_Unit><Sales_Qty>2.000</Sales_Qty><Base_unit>ST</Base_unit><Base_Inners>    6</Base_Inners></ItemMsg><ItemMsg><Item_Number>000030</Item_Number>

    <Material>C18</Material><Shipping_Unit>SK1</Shipping_Unit><Shipping_Qty>        36.000</Shipping_Qty><Sale_Unit>CSE</Sale_Unit><Sales_Qty>6.000</Sales_Qty>

    <Base_unit>ST</Base_unit><Base_Inners>    6</Base_Inners></ItemMsg><TrailerMsg><NrOfMessageRecords>00000003</NrOfMessageRecords></TrailerMsg></RecordMsg> </ns0:SalesOrderMessage>

Xml after I entered line feeds into the last node.

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

<ns0:SalesOrderMessage xmlns:ns0="urn:sap.amka.co.za:log:salesorderdelivery">

    <MessageHeaderMsg><DateOfPreparation>20110801</DateOfPreparation><TimeOfPreparation>114829</TimeOfPreparation>

    <PartnerTransmissionNumber>4956145</PartnerTransmissionNumber><SwitchTransmissionNumber>000000000000000008</SwitchTransmissionNumber>

    </MessageHeaderMsg><RecordMsg><HeaderMsg><Delivery_Doc>0080961695</Delivery_Doc><CustomerOrderNr>aneshtest3</CustomerOrderNr>

    <Doc_Creation_Date>20110801</Doc_Creation_Date><Doc_Creation_Time>114829</Doc_Creation_Time><Sales_Org>AMKA</Sales_Org><Created_By>IMRAN</Created_By>

    <Ship_To>305482</Ship_To><Ship_To_Name>JOCK MORRISON MTUBATUBA - 1209</Ship_To_Name><Street>21 MDONI ROAD</Street><City>MTUBATUBA</City><Region>KW</Region>

    <Country>ZA</Country><Shipping_point>0000305482</Shipping_point><Plant>CON</Plant><Storage_location>CON</Storage_location></HeaderMsg>

    <ItemMsg><Item_Number>000010</Item_Number><Material>C7</Material><Shipping_Unit>SK1</Shipping_Unit><Shipping_Qty>       166.000</Shipping_Qty><Sale_Unit>ST</Sale_Unit>

    <Sales_Qty>1000.000</Sales_Qty><Base_unit>ST</Base_unit><Base_Inners>    6</Base_Inners></ItemMsg>

    <ItemMsg><Item_Number>000020</Item_Number><Material>C16</Material><Shipping_Unit>SK1</Shipping_Unit><Shipping_Qty>         2.000</Shipping_Qty>

    <Sale_Unit>SK1</Sale_Unit><Sales_Qty>2.000</Sales_Qty><Base_unit>ST</Base_unit><Base_Inners>    6</Base_Inners></ItemMsg><ItemMsg><Item_Number>000030</Item_Number>

    <Material>C18</Material><Shipping_Unit>SK1</Shipping_Unit><Shipping_Qty>        36.000</Shipping_Qty><Sale_Unit>CSE</Sale_Unit><Sales_Qty>6.000</Sales_Qty>

    <Base_unit>ST</Base_unit><Base_Inners>    6</Base_Inners></ItemMsg>

    <TrailerMsg>

        <NrOfMessageRecords>00000003</NrOfMessageRecords>

        </TrailerMsg>

    </RecordMsg>

    </ns0:SalesOrderMessage>

All Replies

Posted by Robin Brown on 03-Aug-2011 08:30

Hi Derick,

The absence or presence of line feeds should not affect the behavior of READ-XML.  This sounds like a bug.  Please report your issue to Technical Support.

Regards,

Robin

This thread is closed