WS_FILENAME_GET, GUI_UPLOAD, charactors problem.

Hi All,
I use WS_FILENAME_GET to read a text file , and GUI_UPLOAD to upload the text content in to an internal table.
When i run it on a English version of Windows, there is no problem, whereas in a Chinese version of Windows the uploaded charactors, even an English content,  the uploaded content is changed into wierd charators.
Thank in advance.

Hai Kokwei
Check the following Code
for WS_FILENAME_GET
Begin of Add by Neelimab on 03/11/2005.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
   EXPORTING
     WINDOW_TITLE            = 'Find File'
     DEFAULT_EXTENSION       = 'C:\'
     DEFAULT_FILENAME        = ''
     FILE_FILTER             = ',..'
  CHANGING
    FILE_TABLE               = I_FILETABLE
    RC                       = V_RC
  EXCEPTIONS
    FILE_OPEN_DIALOG_FAILED = 1
    CNTL_ERROR              = 2
    ERROR_NO_GUI            = 3
    NOT_SUPPORTED_BY_GUI    = 4
    others                  = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE I_FILETABLE INTO P_FILE INDEX 1.
for GUI_UPLOAD
*-- Begin of add    Neelimab 21/11/2005
  DATA: D_FILENAME TYPE STRING.
  D_FILENAME = P_FILE.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                      = D_FILENAME
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = 'X'
      DAT_MODE                      = 'X'
    TABLES
      DATA_TAB                      = t_root.
Thanks & regards
Sreenivasulu P

