简体   繁体   English

从 ABAP 变量到 XML 的 ID 转换什么都不做

[英]ID transformation from ABAP variable to XML does nothing

I experience a confusing issue with built-in SAP transformation ID .我在使用内置 SAP 转换ID遇到了一个令人困惑的问题。

I try to serialize ABAP structure, but result XML is always empty.我尝试序列化 ABAP 结构,但结果 XML 始终为空。 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.

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 .另一种语法也是正确的,它只是做了一些完全不同的事情:它搜索名为XML的元素并将该元素的值分配给lv_xml Since there's no XML element, the string stays empty.由于没有XML元素,字符串保持为空。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM