Skip to Content
0
Jun 09, 2020 at 08:03 AM

XML to ABAP transformation - issue with sequence of fields in XMl

1148 Views

Hi

1. We are using XML transformation code created using XSLT_TOOL Tcode. The XML file is coming to SAP and getting transformed to ABAP structure internal table. But some-times we get the XML file with change in the sequence of fields which the XML transformation not able to process.

So, we have added the particular tag that is causing error in the other part of transformation code also as per XML file sequence.

2. We come across a different solution for this using XML parsing (using function module SMUM_XML_PARSE ), getting the XML data in to internal table with all the tags and their values so that we can assign the values to SAP internal table records by looping this XML data. We expect huge data in XML file.

Please suggest if there is any other solution for reading XML file data and assign to the correct field in SAP DDIC structure / internal table even if the sequence of fields change in XML file.

Also let me know if the later XML parsing technique poses any performance issue as we are expecting huge data in XML file.

Attached the transformation code we are using

xml-transformation-code.txt

Below is the sample XML input file :

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

<Cond_Tbl_Data_Set>

<Cond_Tbl_Data_Record>

<Condition_Type>ZP00</Condition_Type>

<Condition_Table_ID>912</Condition_Table_ID>

<Key_Values>14611006ABC-123</Key_Values>

<Valid_From_Date>20200601</Valid_From_Date>

<Valid_To_Date>99991231</Valid_To_Date>

<Currency_Code>USD</Currency_Code>

<Base_Per_Quantity>1</Base_Per_Quantity>

<Scale_Basis>C</Scale_Basis>

<Base_UOM_Code>EA</Base_UOM_Code>

<Action>Delete</Action>

<Scale_UOM_Code>EA</Scale_UOM_Code>

<Extraction_Time>20200430 16:12:11</Extraction_Time>

<Scale_Record>

<Scale_Quantity>1.0</Scale_Quantity>

<Scale_Value>98.00</Scale_Value>

</Scale_Record>

<Scale_Record>

<Scale_Quantity>10.0</Scale_Quantity>

<Scale_Value>97.00</Scale_Value>

</Scale_Record>

<Scale_Record>

<Scale_Quantity>15.0</Scale_Quantity>

<Scale_Value>96.00</Scale_Value>

</Scale_Record>

<Scale_Record>

<Scale_Quantity>20.0</Scale_Quantity>

<Scale_Value>95.00</Scale_Value>

</Scale_Record>

<Scale_Record>

<Scale_Quantity>25.0</Scale_Quantity>

<Scale_Value>94.00</Scale_Value>

</Scale_Record>

</Cond_Tbl_Data_Record>

</Cond_Tbl_Data_Set>

Attachments