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

UPDATING FILES

Former Member
0 Likes
507

Hi i want to upload files from presentation server/application server to an internal table and that file may be either a text file or an excel file!! how to do dat?

Hi i want to upload files from presentation server/application server to an internal table and that file may be either a text file or an excel file!! how to do dat?

2 REPLIES 2
Read only

Former Member
0 Likes
450

Hi,

Please check the code below:

types: BEGIN OF tyt_dummy,

dummy(1000) TYPE c,

END OF tyt_dummy.

data: gt_dummy type standard table of tyt_dummy initial size 0.

CLEAR gv_file.

gv_file = pa_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = gv_file

filetype = 'ASC'

has_field_separator = gc_x

TABLES

data_tab = gt_dummy

EXCEPTIONS

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

OTHERS = 17.

IF sy-subrc NE gc_zero_num.

MESSAGE e006.

ENDIF.

  • Check if the input file is blank

IF gt_dummy[] IS INITIAL.

MESSAGE e007.

ENDIF.

LOOP AT gt_dummy INTO gs_dummy.

gv_tabix = sy-tabix.

DO.

IF gs_dummy CA gc_z.

REPLACE gc_z WITH gc_a INTO gs_dummy.

ELSE.

WRITE gs_dummy TO gs_dummy NO-GAP.

CONDENSE gs_dummy.

MODIFY gt_dummy INDEX gv_tabix FROM gs_dummy.

EXIT.

ENDIF.

ENDDO.

ENDLOOP.

Regards

Kannaiah

Read only

Former Member
0 Likes
450

for Uploading file from applciation server

http://www.sapdevelopment.co.uk/file/file_uploadsap.htm

for Uploading file from presentation server

http://www.sapdevelopment.co.uk/file/file_uploadpc.htm

Regards,

Santosh