cancel
Showing results for 
Search instead for 
Did you mean: 

Call transformation with an object

Former Member
0 Kudos

Hallo,

in my BSP I want to transform my model object into a xml string to set an server side cookie.

Therefore my code is:

  DATA:
    lv_xml      TYPE string,
    lv_username TYPE string.

 model    ?= get_model( model_id = 'main' ).

  lv_username = sy-uname.

  Call TRANSFORMATION id SOURCE o = model  RESULT XML lv_xml.
  cl_bsp_server_side_cookie=>set_server_cookie(
        name                  = 'MODEL'
        application_name      = runtime->application_name
        application_namespace = runtime->application_namespace
        username              = lv_username
        session_id            = runtime->session_id
        data_value            = lv_xml
        data_name             = 'MODEL'
        expiry_time_rel       = 3600 ).

But after the command "Call Transformation" the xml-string doesn't contain all the data of my object, only this:

<?xml version="1.0" encoding="iso-8859-1"?>#<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><O href="#o19"/></asx:values><asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary"> <cls:ZCL_M_ESS_TRV_OVW id="o19"/

></asx:heap></asx:abap>

What is wrong?

Regards.

Martin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hallo back,

try inserting the following interface to your model IF_SERIALIZABLE_OBJECT.

If you want to transform objects via referenz into an xml-string you need to serialize your class attributes via the above mentioned interface.

don't forget adding points if problem is solved...

cheers

Felix

Answers (0)