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

Re:upload

Former Member
0 Likes
509

Hi I have written a code below,

but I am getting a error like 'file not found'.

&----


*& Report ZUPLOAD

*&

&----


*&

*&

&----


REPORT ZUPLOAD.

data : begin of i_kna1 occurs 0 ,

kunnr like kna1-kunnr,

name1 like kna1-name1,

ort01 like kna1-ort01,

end of i_kna1.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\Documents and Settings\sashibhushank\My Documents\sasi.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE = VIRUS_SCAN_PROFILE

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH = FILELENGTH

  • HEADER = HEADER

TABLES

data_tab = I_KNA1

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

loop at i_kna1 .

write i_kna1.

endloop.

Can any one solve my problem? I will give u full points.

Thanks&regards

Sashi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
490

Hi,

Have you given the correct location in filename. Try executing the FM giving same data in Se37. See if this works there.

Regards,

ramya

3 REPLIES 3
Read only

Former Member
0 Likes
491

Hi,

Have you given the correct location in filename. Try executing the FM giving same data in Se37. See if this works there.

Regards,

ramya

Read only

Former Member
0 Likes
490

hi,

try this

data : begin of i_kna1 occurs 0 ,

kunnr like kna1-kunnr,

name1 like kna1-name1,

ort01 like kna1-ort01,

end of i_kna1.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\Documents and Settings\sashibhushank\My Documents\sasi.txt'

FILETYPE = 'DAT'

*HAS_FIELD_SEPARATOR = 'X'

*

*

*HEADER_LENGTH = 0

*READ_BY_LINE = 'X'

*

*DAT_MODE = ' '

*CODEPAGE = ' '

*IGNORE_CERR = ABAP_TRUE

*REPLACEMENT = '#'

*CHECK_BOM = ' '

*VIRUS_SCAN_PROFILE = VIRUS_SCAN_PROFILE

*NO_AUTH_CHECK = ' '

*IMPORTING

*FILELENGTH = FILELENGTH

*HEADER = HEADER

TABLES

data_tab = I_KNA1

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

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

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

ENDIF.

loop at i_kna1 .

write i_kna1.

endloop.

and better u change the path like short: c:\sam.txt or D:\1.txt

Read only

Former Member
0 Likes
490

hi,

try this code and use ur fields and table.

tables:mara.

data:begin of i_header occurs 0,

field(30) type c,

end of i_header,

begin of itab occurs 0,

matnr type mara-matnr,

ersda type mara-ersda,

ernam type mara-ernam,

laeda type mara-laeda,

end of itab.

select matnr ersda ernam laeda from mara into corresponding fields of table itab.

REFRESH i_header.

i_header-field = 'Material number'.

append i_header.

i_header-field = 'creation Date'.

append i_header.

i_header-field = 'name of person'.

append i_header.

i_header-field = 'last date'.

append i_header.

clear i_header.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE = ' '

  • CODEPAGE = ' '

FILENAME = 'D:\prsr\3.xls'

FILETYPE = 'DAT'

  • MODE = ' '

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = itab

FIELDNAMES = i_header

EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_WRITE_ERROR = 2

  • INVALID_FILESIZE = 3

  • INVALID_TYPE = 4

  • NO_BATCH = 5

  • UNKNOWN_ERROR = 6

  • INVALID_TABLE_WIDTH = 7

  • GUI_REFUSE_FILETRANSFER = 8

  • CUSTOMER_ERROR = 9

  • NO_AUTHORITY = 10

OTHERS = 0

.

IF sy-subrc <> 0.

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

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

ENDIF.

reward if its useful