Skip to Content

Serialize object to xml - Object ID

I want to serialíze an object with the keyword

Call Transformation

I also want the same variables of the object always lead to the same serialization. But the serilization takes the object id into account, so that I get different values for different objects. Is there a way to achieve my desired behaviour?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 09, 2017 at 04:19 PM

    I suppose a big hammer approach would be to remove the ID from the XML. But may I ask why this is an issue?

    data(o1) = new lcl_test( ).
    data(o2) = o1. 
    data(o3) = new lcl_test( ).

    1 and 2 are the same and 3 is a different object. If xml 1 and 2 are identical and 3 is different then this reflects the state of the application. This is good.

    Add comment
    10|10000 characters needed characters exceeded

    • You could compare just the heap sections. That's basically what Sandra's and my suggestions amount to. Either use the cl_xml* classes or create your own transformation.

      If XML is not specifically a requirement then you could also use RTTI tools to enumerate and compare the classes' attributes.

  • Aug 09, 2017 at 11:30 AM

    You may use CALL TRANSFORMATION with for instance (refer to the documentation for more information) :

    OPTIONS data_refs = 'heap-or-create'
    Add comment
    10|10000 characters needed characters exceeded