Skip to Content
0
Former Member
Sep 21, 2007 at 09:25 AM

splitting problem wile uploading file

37 Views

hi experts,

i am getting splitting error wile uploading the file from local drive from teh below code.

could any on ehelp me how to solve that error.

form upload_file.

data: w_matnr like mara-matnr,

w_datum like sy-datum.

data:

w_file1 type zppiforecast.

move p_file to w_line.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = W_LINE

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 =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = I_FILE

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.

message w005(z1) with 'File ' p_file ' cannot be opened'.

ENDIF.

loop at i_file into w_file1.

call function 'CONVERSION_EXIT_MATN1_INPUT'

exporting

input = w_file1-matnr

importing

output = w_matnr

exceptions

length_error = 1

others = 2.

i_file-index = sy-index.

*Check that the date is in the correct format.

call function 'CONVERT_DATE_TO_INTERN_FORMAT'

exporting

datum = w_file1-datum

dtype = 'DATS'

importing

error = w_error

idate = w_file1-datum

messg = w_messg

msgln = w_msgln.

*If an error has occurred write entry to error table, otherwise append

*record list

if not w_error is initial.

t_exception = i_file.

t_exception-message = text-006.

append t_exception.

else.

check i_file-datum in so_datum.

modify i_file from w_file1 index sy-tabix.

endif.

endloop.

endform. " upload_file