2007 Mar 14 1:35 PM
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?
2007 Mar 14 1:37 PM
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
2007 Mar 14 1:40 PM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |