Application Development 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: 

FM to upload the text file

Former Member
0 Kudos

I am trying to use the function "GUI_UPLOAD" to uplad atext file with delimiter as semicolon.But i do not see exporting parameter in this function "has_delimiter" where i can mention semicolon for my file uplaod purpose .What could be the reason ,the FM defintiona which i get is like

CALL FUNCTION 'GUI_UPLOAD'

  • EXPORTING

  • FILENAME = ' '

  • FILETYPE = 'ASC'

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab =

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_READ_ERROR = 2

  • NO_BATCH = 3

  • GUI_REFUSE_FILETRANSFER = 4

  • INVALID_TYPE = 5

  • OTHERS = 6

.

IF sy-subrc <> 0.

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

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

ENDIF.

Please suggest if there is any other FM to uplaod the text file with delimiter .

Thanks ,

Swati

6 REPLIES 6

Sandra_Rossi
Active Contributor
0 Kudos

in basis 6.20, there is parameter HAS_FIELD_SEPARATOR. You are probably using an older sap release. Thus you probably have to program it yourself (you will then use SPLIT ... AT ',' INTO TABLE internal_table abap statement for each line)

Former Member
0 Kudos

Hi,

I have tried the FM: GUI_UPLOAD, it has the separator.

The following is for your reference.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename =

  • FILETYPE = 'ASC'

    • HAS_FIELD_SEPARATOR = ' '*

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

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

I think you can put semicolon at HAS_FIELD_SEPARATOR = ' ; '.

Please try.

Regards,

Chris Gu

Edited by: Gu Chris on Nov 10, 2008 2:50 AM

Former Member
0 Kudos

Hi...

try this..


UPLOAD_FILES

Arunima

Former Member
0 Kudos

hi,

use this FM

'KCD_CSV_FILE_TO_INTERN_CONVERT'

Former Member
0 Kudos

Hi ,

Try this FM.

CALL METHOD cl_gui_frontend_services=>gui_upload

Regards

Abhi.

Please clsoe this thread as soon as your problem is solved.

I355602
Advisor
Advisor
0 Kudos

Hi Swati,

using HAS_FIELD_SEPARATOR with a semicolon ';' is not working.

Either you have to mention the records according to the space delimited i.e., if you have

a variable with 10 char and you have a value say 'ABC', then you should type

'ABC ' (value followed by remaining spaces to fill the total length)

or probably you can use 'lsmw' tool to sove your problem.

Thanks & Regards.

Tarun Gambhir.