Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

pic1.png

 

To retrieve attribute values from XML tags , we can use the Class cl_xml_document.

The above screenshot shows the attribute value and Tag value.

Using CALL TRANSFORMATION, we can retrieve the tag value from XML not the attribute value.

 

To retrieve the attribute value we can do the following:

 

1.Upload the XML data from file into SAP as XML_IN(string)

 

2.Create an Instance for the class cl_xml_document.

pic2.jpg

 

3. Parse through the uploaded XML file using Method parse_string.

 

pic3.jpg

4. Get the Parent Node. For the above screenshot, the parent node is actionids.

pic4.jpg

5. Get Attribute Value for actorID under the Node Approval.

6. Find the node Approval under the parent node actionids.

pic41.jpg

7. Get the node name. If the node name is ‘Approval’, then get the attribute Value for the Attribute : actorID by passing root node.

pic61.jpg

8. Fill the internal table with the attribute value.