Anda di halaman 1dari 2

report zjrv_test_serialize.

types: ty_xline(1096) type x,

ty_ta_xline type standard table of ty_xline.
data: gt_tab_res type ty_ta_xline.
data: gs_tab like line of gt_tab_res.
data: gt_ser type standard table of ztest_serialize.
data: gs_ztest_serialize type ztest_serialize.

data: go_original type ref to ZCL_TEST_SHARE_MESSAGE.

data gv_string type string.

data gv_remaining type string.
data gv_int type i.

p_msg type string default 'HERE GOES DOLLY THE SHEEP'.


* Create Object
create object go_original
i_text = p_msg.

* Transform the object into xstring.

call transformation id_indent
source obj = go_original
result xml gt_tab_res.

data gv_xstring type xstring.

loop at gt_tab_res into gs_tab.
concatenate gv_xstring gs_tab into gv_xstring in byte mode.

* handle the xtring as a string and put it into a db table

gv_remaining = gv_xstring.
do .
gv_int = strlen( gv_remaining ).
if gv_int le 256.
gv_string = gv_remaining(256).

add 1 to gs_ztest_serialize-seq.
gs_ztest_serialize-str = gv_string.
append gs_ztest_serialize to gt_ser .
gv_remaining = gv_remaining+256.

if gv_remaining is not initial.

add 1 to gs_ztest_serialize-seq.
gs_ztest_serialize-str = gv_remaining.
append gs_ztest_serialize to gt_ser .

modify ztest_serialize from table gt_ser .

commit work and wait.