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

Reading data from flat file in aplication server

Former Member
0 Likes
801

hi all,

can any body provide code how to read data from flat file which is in application server.

thanks in advance

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
766

hi,

chk this sample code.

parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
 
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
 
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
do.
read dataset p_file into wa_data.
if sy-subrc ne 0.
exit.
else.
append wa_data to it_data.
endif.
enddo.
close dataset p_file.
endif.

Rgds

Anver

6 REPLIES 6
Read only

anversha_s
Active Contributor
0 Likes
767

hi,

chk this sample code.

parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
 
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
 
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
do.
read dataset p_file into wa_data.
if sy-subrc ne 0.
exit.
else.
append wa_data to it_data.
endif.
enddo.
close dataset p_file.
endif.

Rgds

Anver

Read only

Former Member
0 Likes
766

hi anvar thanks a lot.

similarly i had to split that(file) data in that file(based on size into small files).again i had to send this splitted file into application server.

can u help me in this regard.

Read only

0 Likes
766

hi siva,

Sorry, i am not sure how to do that.

can u post this requirement as a new question.

then others can help in this matter.

Rgds

Anver

Read only

Former Member
0 Likes
766

ok anvar

thank you

Read only

Former Member
0 Likes
766

hi anversha,

i have small doubt.the path of the file p_file should definitely be in application server. can it work if the file is in presentaion server(reg the code given by u.

regards

siva

Read only

0 Likes
766

hi,

u can run the Transaction CG3Z

to upload the file from local pc to application server.

rgds

anver