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

executable program to upload or download data from flatfile

Former Member
0 Likes
592

hi,

plz tell me is there any executable program to upload or download data from flatfile.

thanks.

4 REPLIES 4
Read only

Former Member
0 Likes
536

Hi,

There is no program as such.

You can write your own routine/program to upload and download the file.

Use FM: GUI_UPLOAD and GUI_DOWNLOAD.

Regards,

Subramanian

Read only

Former Member
0 Likes
536

You can write an ABAP program to do that,

Refer below link for sample codes:

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

Read only

Former Member
0 Likes
536

There may be programs but those program are specific purpose. There is no generic program as such loading the data from flat file.

RSTXSCRP is used to Upload or Download the SAP Script from Frontend or Application server.

Read only

former_member585060
Active Contributor
0 Likes
536

Try this code.

PARAMETERS : p_file type rlgrap-filename DEFAULT 'E:\EMP.TXT'.

PARAMETERS : p_psup RADIOBUTTON GROUP g1,

p_psdw RADIOBUTTON GROUP g1.

TYPES : BEGIN OF ty_emp,

empna(2) TYPE c,

empname(12) TYPE c,

empdoj(8) TYPE c,

dept(4) TYPE c,

END OF ty_emp.

DATA : it_emp TYPE TABLE OF ty_emp,

wa_emp TYPE ty_emp.

DATA : psfile TYPE string.

psfile = p_file.

IF p_psup = 'X'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = psfile

filetype = 'ASC'

has_field_separator = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = it_emp

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 <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ELSEIF p_psdw = 'X'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = psfile

filetype = 'ASC'

  • APPEND = ' '

write_field_separator = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = it_emp

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

Edited by: Bala Krishna on Aug 11, 2008 10:19 PM