8

I experience a confusing issue with built-in SAP transformation ID.

I try to serialize ABAP structure, but result XML is always empty. Do you have any suggestions, what is wrong with my code?

DATA lv_xml TYPE xstring.

CALL TRANSFORMATION ID
  SOURCE test = syst
  RESULT XML = lv_xml.

IF lv_xml IS INITIAL.
  MESSAGE `Oops, it's empty!` TYPE 'S' DISPLAY LIKE 'W'.
ELSE.
  CALL FUNCTION 'DISPLAY_XML_STRING'
    EXPORTING
      xml_string = lv_xml.
ENDIF.

1 Answer 1

8

Almost correct:

CALL TRANSFORMATION ID
  SOURCE test = syst
  RESULT XML lv_xml. " no = here!

The other syntax is correct as well, it just does something completely different: it searches for an element named XML and assigns the value of that element to lv_xml. Since there's no XML element, the string stays empty.

1
  • Oh, that amazing syntax! Just a single little sign turned into big trouble... Thank you for your answer, now the problem is solved. Commented Sep 1, 2014 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.