Similar Messages

  • FM -  gui_upload. Problems uploading CSV format file

    Hi experts,
    I am facing an issue here. I tried to upload a .csv format file using FM - gui_load, in the table LT_RAW all the information is all in one column and rest of the columns are empty.
    How can i get the information to its respective fields?
    below are my codes:
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = pv_file
          READ_BY_LINE            = 'X'
          HAS_FIELD_SEPARATOR     = 'X'
          codepage                = '4110'
        IMPORTING
          filelength              = lv_filelength
        TABLES
          data_tab                = lt_raw
        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.
    I can only upload using .CSV format.

    Hi Suhas,
    below is the new code that i used. now the data is not filled in only one column,
    Instead it will fill up the max length of the field and continue the data in other field and fill up its max length of the field.
    " my declaration of lt_raw and ls_raw
    lt_raw            TYPE TABLE OF ZCTD_MIGCUSTOMER,
    ls_raw            like line of lt_raw,
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = pv_file
          codepage                = '4110'
        IMPORTING
          filelength              = lv_filelength
        TABLES
          data_tab                = lt_raw
        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.

  • Asian-English Charactors problem with iTunes

    I have two computers. Both of them are PCs with Windows XP Pro OS. However, one of them has Asian Language package installed. First, I transfered Asian songs through the Asian Language PC. The Asian language ID3 tags displayed correctly in the iTunes and iPod. After, I connected the iPod to my other PC. All the Asian language ID3 tags were messed up on both iTunes and iPod. Is there any way that I can prevent this problem happen again, if I switch the connections of my iPod between the two PCs?

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    tt2

  • GUI_UPLOAD data problem

    we are uploading .DAT file in following program, after uploading the data into sap system, we are not able to see the complete data
    first row last two three fields are missing, the total field values length is 331 character, even if i given the 5000 character also same values is showing when i runtime.
    even i have dowloaded the tabtyp_tbl at runtime into .DAT format, i am not able to see the last field values
    please provide the reason behind this one
    SELECTION-SCREEN BEGIN OF BLOCK file WITH FRAME TITLE text-s01.
    PARAMETERS:
             r1 RADIOBUTTON GROUP rad1 DEFAULT 'X',
             p_file_u TYPE file DEFAULT
                       'XXX_TR.DAT',
             r2 RADIOBUTTON GROUP rad1,
             p_file TYPE localfile.
    SELECTION-SCREEN END OF BLOCK file.
    TYPES: BEGIN OF rectyp_tbl,
           data(331),                       "tarn72 "gb13032009 D
             data(5000),                       "gb13032009 I
           end(2),
      END OF rectyp_tbl.
      data : tabtyp_tbl TYPE standard TABLE OF rectyp_tbl.
                WITH NON-UNIQUE DEFAULT KEY
                INITIAL SIZE 500."gb13032009 D
                 INITIAL SIZE 1000."gb13032009 I
    DATA:
          l_gui_filename  TYPE string,     " Filetype
          l_gui_filetype(10)   TYPE c,     " Filetype
          l_gui_filz         TYPE i.       " Filesize
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          mask      = ',TR.DAT file,tr*.dat'
          static    = 'X'
        CHANGING
          file_name = p_file.
        MOVE p_file TO l_gui_filename.
        MOVE 'ASC'      TO l_gui_filetype.
    start-of-selection.
    CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename        = l_gui_filename
            filetype        = l_gui_filetype
    HAS_FIELD_SEPARATOR     = 'X'
          IMPORTING
            filelength      = l_gui_filz
          TABLES
            data_tab        = tabtyp_tbl
          EXCEPTIONS
            file_open_error = 01
            file_read_error = 02
            invalid_type    = 03
            unknown_error   = 04.
        CASE sy-subrc.
          WHEN 01.
            MESSAGE e000(fb) WITH 'Cannot open file'(125) p_file.
          WHEN 02.
            MESSAGE e000(fb) WITH 'Cannot read file'(126) p_file.
          WHEN 03.
            MESSAGE e000(fb) WITH 'File'(127) p_file
                              'has invalid file type'(128) l_gui_filetype.
          WHEN 04.
            MESSAGE e000(fb) WITH 'Unknown error, file'(129) p_file.
        ENDCASE.

    Hi ,
    There are few very little changes that I want to suggest you, please make the below made changes into your existing code and try to execute.
    data : tabtyp_tbl TYPE standard TABLE OF rectyp_tbl with header line.
    start-of-selection.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = l_gui_filename
    filetype = l_gui_filetype
    *HAS_FIELD_SEPARATOR = 'X' " REMOVE THIS PARAMETER
    *IMPORTING " REMOVE - NO NEED
    *filelength = l_gui_filz " REMOVE - NO NEED
    TABLES
    data_tab = tabtyp_tbl[] " BRACKETS
    EXCEPTIONS
    file_open_error = 01
    file_read_error = 02
    invalid_type = 03
    unknown_error = 04.
    CASE sy-subrc.
    WHEN 01.
    MESSAGE e000(fb) WITH 'Cannot open file'(125) p_file.
    WHEN 02.
    MESSAGE e000(fb) WITH 'Cannot read file'(126) p_file.
    WHEN 03.
    MESSAGE e000(fb) WITH 'File'(127) p_file
    'has invalid file type'(128) l_gui_filetype.
    WHEN 04.
    MESSAGE e000(fb) WITH 'Unknown error, file'(129) p_file.
    ENDCASE.
    Hope this will solve your issue.
    Regards,
    Ashish Arora

  • Comma seperated file uploading

    Hi ,
    i want to upload comma seperated file into sap.
    iam using 'GUI_UPLOAD' fm.
    problem is flat file currency field it is also contains comma.
    i can't change file type comma to tab.
    How can i upload currency fields with comma.
    Regards,
    Suresh.

    You can upload your file into a string table. Now split it:
    split uploadtab at ',' into table items.
    if you have
    a,b,c,11,d,e,f
    your tables items contains 7 elements now.
    if you have
    a,b,c,11,22,d,e,f
    your table contains 8 elements now. In that case you now that you have splitted a number with a comma and need to do some actions, e.g. merge elements 4 and 5 together to get 11,22 again and shift the 6th to 5th, the 7th to 5th and the 8th to 7th element.
    After that you number is again in item 4.
    An easier way is to enforce you customer to put values into apostrophes or quotes. If this is not possible, you have to check if an unwanted split was taken in place and act as shown above.
    But: this will work only if one item with a comma in between. If oyu have more components you can not evaulate where the unwanted split is in effect.

  • Problem in GUI_Upload only first field is appending into table

    Hi all,
      I m using code :-
    DATA : BEGIN OF RAWDATA OCCURS 0,
            RECORD type string,
           END OF RAWDATA.
      CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            FILENAME                      = g_file
            FILETYPE                      = 'DAT'
            HAS_FIELD_SEPARATOR           = 'X'
          TABLES
            DATA_TAB                      = RAWDATA
         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
    structure of g_file is like ---
    TEST1     MAT1     2     EA     15.00     1
    TEST2     MAT2     2     EA     20.00     1
    TEST3     MAT1     2     EA     15.00     1
    TEST4     MAT2     2     EA     25.00     1
    TEST5     MAT2     2     EA     30.00     1
    now my problem is in rawdata table record is coming as
    test1
    test2
    but i need it as
    test1mat12EA.......
    Thanks & Regards,
    Ruchi Tiwari

    Hi Ruchi,
    Are you using excel sheet to upload or text file?
    If you are using excel sheet for uplaoding then you can refer to the below code:
    P_FILE                 TYPE FILE_NAME OBLIGATORY.
    lv_FILE = P_FILE.
    ****************** CALL FUNCTION MODULE GUI_UPLOAD******************
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME = lv_FILE
          FILETYPE = 'ASC'
        TABLES
          DATA_TAB = it_string.
      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 hope this helps.
    Thanks,
    Archana

  • Bdc upload file data into internal table problem with gui_upload fm

    Hello experts,
    my coding is like this ..
    data : begin of itab occurs 0 .
    field1 like mara-matnr,
    field2......
    etc,
    end of itab.
    data: file1 type string.
    parameter :file like rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
    static = 'X'
    mask = space
    field_name = 'FILE'
    CHANGING
    file_name = file.
    START-OF-SELECTION.
    FILE1 = FILE . "HERE I AM PASSING INTO STRING
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = FILE1
    FILETYPE = 'ASC'
    has_field_separator = 'X'
    TABLES
    data_tab = itab. " here the data is not populating from the file , it is giving the error like speified table not found.
    HERE i am getting the message like "specified table name not recgonised" . the data is not populating into the itab from the file.
    file structure is same as the internal table.
    I stored the file as .txt( ie in notepad).
    my file is like this..
    10000 200 323 sunndarrr.......
    i had a problem with this bdc , i am getting like "specified table name not recgonised" in the fm gui_upload while debugging.
    when i am using the ws_upload it is working fine.
    please guide me where i have done the mistake.
    thank you so much for all the replies.

    Hi,
    Have a look on the following code.
    TABLES: kna1.
    DATA: BEGIN OF itab1 OCCURS 0,
          str(255),
          END OF itab1.
    DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'WS_UPLOAD'
      EXPORTING
        filename                = 'D:\ABAP EVE\ffile1.txt'
        filetype                = 'ASC'
      TABLES
        data_tab                = itab1
      EXCEPTIONS
        conversion_error        = 1
        file_open_error         = 2
        file_read_error         = 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                  = 11.
    IF sy-subrc <> 0.
      WRITE:/ 'sorry'.
    ELSE.
      LOOP AT itab1.
        SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
        APPEND itab2.
      ENDLOOP.
      IF sy-subrc = 0.
        LOOP AT itab2.
          WRITE:/ itab2-kunnr,itab2-name1.
          INSERT INTO kna1 VALUES itab2.
        ENDLOOP.
        IF sy-subrc = 0.
          WRITE:/ 'inserted'.
        ELSE.
          WRITE:/ 'not inserted'.
        ENDIF.
      ELSE.
        WRITE:/ 'fail'.
      ENDIF.
    ENDIF.
    Flat file:
    10001,Sadney
    10003,Yogesh
    20005,Madan
    1.U need to define internal table with one field of max size
    2.upload the flat file data into that internal table
    3.split that internal table data into another internal table(having fields)
    <REMOVED BY MODERATOR>
    thanks,
    Chandu
    Edited by: Alvaro Tejada Galindo on Apr 30, 2008 12:17 PM

  • GUI_UPLOAD - Problem in uploading xml file

    Hi,
    I have problem in uploading xml file into itab.
    Here is the code
    begin of GS_STRING,
            STR(72) type C,
          end of GS_STRING,
          GT_STRING like standard table of GS_STRING,
    call function 'GUI_UPLOAD'
          EXPORTING
            FILENAME                = FILE_NAME
            FILETYPE                = 'ASC'
          TABLES
            DATA_TAB                = GT_STRING
          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 I499(SY) with 'File upload failed'.
          stop.
        endif.
      endif.
    In debuggin mode, i can see the itab uploaded with xml payload. But in that same place, the hexadecimal format has double zeros 00 after each character.
    XML message : <?xml
    Correct Hexadecimal : 3C3F786D6C
    Hexadecimal in itab  : 3C003F0078006D006C00
    This makes the resultant xml invalid.
    can anyone help me to solve this?
    Thanks,
    Uma
    Edited by: Uma Maheswari on May 30, 2008 4:15 PM

    what do you want to do with the uploaded XML?
    i use the following
    constants: line_size type i value 255.
    data: begin of xml_tab occurs 0,
               raw(line_size) type x,
            end   of xml_tab,
            file  type string,
            size  type i.
    call function 'GUI_UPLOAD'
        exporting
          filename            = filename
          filetype            = 'BIN'
          has_field_separator = ' '
          header_length       = 0
        importing
          filelength          = size
        tables
          data_tab            = xml_tab
        exceptions
          others              = 1.

  • GUI_UPLOAD PROBLEM Exception : bad file format

    Hi All i am using GUI_UPLOAD FM to upload some data fromm excel file.
    cade is as folloes :
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                    = p_v_file
       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            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
        TABLES
          data_tab                      = it_data[]
    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.
    but data is not upladed and gives me the exception 8 : bad_data_format               = 8
    PLS HELP....
    THANKS..

    I have a problem close to this .
    I want to upload a file in SAP, I am using a recorded Script but I want to give the File and path directly in the script file. Is there anyone who can help me to change this line :
    session.findById("wnd[0]/usr/tabsTAB_MAIN/tabpTSMAIN/ssubSCR_MAIN:SAPLCV110:0102/btnPB_FILE_BROWSER").press
    Here is the complete recorded code for CV01N:
    If Not IsObject(application) Then
       Set SapGuiAuto  = GetObject("SAPGUI")
       Set application = SapGuiAuto.GetScriptingEngine
    End If
    If Not IsObject(connection) Then
       Set connection = application.Children(0)
    End If
    If Not IsObject(session) Then
       Set session    = connection.Children(0)
    End If
    If IsObject(WScript) Then
       WScript.ConnectObject session,     "on"
       WScript.ConnectObject application, "on"
    End If
    session.findById("wnd[0]").resizeWorkingPane 92,24,false
    session.findById("wnd[0]/tbar[0]/okcd").text = "cv01n"
    session.findById("wnd[0]").sendVKey 0
    session.findById("wnd[0]/usr/ctxtDRAW-DOKNR").text = "filename foe SAP-test1"
    session.findById("wnd[0]/usr/ctxtDRAW-DOKAR").text = "mtx"
    session.findById("wnd[0]/usr/ctxtDRAW-DOKAR").setFocus
    session.findById("wnd[0]/usr/ctxtDRAW-DOKAR").caretPosition = 3
    session.findById("wnd[0]").sendVKey 0
    session.findById("wnd[1]").sendVKey 0
    session.findById("wnd[0]/usr/tabsTAB_MAIN/tabpTSMAIN/ssubSCR_MAIN:SAPLCV110:0102/txtDRAT-DKTXT").text = "Description for file upload in SAP"
    session.findById("wnd[0]/usr/tabsTAB_MAIN/tabpTSMAIN/ssubSCR_MAIN:SAPLCV110:0102/txtDRAT-DKTXT").caretPosition = 34
    session.findById("wnd[0]/usr/tabsTAB_MAIN/tabpTSMAIN/ssubSCR_MAIN:SAPLCV110:0102/btnPB_FILE_BROWSER").press
    session.findById("wnd[0]/tbar[0]/btn[11]").press
    session.findById("wnd[0]/tbar[0]/btn[15]").press

  • Problem with FM gui_upload

    Hello
    I use fonction GUI_UPLOAD with the following parameters:
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = w_nomfic
          filetype                      = 'ASC'
          has_field_separator           = 'X'
          dat_mode                      = 'X'
        TABLES
          data_tab                      = temp_contrat
       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.
    My table temp_contrat is defined as follow :
    DATA : BEGIN OF temp_contrat OCCURS 0,
            fico_lifnr2 TYPE lifnr,
            fico_matnr TYPE matnr,
            fic_ktmng TYPE ktmng,
            fic_netpr TYPE netpr,
            fic_plifz(3),
            fic_fia TYPE z_maj_creat_fia,
            fic_loekz TYPE z_loekz,
            fic_ztyp_ha TYPE ztyp_ha,
            fic_rsa TYPE z_maj_creat_rsa,
            fic_rsa_non_sup TYPE z_rsa_non_sup,
            fic_evers TYPE evers,
            fic_kodatab TYPE kodatab,
            fic_kodatbi TYPE kodatbi,
            END OF temp_contrat.
    I have a problem with two fields date : fic_kodatab and fic_kodatbi
    In my file :
    if this two fields are not filled : no problem.
    if this two fields are empty : no problem.
    If the first field (fic_kodatab) is filled and the second field is empty: no problem
    But, if the first field is empty and the second field is fielled : problem, the FM returns code 8.
    I don't understand the problem. Can you help me ?

    hi if this is excel use this ..
    REPORT  ZTESTPROG003.
    TYPES:
         BEGIN OF ty_upload,
         matnr like mara-matnr,
         meins like mara-meins,
         mtart like mara-mtart,
         mbrsh like mara-mbrsh,
         END OF ty_upload.
      DATA it_upload TYPE STANDARD TABLE OF ty_upload WITH header line.
      DATA wa_upload TYPE ty_upload.
      DATA: itab TYPE STANDARD TABLE OF alsmex_tabline WITH header line.
    DATA itab TYPE STANDARD TABLE OF ty_upload WITH header line.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename    = 'C:\Documents and Settings\venkatapp\Desktop\venkat.xls'
          i_begin_col = 1
          i_begin_row = 1
          i_end_col   = 4
          i_end_row   = 65535
          TABLES
          intern      = itab.
    if not itab[] is initial.
    loop at itab .
    case itab-col.
    when '0001'.
    it_upload-matnr = itab-value.
    when '0002'.
    it_upload-meins = itab-value.
    when '0003'.
    it_upload-mtart = itab-value.
    when '0004'.
    it_upload-mbrsh = itab-value.
    append it_upload.
    clear it_upload.
    clear itab.
    endcase.
    endloop.
    endif.
    loop at it_upload.
    write:/ it_upload-matnr,it_upload-meins,it_upload-mtart,it_upload-mbrsh.
    endloop.

  • Problem with GUI_UPLOAD FM

    Hi All,
    I have trouble using the FM GUI_UPLOAD. I am using this FM to upload text-delimited file data into an ITAB of same structure. The problem is that it is reading only the 1st record and returning sy-subrc = 8. The no of columns in file is 89. When I am reducing the no of columns of this file, then it is reading the data. There is not data format conversion problem, I have check the same. Does any one know why this is happening? Thanks in advance.
    Regards,
    Prashant.

    hi prashant,
    try this oops concept.
    CALL METHOD cl_gui_frontend_services=>gui_upload
       EXPORTING
          filename                = l_v_filepc
          filetype                =   'TXT'
          has_field_separator     = ' '
         header_length           = 0
         read_by_line            = 'X'
         dat_mode                = SPACE
         codepage                = SPACE
         ignore_cerr             = ABAP_TRUE
         replacement             = '#'
         virus_scan_profile      =
        IMPORTING
         filelength              =
         header                  =
        CHANGING
          data_tab                =  fp_it_pernr_infty "fp_it_pernr
        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
          not_supported_by_gui    = 17
          error_no_gui            = 18
          OTHERS                  = 19      .
      IF sy-subrc <> 0.
      ENDIF.

  • Decimals Problem with GUI_UPLOAD

    Hi Experts,
    Can any one help me,
    I am using GUI_UPLOAD FM,the problem is the Decimal Format of the Data which I am uploading is changing to another format.
    When using WS_UPLOAD its working fine.
    Example:
    In SAP it is trying to post as 1 249 400,00 CZK, however it's only 12 494,00 CZK.
    value which i am passing to FM is 12494.00
    But its converting to 00000001249400
    the field is of type N length is 14.

    Hi SAP58,
      Try these
    1. Try passing the value as 12494,00 or 12494 to the function module
    2. Check the user settings
    3. And importanly try debugging the program once, Check how thw value is getting populated to the field(of type N)
    Regards,
    Amuktha

  • GUI_UPLOAD - EXCEL FILE PROBLEM

    Hi All,
            I am using GUI_UPLOAD function for BDC. I want to upload a file but there i m gatting error. I tried with both  file type excel & txt.
    While running the recording it takes ##### chars.
    Regards,
    Dilip
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = 'c:\excel.xls'
       FILETYPE                      = 'BIN'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      tables
        data_tab                      = it_bdc

    Dear Dilip,
    I have used GUI_UPLOAD a lot, but never like this.
    Well i'll tell you to upload .txt file . Download or save EXCEL file as text delimited by tab as it gets saved normally. Dont forget that except characters all other fields are in formatted as text field in Excel, they will get alinged as a normal text field only.
    My txt file have data like below.
    RAJESH     10
    RAJSALECHA     11
    BCONE     13
    Then in program i have done as below.
    Report ZTEST5.
    PARAMETERS : FILE TYPE RLGRAP-FILENAME.
    DATA : BEGIN OF IT OCCURS 0,
             NAME(20),
             AGE(4),
           END OF IT.
    DATA : PATH TYPE STRING.
    PATH = FILE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = PATH
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      TABLES
        DATA_TAB                      = IT.
    LOOP AT IT.
    WRITE : /1 IT-NAME COLOR 1, 20 IT-AGE COLOR 4.
    ENDLOOP.
    Kindly see this and tell me if you face any problem in it.
    Raj Salecha
    [email protected]

  • Problem with GUI_UPLOAD using excel sheet

    Hi,
      I am trying to upload excel sheet thru GUI_UPLOAD ... this excel sheet has a header line and 3 line of data. Even if I remove the header line then also the internal while debugging is showing 28 lines of entries with "#" "squares" in some columns ... while in others where data should be there shows all Zeros....
    The excel sheet has the following info
    Rate Type Valid From Date     From Currency     To Currency      Indirect Quote     Direct Quote
    M       29.09.2006             SGD             USD             1.6932     
    M       29.09.2006             USD             SGD                          1.6932
    M       29.09.2006             SGD             MYR                          2.19653
    KURST GDATU    FCURR TCURR INUKURS     DUKURS
    ###&#2161; |########|#####|### #|   0.00000 |0.00000 |
    ##29 |00000000|     |     |   0.00000 |0.00000 |
    o#d# |00000000|     |     |   0.00000 |0.00000 |
    The code that I am writing is as follows:-
    *& INTERNAL TABLES
    DATA : BEGIN OF T_INPUT occurs 0,
             KURST   LIKE TCURV-KURST,  " Exchange rate type
             GDATU   LIKE SY-DATUM,     " Date from which rate is effective
             FCURR   LIKE TCURC-WAERS,  " From currency
             TCURR   LIKE TCURC-WAERS,  " To currency
             INUKURS LIKE TCURR-UKURS,  " Indirect Quote
             DUKURS  LIKE TCURR-UKURS,  " Direct Quote
           END OF T_INPUT.
                S T A R T - O F - S E L E C T I O N                      *
    START-OF-SELECTION.
    Perform to upload the excel file.
      PERFORM UPLOAD_EXCEL_FILE.
    FORM UPLOAD_EXCEL_FILE .
      DATA: L_FILENM TYPE STRING.
      L_FILENM = P_FILENM.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                      = L_FILENM
          FILETYPE                      = 'ASC'
          HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
        TABLES
          DATA_TAB                      = T_INPUT
       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.

    Hi SB,
    pls change the data type declared for 'valid from date'
    from
    DATA : BEGIN OF T_INPUT occurs 0,
    KURST LIKE TCURV-KURST, " Exchange rate type
    <b>GDATU LIKE SY-DATUM,</b> " Date from which rate is effective
    FCURR LIKE TCURC-WAERS, " From currency
    TCURR LIKE TCURC-WAERS, " To currency
    INUKURS LIKE TCURR-UKURS, " Indirect Quote
    DUKURS LIKE TCURR-UKURS, " Direct Quote
    END OF T_INPUT.
    to
    DATA : BEGIN OF T_INPUT occurs 0,
    KURST LIKE TCURV-KURST, " Exchange rate type
    GDATU(10) type c, " Date from which rate is effective
    FCURR LIKE TCURC-WAERS, " From currency
    TCURR LIKE TCURC-WAERS, " To currency
    INUKURS LIKE TCURR-UKURS, " Indirect Quote
    DUKURS LIKE TCURR-UKURS, " Direct Quote
    END OF T_INPUT.
    Cheers,
    Vikram
    Please reward for helpful replies!!

  • Problem in GUI_UPLOAD function module

    Hi Folks,
    I am in the BI system where I have limited scope of upload function module, So I used GUI_UPLOAD as a upload function module.
    I am uploading CSV file and which have amount field (with comma ',' ) as one of the column , So it is truncating the other columns while retrieving data into internal table and giving wrong data in columns.
    Any other Function module, or tricks to upload file which have ',' in one of the column.
    Thanks
    PP

    Hi,
    Well in this case you will have to change the file format i.e. Instead of CSV make it tab delimited etc.
    Else change the amount value by replacing comma(which woud be a tedious task).
    There is no other alternative.
    Best regards,
    Prashant

