SAP ABAP 顾问(开发工程师)能力模型_Terry谈企业数字化的博客-CSDN博客文章浏览阅读441次。目标:基于对SAP abap 顾问能力模型的梳理,给一年左右经验的abaper 快速成长为三年经验提供超级燃料!https://blog.csdn.net/java_zhong1990/article/details/132469977
平时在 ‘ 工地搬砖 ’,很少关注基础技能,闲来无事,拿起来复习一下 !
代码模版:
" --------------------1 数据准备 --------------------
DATA:lv_text TYPE string.
DATA:lt_text TYPE TABLE OF vbak.
DATA:ls_text TYPE vbak.
SELECT * FROM vbak INTO CORRESPONDING FIELDS OF TABLE lt_text .
DATA:lo_serialize TYPE REF TO cl_trex_json_serializer.
DATA:lo_deserialize TYPE REF TO cl_trex_json_deserializer.
"---------------------2 Abap list to Json string
"实例化对象
CREATE OBJECT lo_serialize
EXPORTING
data = lt_text.
"串行化
lo_serialize->serialize( ).
lv_text = lo_serialize->get_data( ).
WRITE:/ lv_text.
"-------------------3 Json string to Abap list
CLEAR lt_text[].
CREATE OBJECT lo_deserialize.
lo_deserialize->deserialize(
EXPORTING
json = lv_text
IMPORTING
abap = lt_text[]
).
LOOP AT lt_text[] INTO ls_text.
WRITE:/ ls_text-erdat.
ENDLOOP.
运行效果: