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

data read from xml file

0 Likes
593

I have a requirement like i have a file .xml . i have to read data from xml file and save into sap tables. after read this file i have to store this file in application server. plz help me how to i do this.

3 REPLIES 3
Read only

RaymondGiuseppi
Active Contributor
0 Likes
498

Look at <a href="/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach">SAP Network Blog: XML DOM Processing in ABAP part II - Convert an XML file into an ABAP table using SAP DOM Approach.</a> or <a href="/people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1">SAP Network Blog: XML processing in ABAP Part 1</a>

Regards

Read only

Former Member
0 Likes
498

Hi,

Check this <b>package</b> and find report according ur requirement.

SST_DEMO

<b>FM----


></b> SOTR_TAGS_REMOVE_FROM_STRING

<b>Reports,</b>

CEP_DOC_PARSE_XML_AND_SAVE

CEP_XSTRING_PARSE_XML_CLASS

/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach

Regards

Gaurav

Read only

Former Member
0 Likes
498

See the ex: to read date from xml file.

REPORT ZFI_EXCEL .

*Read the data from the locally held spreadsheet

*Once read using this FM, the data will be held like:-

*ROW |COL |VALUE

*---|-|---

*0001 |0001 |2

*0001 |0002 |00000000001

*0001 |0003 |1

*0001 |0004 |

*0001 |0005 |2

*0001 |00010|SHORT TEXT for a/c

*0001 |00011|LONG TEXT a/c 0000000001

*.

*.

*0002 |0001 |2

*0002 |0002 |00000000002

*0002 |0003 |1

*0002 |0004 |

*0002 |0005 |2

*0002 |00010|SHORT TEXT for a/c

*0001 |00011|LONG TEXT a/c 0000000002

*

*etc........

data: begin of excel_tab occurs 0.

include structure alsmex_tabline.

data: end of excel_tab .

data: begin of itab occurs 0,

bldat like bkpf-bldat,

blart like bkpf-blart,

bukrs like bkpf-bukrs,

budat like bkpf-budat,

waers like bkpf-waers,

bschl like bseg-bschl,

hkont like bseg-hkont,

sgtxt like bseg-sgtxt,

end of itab.

data: process_tab_struct_tmp like itab.

field-symbols: <fs1>.

selection-screen: begin of block blk.

parameters: fname type rlgrap-filename.

selection-screen: end of block blk.

at selection-screen on value-request for fname.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = 'ZFI_EXCEL'

DYNPRO_NUMBER = '1000'

FIELD_NAME = 'FNAME'

IMPORTING

FILE_NAME = FNAME.

START-OF-SELECTION.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = FNAME

i_begin_col = 1

i_begin_row = 1

i_end_col = 24

i_end_row = 60000

tables

intern = EXCEL_TAB

LOOP AT EXCEL_TAB.

assign component excel_tab-col of structure

process_tab_struct_tmp to <fs1>.

<fs1> = excel_tab-value.

at end of row.

move-corresponding: process_tab_struct_tmp to itab. “Move values to itab

append itab.

endat.

ENDLOOP.

Use OPEN DATASET to write file on application server.