Maybe you are looking for

  • Problem in sql query because of order by clause

    Hi All, I am facing a one problem in my one sql query.I am using Oracle 10gR2. Query is given below: SELECT t1.ename         FROM T1, T2        WHERE T1.EMPNO = 1234          AND T1.ACCOUNTNO = T2.ACCOUNTNO          AND T1.SEQ = T2.SEQ        ORDER B

  • Sss_error_access_denied

    I keep getting this error when accessing a particular site. Full text of the error is: (Error code: ssl_error_access_denied_alert) The site: https://research.verveengine.co.uk/WebProd/cgi-bin/askiaext.dll?Action=StartSurvey&SurveyName=SoapSponsorship

  • Intrv questions

    hi experts... some questions 1) HOW TO DEBUG OUTBOUND PROGRAM AND INBOUND PROGRAM IN ALE/IDOC?

  • Unable to log into GDM

    When I attempt to log into GDM (by selecting my user and typing in the password) it never gets past the log in screen. It's actually not locked up, the buttons (cancel and login) are still responsive, just never get into gnome. Relevant: I had to rei

  • Formula to find MAX

    Hi, I calculate 5 diffrent key figures in 5 different fomulas in a query. Now In the 6th formula , I want to calculate the maximum among (formula1 , form2 .. formula 5 ) and diplayed in the Formula 6.  This should happen for all the rows. Let me know