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

write XML file into application server directory

Former Member
0 Likes
1,256

Hi all,

I have a requiremet to create an XML file and to save it into application server. i did my best before posting this thread.

i am able to create a xml file into presentation server using CL_IXML class.

<?xml version="1.0" ?>

- <FILE>

- <SCHEME NUMBER="0000324">

- <SEQUENCE NUMBER="1" LAYOUT="14x100(1001004) + 11x150(1001005)" DOFFS="2">

<ORDER NUMBER="000001001004" MATERIAL="000000800601501762" USERID="123456" REELS="100" />

<ORDER NUMBER="000001001005" MATERIAL="000000800601501762" USERID="123456" REELS="150" />

</SEQUENCE>

- <SEQUENCE NUMBER="2" LAYOUT="3x100(1001004) + 3x150(1001005)" DOFFS="1">

<ORDER NUMBER="000001001004" MATERIAL="000000800601501762" USERID="123456" REELS="100" />

<ORDER NUMBER="000001001005" MATERIAL="000000800601501762" USERID="123456" REELS="150" />

</SEQUENCE>

</SCHEME>

</FILE>

when i am trying to write the same file into application server directory it is wrting as a continuouse line, is this a problem? how can we write in the same format. i had used control break statements in the program for above xml file. Any help is appreciated.

Thanks,

Prakash.

Edited by: Prakash Reddy on Oct 27, 2010 11:11 PM

Edited by: Prakash Reddy on Oct 28, 2010 12:06 AM

5 REPLIES 5
Read only

mvoros
Active Contributor
0 Likes
752

Hi,

it's not a problem. It looks like you have Windows OS as your desktop system and Unix-like system for your application servers. So when you download that file from application server to your desktop then it should split into multiple lines.

Cheers

Read only

Former Member
0 Likes
752

Hi Martin,

First i thank you for the reply. As you said, the operating systems are different. When i tried to download the file into presentation server from application sever, it remains same as continuouse line. The requirement for me is the .net application will communicate with sap throgh application server path for ths file. Is there any other way i can solve this issue?

Regards,

Prakash.

Read only

Former Member
0 Likes
752

Hi,

I have solved this issue using the below code.

TRY.

CALL METHOD cl_abap_conv_in_ce=>create

EXPORTING

encoding = 'UTF-8'

input = b_xml " xstring content received from portal

RECEIVING

conv = l_convin.

CALL METHOD l_convin->read

IMPORTING

data = l_html.

CATCH cx_root.

l_msgstr = 'Conversion error'.

ENDTRY.

SEARCH l_html FOR '><'.

CLEAR l_value.

l_value = cl_abap_char_utilities=>newline.

CONCATENATE '>' l_value '<' INTO l_value.

IF sy-subrc = 0.

REPLACE ALL OCCURRENCES OF '><' IN l_html WITH l_value IN CHARACTER MODE.

ENDIF.

DATA: filename TYPE string.

filename = c_path.

*IF sy-batch IS NOT INITIAL.

OPEN DATASET filename FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE WITH UNIX LINEFEED.

TRANSFER l_html TO filename.

CLOSE DATASET filename.

RESULT:

<?xml version="1.0" encoding="utf-8"?>

<FILE>

<SCHEME NUMBER="0000025">

<SEQUENCE NUMBER=" 1" LAYOUT="6x55(1000066)" DOFFS="1">

<ORDER NUMBER="000001000066" MATERIAL="000000800001000900" USERID="123456" REELS="55"/>

</SEQUENCE>

</SCHEME>

</FILE>

Please share if anyone have better way than this.

Regards,

Prakah. S

Edited by: Prakash Reddy on Oct 28, 2010 4:49 PM

Edited by: Prakash Reddy on Oct 28, 2010 4:51 PM

Read only

Former Member
0 Likes
752

Hi Prakash,

Can you let me know how did you generate XML file with tree structured format? I am trying to create one for Presentation Server and Application Server using  cl_ixml but what I get as output is continuous mode file in presentation server and not able to figure out how to download it to application server.

We are using windows operating system as file system.

Your prompt response will be appreciated.

Thanks and Regards,

Satyen Ameria

Read only

Former Member
0 Likes
752

use it:

o_ostream->set_pretty_print( 'X' ).