Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Access table node in a XML docuement using cl_xml_document objects

Hello all,

I am using CL_XML_document class to modify a deep complex structure.

I convert the structure into an XML representation using CALL TRANSFORMATION 'ID' and then access its fields using find_node () method of the CL_XML_DOCUMENT.

If i find a particular field(node) , i modify its contents with new values using Set_value() method of if_ixml_node.

This works fine if the complex structures has only simple structures inside it. But in 1 of the case, a field of a structure is an internal table.

So when I reach this node , i need to add an entry into this table using set_value( ) but I am unable to do so.

For ex.

Input structure ZABC have 3 structure fields A, B , C.  Stucture C has a field ITAB which is an internal table.


  |- A

      |_ fld1 TYPE  CHAR2

      |_ fld2 TYPE CHAR2

|- B

      |_ fld1 TYPE CHAR2

      |_ fld2 TYPE CHAR2

|- C

      |_ fld1 TYPE CHAR2

      |_ itab TYPE STANDARD TABLE OF TY_TABTYPE    " TY_TABTYPE has 2 fields /columns

My logic


SOURCE struc = 'ZABC'

RESULT XML   = xml_string  

xml_doc->parse_string( stream = xml_String ). " XML_doc TYPE REF TO cl_xml_document



   << some code >>

    lv_node  = xml_doc->find_node( "some input" )

    lv_node->set_value( "some value").


So when the lv_node is ITAB , how do i know if its of table type ? Then if there is a row in it then i need to modify. If it is empty then i need to add a new row into the node.

I am totally stuck here as i don't understand how to proceed.

Any one with any pointers on this ?

Appreciate your quick replies.



Former Member
Not what you were looking for? View more on this topic or Ask a question