<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Serialize object to xml - Object ID in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538074#M19892</link>
    <description>&lt;P&gt;That's not excatly what I want. For example, this code&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;REPORT zmartion_serialize.

CLASS lcl_serial DEFINITION FINAL CREATE PUBLIC .
  PUBLIC SECTION.
    METHODS constructor IMPORTING !id TYPE int4.
  PRIVATE SECTION.
    DATA gv_id TYPE int4.
ENDCLASS.

CLASS lcl_serial IMPLEMENTATION.
  METHOD constructor.
    gv_id = id.
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  DATA: object            TYPE REF TO lcl_serial,
        serialized_object TYPE string.

  CREATE OBJECT object EXPORTING id = 4.
  CALL TRANSFORMATION id SOURCE model = object  RESULT XML serialized_object.

  WRITE: serialized_object.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;gives the following serialization. I Don't want to see the "o8" in the result.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml"&amp;gt;
&amp;lt;asx:values&amp;gt;
&amp;lt;MODEL href="#o8"/&amp;gt;
&amp;lt;/asx:values&amp;gt;
&amp;lt;asx:heap xmlns:dic="http://www.sap.com/abapxml/types/dictionary" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&amp;gt;
&amp;lt;prg:LCL_SERIAL id="o8" xmlns:prg="http://www.sap.com/abapxml/classes/program/ZMARTION_SERIALIZE"&amp;gt;
&amp;lt;local.LCL_SERIAL&amp;gt;
&amp;lt;GV_ID&amp;gt;4&amp;lt;/GV_ID&amp;gt;
&amp;lt;/local.LCL_SERIAL&amp;gt;
&amp;lt;/prg:LCL_SERIAL&amp;gt;
&amp;lt;/asx:heap&amp;gt;
&amp;lt;/asx:abap&amp;gt;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 09 Aug 2017 16:51:30 GMT</pubDate>
    <dc:creator>Martin_Bschen</dc:creator>
    <dc:date>2017-08-09T16:51:30Z</dc:date>
    <item>
      <title>Serialize object to xml - Object ID</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538070#M19888</link>
      <description>&lt;P&gt;I want to serialíze an object with the keyword&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;Call Transformation&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;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?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 11:13:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538070#M19888</guid>
      <dc:creator>Martin_Bschen</dc:creator>
      <dc:date>2017-08-09T11:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Serialize object to xml - Object ID</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538071#M19889</link>
      <description>&lt;P&gt;You may use CALL TRANSFORMATION with for instance (refer to the documentation for more information) :&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;OPTIONS data_refs = 'heap-or-create'&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Aug 2017 11:30:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538071#M19889</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-08-09T11:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Serialize object to xml - Object ID</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538072#M19890</link>
      <description>&lt;P&gt;I suppose a big hammer approach would be to remove the ID from the XML. But may I ask why this is an issue? &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;data(o1) = new lcl_test( ).
data(o2) = o1. 
data(o3) = new lcl_test( ).&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 16:19:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538072#M19890</guid>
      <dc:creator>pokrakam</dc:creator>
      <dc:date>2017-08-09T16:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Serialize object to xml - Object ID</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538073#M19891</link>
      <description>&lt;P&gt;Basically I want to do an equality check on the objects. Two objects should be considered equal, if they have the same attributes.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 16:34:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538073#M19891</guid>
      <dc:creator>Martin_Bschen</dc:creator>
      <dc:date>2017-08-09T16:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Serialize object to xml - Object ID</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538074#M19892</link>
      <description>&lt;P&gt;That's not excatly what I want. For example, this code&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;REPORT zmartion_serialize.

CLASS lcl_serial DEFINITION FINAL CREATE PUBLIC .
  PUBLIC SECTION.
    METHODS constructor IMPORTING !id TYPE int4.
  PRIVATE SECTION.
    DATA gv_id TYPE int4.
ENDCLASS.

CLASS lcl_serial IMPLEMENTATION.
  METHOD constructor.
    gv_id = id.
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  DATA: object            TYPE REF TO lcl_serial,
        serialized_object TYPE string.

  CREATE OBJECT object EXPORTING id = 4.
  CALL TRANSFORMATION id SOURCE model = object  RESULT XML serialized_object.

  WRITE: serialized_object.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;gives the following serialization. I Don't want to see the "o8" in the result.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml"&amp;gt;
&amp;lt;asx:values&amp;gt;
&amp;lt;MODEL href="#o8"/&amp;gt;
&amp;lt;/asx:values&amp;gt;
&amp;lt;asx:heap xmlns:dic="http://www.sap.com/abapxml/types/dictionary" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&amp;gt;
&amp;lt;prg:LCL_SERIAL id="o8" xmlns:prg="http://www.sap.com/abapxml/classes/program/ZMARTION_SERIALIZE"&amp;gt;
&amp;lt;local.LCL_SERIAL&amp;gt;
&amp;lt;GV_ID&amp;gt;4&amp;lt;/GV_ID&amp;gt;
&amp;lt;/local.LCL_SERIAL&amp;gt;
&amp;lt;/prg:LCL_SERIAL&amp;gt;
&amp;lt;/asx:heap&amp;gt;
&amp;lt;/asx:abap&amp;gt;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Aug 2017 16:51:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538074#M19892</guid>
      <dc:creator>Martin_Bschen</dc:creator>
      <dc:date>2017-08-09T16:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Serialize object to xml - Object ID</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538075#M19893</link>
      <description>&lt;P&gt;You may transform as you wish by creating a new transformation&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 17:16:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538075#M19893</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-08-09T17:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Serialize object to xml - Object ID</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538076#M19894</link>
      <description>&lt;P&gt;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.&lt;/P&gt;
  &lt;P&gt;If XML is not specifically a requirement then you could also use RTTI tools to enumerate and compare the classes' attributes.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 19:51:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/serialize-object-to-xml-object-id/m-p/538076#M19894</guid>
      <dc:creator>pokrakam</dc:creator>
      <dc:date>2017-08-09T19:51:54Z</dc:date>
    </item>
  </channel>
</rss>

