Last active
July 14, 2016 05:41
-
-
Save quxiaowei/9fda97ccd8099dbabdf968452a3d93e8 to your computer and use it in GitHub Desktop.
[abap] transformation from json to abap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?sap.transform simple?> | |
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"> | |
<!-- | |
json: example: | |
[{"result":-3.585595,"errorCode":"0","errorMessage":" "}, | |
{"result":-3.585595,"errorCode":"0","errorMessage":" "}] | |
abap type: | |
TYPES: BEGIN OF ty_result, | |
result TYPE string, | |
errorcode TYPE string, | |
errormessage TYPE string, | |
END OF ty_result. | |
CALL TRANSFORMATION ztransform SOURCE XML v_text RESULT result = it_result. | |
--> | |
<tt:root name="RESULT"/> | |
<tt:template> | |
<array> | |
<tt:loop ref=".RESULT"> | |
<object> | |
<num name="result"> | |
<tt:value ref="$ref.RESULT"/> | |
</num> | |
<str name="errorCode"> | |
<tt:value ref="$ref.ERRORCODE"/> | |
</str> | |
<str name="errorMessage"> | |
<tt:value ref="$ref.ERRORMESSAGE"/> | |
</str> | |
</object> | |
</tt:loop> | |
</array> | |
</tt:template> | |
</tt:transform> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment