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

Read and Write the XML file .

Former Member
0 Likes
636

Hi Friends..

Hi Already I am using Text file as a input for my application.My program fetched the text file from FTP and process it after that it will save the file into FTP server.

Now I am using XML file instead of Text file.So how can I readt the XML input into internal table and how I convert ITAB output into XML format. if anybody have idea about that kindly guide me.

Thanks in Advance.

Gowrishankar

1 ACCEPTED SOLUTION
Read only

brad_bohn
Active Contributor
0 Likes
533

Use CALL TRANSFORMATION and a transformation template to deserialize XML to ABAP data or to serialize ABAP data back to XML. See the help files for more info...

Use CALL TRANSFORMATION and a transformation template to deserialize XML to ABAP data or to serialize ABAP data back to XML. See the help files for more info...

2 REPLIES 2
Read only

brad_bohn
Active Contributor
0 Likes
534

Use CALL TRANSFORMATION and a transformation template to deserialize XML to ABAP data or to serialize ABAP data back to XML. See the help files for more info...

Read only

Former Member
0 Likes
533

Hi ,

Use the foll code for uploading

DATA : BEGIN OF ITAB_FILE OCCURS 0,

  • include structure epsfili.

NAME(60) TYPE C,

SIZE TYPE EPSFILSIZ,

RC TYPE EPSFTPRC,

END OF ITAB_FILE.

CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'

EXPORTING

DIR_NAME = DIRECT " [path where XML is stored

TABLES

DIR_LIST = ITAB_F

.

IF SY-SUBRC <> 0.

WRITE / SY-SUBRC.

ENDIF.

LOOP AT ITAB_F.

MOVE-CORRESPONDING ITAB_F TO ITAB_FILE.

APPEND ITAB_FILE.

ENDLOOP.

n then use OPEN DATA set

TO create a XML file

DATA : TXT(150).

CONCATENATE ZFNAME SY-DATUM SY-UZEIT XMLCNT '.XML' INTO

FILENAME .

OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE.

IF SY-SUBRC EQ 0.

LOOP AT ITAB.

MOVE ITAB-TXT TO TXT.

CONDENSE TXT.

TRANSFER TXT TO FILENAME.

ENDLOOP.

WRITE : / 'FILE CREATED' , FILENAME.

COMMIT WORK.

ELSE.

ROLLBACK WORK.

WRITE: 'No Path Found'.

ENDIF .

CLOSE DATASET FILENAME.

Thanks