Application Development 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: 

XML to ABAP from server file

Former Member
0 Kudos

Hello everyone.

I'm trying to import XML file from server file and without using a transformation.

I'm using a parser to get the data into an internal table.

When i use GUI_UPLOAD all works fine ...

By means of READ DATASET, parser is returning errors.

The way i'm reading the data fom server file:

DATA: BEGIN OF it_dados OCCURS 0,

data(256) TYPE x,

END OF it_dados.

OPEN DATASET l_sfile FOR INPUT MESSAGE msg IN BINARY MODE.

IF sy-subrc NE 0.

WRITE: / msg.

STOP.

ENDIF.

REFRESH it_dados. CLEAR it_dados.

CLEAR l_file_size.

DO.

READ DATASET l_sfile INTO it_dados LENGTH l_line_size.

IF sy-subrc NE 0.

EXIT.

ELSE.

ADD l_line_size TO l_file_size.

ENDIF.

APPEND it_dados.

ENDDO.

Please provide some help.

Thank you all.

Mário

Message was edited by:

Mario Semedo

1 REPLY 1

former_member194669
Active Contributor
0 Kudos

Hi,

Try this way


DATA: BEGIN OF it_dados OCCURS 0,
data(256) TYPE x,
END OF it_dados.

OPEN DATASET l_sfile FOR INPUT MESSAGE msg IN BINARY MODE.
IF sy-subrc NE 0.
WRITE: / msg.
STOP.          
ENDIF.

REFRESH it_dados. CLEAR it_dados.

DO.
READ DATASET l_sfile INTO it_dados. "<<<<
APPEND it_dados.       "<<<<
ENDDO.
close dataset l_sfile. "<<<<