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

Problem in Downloading Data to Application Server in XML Format

Former Member
0 Likes
1,137

Hi Experts,

I tried to download data from SAP in XML Format to Application server, but i am getting error.

This is the code.

l_streamfactory = l_ixml->create_stream_factory( ).

l_ostream = l_streamfactory->create_ostream_itable(

table = l_xml_table ).

*To Change the Encoding Type to UTF-8

s_encoding_type = 'utf-8'.

encoding = l_ixml->create_encoding( character_set = s_encoding_type

byte_order = 0 ).

call method l_ostream->set_encoding

exporting encoding = encoding.

*Rendering the document

l_renderer = l_ixml->create_renderer( ostream = l_ostream

document = l_document ).

l_rc = l_renderer->render( ).

*Saving the XML document

l_xml_size = l_ostream->get_num_written_raw( ).

data filepath TYPE string.

data filedir TYPE string.

data filename TYPE string.

data hhh type xml_line.

filedir = 'C:\usr\sap\PDG\DVEBMGS00\data\'.

filename = 'ZHR'.

CONCATENATE filedir filename '.xml' INTO filepath.

break-point.

OPEN DATASET filepath FOR OUTPUT IN BINARY MODE.

LOOP AT l_xml_table into hhh.

TRANSFER hhh TO filepath.

ENDLOOP.

CLOSE DATASET filepath.

Can you please help me.

Thanks in Advance.

Murali krishna K

Hi Experts,

I tried to download data from SAP in XML Format to Application server, but i am getting error.

This is the code.

l_streamfactory = l_ixml->create_stream_factory( ).

l_ostream = l_streamfactory->create_ostream_itable(

table = l_xml_table ).

*To Change the Encoding Type to UTF-8

s_encoding_type = 'utf-8'.

encoding = l_ixml->create_encoding( character_set = s_encoding_type

byte_order = 0 ).

call method l_ostream->set_encoding

exporting encoding = encoding.

*Rendering the document

l_renderer = l_ixml->create_renderer( ostream = l_ostream

document = l_document ).

l_rc = l_renderer->render( ).

*Saving the XML document

l_xml_size = l_ostream->get_num_written_raw( ).

data filepath TYPE string.

data filedir TYPE string.

data filename TYPE string.

data hhh type xml_line.

filedir = 'C:\usr\sap\PDG\DVEBMGS00\data\'.

filename = 'ZHR'.

CONCATENATE filedir filename '.xml' INTO filepath.

break-point.

OPEN DATASET filepath FOR OUTPUT IN BINARY MODE.

LOOP AT l_xml_table into hhh.

TRANSFER hhh TO filepath.

ENDLOOP.

CLOSE DATASET filepath.

Can you please help me.

Thanks in Advance.

Murali krishna K

9 REPLIES 9
Read only

Former Member
0 Likes
1,067

DATA rec(80). "Adjust as per requirement/OS limits

OPEN DATASET filepath FOR OUTPUT IN <b>TEXT MODE ENCODING DEFAULT.</b>

LOOP AT l_xml_table into hhh.

TRANSFER hhh TO filepath.

ENDLOOP.

CLOSE DATASET filepath.

Read only

0 Likes
1,067

Hi Kishna,

OPEN DATASET filepath FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

This Statement is giving error.

Type ...filter..message...expected after mode.

Thanks,

Murali K

Read only

0 Likes
1,067

Is the affected System a Unicode system? which basis release ?

Read only

0 Likes
1,067

Hi Mike,

It is R/3 Release 4.6C

How to find whethe it is unicode system or not.

Thanks,

Murali Krishna K

Read only

0 Likes
1,067

4.6C does not support Unicode...

You have to OPEN the DATASET without the addition "ENCODING DEFAULT". This addition is not supported in 4.6 systems.

Read only

0 Likes
1,067

Hi Murali,

I have the same problem: were you able to solve it?

dannyR

Read only

0 Likes
1,067

Now i read the xml files from the application server ,i met "//uploadtest/test.xml cann't open" error. And the test.xml content chinese characters

OPEN DATASET l_filename FOR INPUT IN TEXT MODE ENCODING DEFAULT .

IF sy-subrc <> 0.

WRITE:/ 'invalid file path'.

ENDIF.

DO.

READ DATASET l_filename INTO l_xml_line.

IF sy-subrc EQ 0.

APPEND l_xml_line TO l_xml_table.

ELSE.

EXIT.

ENDIF.

ENDDO.

CLOSE DATASET l_filename.

Read only

Former Member
0 Likes
1,067

Which Error is generated?

Read only

0 Likes
1,067

Hi Mike,

Error is this one.

File "C:\usr\sap\PDG\DVEBMGS00\data\ZHR.xml" could not be closed ".

The current program "ZBPO_SUBPOOL " had to be terminated because

a capacity limit has been reached.

Thanks,

Murali k