Skip to Content
author's profile photo Former Member
Former Member

FM to upload the text file

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Posted on Nov 09, 2008 at 07:56 PM

    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)

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2008 at 01:48 AM

    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

Add a comment
10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2008 at 04:18 AM

    Hi...

    try this..

    UPLOAD_FILES
    

    Arunima

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2008 at 04:58 AM

    hi,

    use this FM

    'KCD_CSV_FILE_TO_INTERN_CONVERT'

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2008 at 05:09 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 10, 2008 at 10:24 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Before answering

    You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
    You must be Logged in to submit an answer.

    Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.