Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

TRANSFER DATASET

shilpi_singh
Advisor
Advisor
0 Likes
2,588


Hi,

I need to create a XML file and in a single TRANSFER dataset statement I passing a string variable that has my XML data . This string variable has 8027 characters, but in the file only 7000 characters get printed.

Later below I am able to write the footer data in other TRANSFER dataset statement.

could you please advise as whether we have a restriction with regards to maximum data that we can transfer to dataset in one single TRANSFER dataset statement. As in my case I get the file but my body is incomplete.

FYI: I am opening the file in TEXT MODE.

Thank you,

Shilpi

3 REPLIES 3
Read only

Former Member
0 Likes
1,141

According to the documentation for the TRANSFER statement:

"If the addition LENGTH is not specified, all characters or bytes are passed."

Rob

Read only

0 Likes
1,141

Hi Rob,

But in my case my string is 8027 characters long, and if I transfer this string in a go , I have only 7000 characters printed in my file.

While if I split the same string in parts and then transfer each part to file then I have everything in my file.

I tried with explicitly putting the length addition as TRANSFER <string_variable> TO DATASET LENGTH 8027 , but I have the same result.

Thank you,

Shilpi

Read only

rosenberg_eitan
Active Contributor
0 Likes
1,141

Hi,

See this code fragment, this come from

see FORM write_1_to_xml .

  DATA: ob_ixml             TYPE REF TO if_ixml .

  DATA: ob_ixml_document    TYPE REF TO if_ixml_document ,

        ob_ixml_encoding    TYPE REF TO if_ixml_encoding .

       

  ob_ixml = cl_ixml=>create( ).

  ob_ixml_document = ob_ixml->create_document( ).

  ob_ixml_encoding = ob_ixml->create_encoding(

        byte_order    = if_ixml_encoding=>co_little_endian

        character_set = 'utf-8' ) .

  ob_ixml_document->set_encoding( ob_ixml_encoding ) .       

 

  ......Create the XML data...... 

 

  DATA: ob_ixml_stream_factory TYPE REF TO if_ixml_stream_factory.

  DATA: ob_ostream  TYPE REF TO if_ixml_ostream .

  DATA: xstring TYPE xstring.

  ob_ixml_stream_factory = ob_ixml->create_stream_factory( ).

  ob_ostream = ob_ixml_stream_factory->create_ostream_xstring( xstring ).

  ob_ixml_document->render( ostream = ob_ostream ) .

  DATA: debug TYPE string.

  ob_ixml_stream_factory = ob_ixml->create_stream_factory( ).

  ob_ostream = ob_ixml_stream_factory->create_ostream_cstring( debug ).

  ob_ixml_document->render( ostream = ob_ostream ) .

  DATA: filesize TYPE i.

  filesize = XSTRLEN( xstring ).

  DATA: file_name TYPE string .

  CONCATENATE p_file_f p_file_s INTO file_name .

  DATA: mess TYPE string .

  OPEN DATASET file_name FOR OUTPUT IN BINARY MODE MESSAGE mess .

  IF sy-subrc NE 0.

    MESSAGE e306(f7) WITH file_name .

    RETURN .

  ENDIF.

  TRANSFER xstring TO file_name .

  CLOSE DATASET file_name .

  MESSAGE s838(5z) WITH file_name INTO message .

  PERFORM add_message .

Regards.