Skip to Content
0
Former Member
Sep 11, 2014 at 12:55 PM

Create an XML File in Application server

1204 Views

Hello,

I have a requirement to create an XML File as Local File and as server File. For the local File it works fine and i got a Local XML File.

My problem is for the Server File.I found a solution in internet to convert in binary.But i don't get in the server File created the XML structure.

Here is My code for the unix server File

DATA ex_tab TYPE TABLE OF x255.

data: wa_tab type x255.

data: lv_line(255) type c.

**-- carica tabella gt_file

PERFORM CARICA_TAB_FILE.

LOOP AT GT_FILE.

MOVE-CORRESPONDING GT_FILE TO WA_SOURCE.

APPEND WA_SOURCE TO GT_SOURCE.

CLEAR WA_SOURCE.

ENDLOOP.

* Perform the XSLT stylesheet

TRY.

CALL TRANSFORMATION ZMESMO052_XML

SOURCE MATERIAL_DATA = GT_SOURCE[]

RESULT XML XML_RESULT .

CATCH CX_ROOT INTO GS_RIF_EX.

GS_VAR_TEXT = GS_RIF_EX->GET_TEXT( ).

MESSAGE GS_VAR_TEXT TYPE 'E'.

ENDTRY.

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

EXPORTING

buffer = XML_RESULT

TABLES

binary_tab = ex_tab.

CONCATENATE P_FILE '.xml' INTO P_FILE.

CONDENSE P_FILE.

TRANSLATE P_FILE TO LOWER CASE.

OPEN DATASET P_FILE FOR OUTPUT IN BINARY MODE.

IF SY-SUBRC NE 0.

MESSAGE E000(ZF) WITH ' Error opening File' P_FILE.

ENDIF.

loop at ex_tab into wa_tab.

move wa_tab to lv_line.

transfer lv_line to p_file.

endloop.

close dataset p_file.

And i Got a file like this

Any solution please

Attachments

file_server.jpg (39.6 kB)