2007 Mar 16 8:01 AM
Hi,
Suppose you have an itab "z_table" with generic linetype. The table may contain any ddic structure or table.
Furhter you want to exchange the itab "z_table" between the Systems A and B using XML.
We are using the following code to serialize the itab "z_table" in system A:
DATA: g_ixml TYPE REF TO if_ixml,
g_stream_factory TYPE REF TO if_ixml_stream_factory,
g_encoding TYPE REF TO if_ixml_encoding,
ostream TYPE REF TO if_ixml_ostream.
CONSTANTS: encoding TYPE string VALUE 'utf-8'.
g_ixml = cl_ixml=>create( ).
g_stream_factory = g_ixml->create_stream_factory( ).
g_encoding = g_ixml->create_encoding(
character_set = encoding
byte_order = 0 ).
ostream = g_stream_factory->create_ostream_xstring( string = ex_xml_string ).
ostream->set_encoding( encoding = g_encoding ).
CALL TRANSFORMATION id_indent
SOURCE z_table = z_table
RESULT XML xml_string
OPTIONS data_refs = 'heap'
xml_header = 'full'.
And the following code to deserialize the itab in system B:
CALL TRANSFORMATION id_indent
SOURCE XML xml_string
RESULT z_table = z_table.
The serialization in System A creates an XML document containing <dic:z_structure> tags. If you now try to deserialize this document ("z_table")
in System B, the deserialization fails in case z_table contains DDIC structures which are not known in system B.
Is there any way to have the definition (e.g. type + length) of those ddic structures included in the XML document, so that
a deserialization is possible even if the ddic structure is not known in system B? e.g. Rendered into a XML scheme, or directly as an
attribute into the <dic:..> tag for instance?
Any ideas are appreciated..
Best regards,
Georg
Hi,
Suppose you have an itab "z_table" with generic linetype. The table may contain any ddic structure or table.
Furhter you want to exchange the itab "z_table" between the Systems A and B using XML.
We are using the following code to serialize the itab "z_table" in system A:
DATA: g_ixml TYPE REF TO if_ixml,
g_stream_factory TYPE REF TO if_ixml_stream_factory,
g_encoding TYPE REF TO if_ixml_encoding,
ostream TYPE REF TO if_ixml_ostream.
CONSTANTS: encoding TYPE string VALUE 'utf-8'.
g_ixml = cl_ixml=>create( ).
g_stream_factory = g_ixml->create_stream_factory( ).
g_encoding = g_ixml->create_encoding(
character_set = encoding
byte_order = 0 ).
ostream = g_stream_factory->create_ostream_xstring( string = ex_xml_string ).
ostream->set_encoding( encoding = g_encoding ).
CALL TRANSFORMATION id_indent
SOURCE z_table = z_table
RESULT XML xml_string
OPTIONS data_refs = 'heap'
xml_header = 'full'.
And the following code to deserialize the itab in system B:
CALL TRANSFORMATION id_indent
SOURCE XML xml_string
RESULT z_table = z_table.
The serialization in System A creates an XML document containing <dic:z_structure> tags. If you now try to deserialize this document ("z_table")
in System B, the deserialization fails in case z_table contains DDIC structures which are not known in system B.
Is there any way to have the definition (e.g. type + length) of those ddic structures included in the XML document, so that
a deserialization is possible even if the ddic structure is not known in system B? e.g. Rendered into a XML scheme, or directly as an
attribute into the <dic:..> tag for instance?
Any ideas are appreciated..
Best regards,
Georg
2007 Mar 18 7:27 AM
use FM
call function 'TR_NAMETAB_GET'
exporting
iv_tabname = 'SLFIGHT'
iv_get_lengths_in_charmode = ' '
iv_get_texts = 'X'
importing
et_dfies = lt_dfies
exceptions
not_found = 1
others = 2.
if sy-subrc <> 0.
*--- Do nothing in this particular case
endif.
to get the table definition and use call transformation to convert this itab to xml to get the table definition details.
Regards
Raja
2007 Mar 23 11:34 AM
Hello Raja,
many thanks first for your answer. I tried the FM and got a table with the definition details I want.
Unfortunately, I'm not really sure, how to continue working with the definition details. There are still some questions open:
- How do I proficient include these table details into my xml with my original table z_table? Would it be possible to include the table details in a way, that a "call transformation" can easily deserialize my z_table with this table details?
- How do I convert the lt_dfies table definition details back to a ddic object that I can use? Can this be done in memory only, so that I don't have to create real ddic objects on the target system?
Many thanks and kind regards, Oliver<b></b><b></b>
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |