GUI_UPLOAD file upload.

Hi,
  i am reading a text file using GUI_UPLOAD.
but agter reading the file when i am looking into table its reading upto only position 256 of each line.
i need to read full line upto position 500 of the text file .. please guide me in this case.
thnx
vikash

hi vikash
you have to increase the size of internal table.
like suppose you have internal table ITAB it contans 3 fields
data : begin of itab occurs 0,
text(500) type c, " here you downloading the text so check the length
line_num type i,
pname(30) type c,
end of itab
data : p_file type string.
p_file = 'c:\test'.
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename                      = p_file
  FILETYPE                      = 'DAT'            " check formt either DAT or ASC or DBF
HAS_FIELD_SEPARATOR           = 'X '
  tables
    data_tab                      = itab
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.
hope this will helpfull for you.

Similar Messages

  • GUI_UPLOAD not working for text file upload with '|' as a saperater

    Dear all,
    I have used 'GUI_UPLOAD' to upload data from text file having below format,
    1000|HBK1|HKTI
    1000|HBK2|HKTI
    1000|HBK3|HKTI
    My code is as below
    *& Report  ZTEST_NEW1
    REPORT  ZTEST_NEW1.
    TYPE-POOLS: truxs,
                kcde.
    TYPES :     BEGIN     OF             ty_data2          ,
                zbukr     TYPE           payr-zbukr       ,
                hbkid     TYPE           payr-hbkid       ,
                hktid     TYPE           payr-hktid       ,
               END       OF             ty_data2         .
    DATA :            it_file   TYPE           filetable        .
    DATA :      wa_file   LIKE LINE OF   it_file          .
    DATA :      w_rc      TYPE           i                ,
                lv_file   TYPE           string           .
    DATA : it_data2 TYPE TABLE OF ty_data2,
           wa_data2 LIKE LINE OF it_data2.
    SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-020.
    PARAMETER : pr_file   TYPE           rlgrap-filename         .
    SELECTION-SCREEN END OF BLOCK bk1                            .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pr_file.
      PERFORM get_file.
    START-OF-SELECTION.
      PERFORM get_data.
    FORM get_file .
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
    *  EXPORTING
    *    WINDOW_TITLE            =
    *    DEFAULT_EXTENSION       =
    *    DEFAULT_FILENAME        =
    *    FILE_FILTER             =
    *    INITIAL_DIRECTORY       =
    *    MULTISELECTION          =
    *    WITH_ENCODING           =
        CHANGING
          file_table              = it_file
          rc                      = w_rc
    *    USER_ACTION             =
    *    FILE_ENCODING           =
       EXCEPTIONS
         file_open_dialog_failed = 1
         cntl_error              = 2
         error_no_gui            = 3
         not_supported_by_gui    = 4
         OTHERS                  = 5
      IF sy-subrc EQ 0.
        CLEAR : wa_file.
        LOOP AT it_file INTO wa_file.
          pr_file = wa_file-filename.
          CLEAR : wa_file.
        ENDLOOP.
      ELSE.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " get_file
    FORM get_data .
    IF pr_file IS INITIAL.
        MESSAGE 'Enter file name'(002) TYPE 'E'.
      ENDIF.
      IF pr_file CP '*.xls'
        or pr_file CP '*.xlsx' . " Added
      ELSEIF pr_file CP '*.txt'.
    CONSTANTS : c_del TYPE c LENGTH 1 VALUE '|'.
        lv_file = pr_file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = lv_file
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = c_del
    *   HEADER_LENGTH                 = 1
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      TABLES
        DATA_TAB                      = it_data2
    * 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.
    endif.
    ENDFORM.                    " get_data
    In my output I am only getting company codes and not getting other two columns, can any body guide me where I am doing wrong?
    I have checked many other same kind of threads and I have done the same as suggested to do but still I am facing issue.
    Thanks in advance.
    Regards,
    Umang

    Hi Umang,
    There is a simple solution to this problem. Make the following changes to your code(marked in red color):
    REPORT  ZTEST_NEW1.
    TYPE-POOLS: truxs,
                kcde.
    TYPES :     BEGIN     OF             ty_data2          ,
                zbukr     TYPE           payr-zbukr       ,
                hbkid     TYPE           payr-hbkid       ,
                hktid     TYPE           payr-hktid       ,
               END       OF             ty_data2         .
    types: begin of ty_data
                 str type char200,
               end of ty_data.
    DATA: it_data type table of ty_data,
               wa_data type ty_data.
    DATA :            it_file   TYPE           filetable        .
    DATA :      wa_file   LIKE LINE OF   it_file          .
    DATA :      w_rc      TYPE           i                ,
                lv_file   TYPE           string           .
    DATA : it_data2 TYPE TABLE OF ty_data2,
           wa_data2 LIKE LINE OF it_data2.
    rest of the code **
    FORM get_data .
    IF pr_file IS INITIAL.
        MESSAGE 'Enter file name'(002) TYPE 'E'.
      ENDIF.
      IF pr_file CP '*.xls'
        or pr_file CP '*.xlsx' . " Added
      ELSEIF pr_file CP '*.txt'.
    CONSTANTS : c_del TYPE c LENGTH 1 VALUE '|'.
        lv_file = pr_file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = lv_file
       FILETYPE                      = 'ASC'
    *HAS_FIELD_SEPARATOR           = c_del                    "comment this line
    HEADER_LENGTH                 = 1
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
    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.
    endif.
    Loop at it_data into wa_data.
    split wa_data-str at '|' into wa_data2-zbukr wa_data2-hbkid wa_data2-hktid.
    append wa_data2 to it_data2.
    clear wa_data2.
    Endloop.
    ENDFORM.                    " get_data
    IT_DATA2 will contain the final uploaded data. Hope this helps

  • Flat file(Binary file) upload using GUI_UPLOAD

    I had uploaded a Binary file Using GUI_UPLOAD , File type was 'BIN'.
    but the data i got in Internal Table was in 0's and 1's.
    whereas i tried the same thing on a different server but  the same Version it gave me the data as text in Internal Table.
    what could be reason..or wat could be done to resolve this.

    Did you declare the internal table used to upload the binary file as TYPE X ?
    begin of itab,
      raw(255) type x,
    end of itab occurs 0.
    CALL FUNCTION 'GUI_UPLOAD'
       exporting
          filetype =  'BIN'
          filename = 'C:DOWNLOAD.BIN'
       tables
          data_tab = itab.
    Always remember to reward snippets you find useful!

  • File uploading / downloading

    hello all,
    can any one explain me about file uploading and downloading.
    how the FM's GUI_UPLOAD and DOWNLOAD works,
    also why we do not use the FM's WS_UPLOAD
    if any material regarding this plz mail me at [email protected]
    thanks for help in advance.
    vikas

    Hi vikas,
    there  r 3 function modules for downloading the data from internal(dictionary)
    tables into the files in application server.
    1.DOWNLOAD
    2.WS_DOWNLOAD
    3.GUI_DOWNLOAD
    just hv a look on the following code.
    TABLES: VBAK,VBAP.
    DATA: BEGIN OF I_VBAK OCCURS 0,
          VBELN LIKE VBAK-VBELN,
          ERDAT LIKE VBAK-ERDAT,
          ERNAM LIKE VBAK-ERNAM,
          AUDAT LIKE VBAK-AUDAT,
          VBTYP LIKE VBAK-VBTYP,
          END OF I_VBAK.
    DATA: BEGIN OF I_VBAP OCCURS 0,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          MATNR LIKE VBAP-MATNR,
          CHARG LIKE VBAP-CHARG,
          MATKL LIKE VBAP-MATKL,
          END OF I_VBAP.
    DATA: BEGIN OF IT_VBAK OCCURS 0,
          VBELN LIKE VBAK-VBELN,
          ERDAT LIKE VBAK-ERDAT,
          ERNAM LIKE VBAK-ERNAM,
          AUDAT LIKE VBAK-AUDAT,
          VBTYP LIKE VBAK-VBTYP,
          POSNR LIKE VBAP-POSNR,
          MATNR LIKE VBAP-MATNR,
          CHARG LIKE VBAP-CHARG,
          MATKL LIKE VBAP-MATKL,
          END OF IT_VBAK.
    SELECT VBELN ERDAT ERNAM AUDAT VBTYP FROM VBAK INTO TABLE I_VBAK.
    SELECT VBELN POSNR MATNR CHARG MATKL FROM VBAP INTO TABLE I_VBAP.
    SORT: I_VBAK BY VBELN,I_VBAP BY VBELN.
    LOOP AT I_VBAK.
    READ TABLE I_VBAP WITH KEY VBELN = I_VBAK-VBELN BINARY SEARCH.
    IF SY-SUBRC = 0.
      MOVE I_VBAK-VBELN TO IT_VBAK-VBELN.
      MOVE I_VBAK-ERDAT TO IT_VBAK-ERDAT.
      MOVE I_VBAK-ERNAM TO IT_VBAK-ERNAM.
      MOVE I_VBAK-AUDAT TO IT_VBAK-AUDAT.
      MOVE I_VBAK-VBTYP TO IT_VBAK-VBTYP.
      MOVE I_VBAP-POSNR TO IT_VBAK-POSNR.
      MOVE I_VBAP-MATNR TO IT_VBAK-MATNR.
      MOVE I_VBAP-CHARG TO IT_VBAK-CHARG.
      MOVE I_VBAP-MATKL TO IT_VBAK-MATKL.
    APPEND IT_VBAK.
    ENDIF.
    ENDLOOP.
    *& IT ASKS THE CONFIRMATION FOR THE FILE FORMATE,WE CAN CHANGE THE FILENAME DYNAMICALLY(e.g DOC-TXT,XLS)
    *CALL FUNCTION 'DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
      FILENAME                      = 'D:\C1.TXT'
      FILETYPE                      = 'DAT'   "ASC is also another format
      ITEM                          = ' '
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      FILEMASK_MASK                 = '.TXT'
      FILEMASK_TEXT                 = ' '
      FILETYPE_NO_CHANGE            = 'X'
      FILEMASK_ALL                  = ' '
      FILETYPE_NO_SHOW              = 'X'     "THIS WILL NOT SHOW THE FILE TYPE(DAT) WHILE CONFIRMATION OF FILE NAME
      SILENT                        = 'S'
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      ACT_FILENAME                  =
      ACT_FILETYPE                  =
      FILESIZE                      =
      CANCEL                        =
    TABLES
       DATA_TAB                      = IT_VBAK
      FIELDNAMES                    =
    EXCEPTIONS
      INVALID_FILESIZE              = 1
      INVALID_TABLE_WIDTH           = 2
      INVALID_TYPE                  = 3
      NO_BATCH                      = 4
      UNKNOWN_ERROR                 = 5
      GUI_REFUSE_FILETRANSFER       = 6
      OTHERS                        = 7
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    *& this will not ask for the confirmation for the filename
    *CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
      FILENAME                      = 'D:\C2.DOC'
      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                      = IT_VBAK
      FIELDNAMES                    =
    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                        = 11
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'D:\C5.DOC'
       FILETYPE                        = 'ASC'  "Separate Columns by Tabs in Case of ASCII Download
      APPEND                          = ' '
       WRITE_FIELD_SEPARATOR           = 'X'
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
        CONFIRM_OVERWRITE               = 'X' "Overwrite The File Only After
                        Confirmation                          
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = IT_VBAK
      FIELDNAMES                      =
    EXCEPTIONS
      FILE_WRITE_ERROR                = 1
      NO_BATCH                        = 2
      GUI_REFUSE_FILETRANSFER         = 3
      INVALID_TYPE                    = 4
      NO_AUTHORITY                    = 5
      UNKNOWN_ERROR                   = 6
      HEADER_NOT_ALLOWED              = 7
      SEPARATOR_NOT_ALLOWED           = 8
      FILESIZE_NOT_ALLOWED            = 9
      HEADER_TOO_LONG                 = 10
      DP_ERROR_CREATE                 = 11
      DP_ERROR_SEND                   = 12
      DP_ERROR_WRITE                  = 13
      UNKNOWN_DP_ERROR                = 14
      ACCESS_DENIED                   = 15
      DP_OUT_OF_MEMORY                = 16
      DISK_FULL                       = 17
      DP_TIMEOUT                      = 18
      FILE_NOT_FOUND                  = 19
      DATAPROVIDER_EXCEPTION          = 20
      CONTROL_FLUSH_ERROR             = 21
      OTHERS                          = 22
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if u need any help abt this one,i welcome u to clarify them.
    reward points,if it is useful.

  • Credit card file upload(Tcode: PRCC) in a batch process

    Hi all,
    Is it possible to make credit card file upload(Tcode: PRCC) in a batch process.
    when i tried doing so got message "frontend function cannot be created in batch mode" .
    I am aware that it is because this program is using "GUI_UPLOAD" function module which is for front end only and not for background processing.
    But as this is standard program I cannot change method of uploading flat file.
    Please suggest me any method to solve my requirement. I need to make credit card file upload in a batch process.
    Thanks ,
    Snehal

    Check mark parameter 'File is not local' for SAP to read file from application server (file is read using open dataset instead of gui_upload). This would allow you to run this tcode in background.

  • Upload file without using file upload UI Element

    Hi all.
    I need upload a .txt file without using file upload UI Element because filename is not insert by user. The filename is generated by program. I try to use 'GUI_UPLOAD' and 'WS_UPLOAD' but don't work.
    Many thanks in advance.

    As you correctly pointed out we cannot use the gui_upload and gui_download fm's in webdynpro because they require sap gui and WD Components generally run in a HTML or Portal environment.
    The only option available is File Upload Element

  • Excel File Upload In Webdynpro For ABAP

    Hi All,
    I have a doubt regarding EXCEL file upload for Webdynpro for ABAP.
    I am able to get the path of file using 'FILEUPLOAD' UI element.Now I need to upload the EXCEL file into ALV.I have tried out with GUI_UPLOAD and other excel upload function module.But these Function Module throws Dump.
    Can you please suggest how to go about it.It will be a great help if u can suggest any function module or method.

    Hi Amita,
    Insetad of using GUI_UPLOAD use 'HR_KR_XSTRING_TO_STRING'
    Here is the sample code,
    TYPES :BEGIN OF str_itab,
                  name(10) TYPE c,
                  age(10) TYPE c,
                 END OF str_itab.
    DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
           i_data TYPE STANDARD TABLE OF string,
                   lo_nd_sflight TYPE REF TO if_wd_context_node,
                    lo_el_sflight TYPE REF TO if_wd_context_element,
                    l_string TYPE string,
            fs_table TYPE str_itab,
                    l_xstring TYPE xstring,
    fields TYPE string_table,
    lv_field TYPE string.
    DATA : t_table TYPE if_main=>elements_data_tab,
    data_table TYPE if_main=>elements_data_tab.
      * get single attribute
    wd_context->get_attribute(EXPORTING name =  `DATASOURCE`  
                              IMPORTING value = l_xstring ).
    CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
    EXPORTING
    in_xstring = l_xstring
    IMPORTING
    out_string = l_string.
    SPLIT l_string  AT
    cl_abap_char_utilities=>newline INTO TABLE i_data.
      * Bind With table Element.
    LOOP AT i_data INTO l_string.
    SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE
    fields.
    READ TABLE fields INTO lv_field INDEX 1.
    fs_table-name = lv_field.
    READ TABLE fields INTO lv_field INDEX 2.
    fs_table-age = lv_field.
    APPEND fs_table TO t_table1.
    ENDLOOP.
    lo_nd_sflight = wd_context->get_child_node( 'DATA_TAB' ).
    lo_nd_sflight->bind_table( t_table1 ).
      ENDMETHOD.
    if correct give correct answer
    Thanks & Regards,
    Meenachi.R

  • File upload to internal taqble

    Hi,
    I am trying to use the function module GUI_UPLOAD to upload the excel file to internal table using web dynpro in ABAP. But giving an error while executing this FM. Let me know if any suggestions.
    Thanks.

    Hi, Check this Report.
    data: itab like alsmex_tabline occurs 0 with header line.
    Has the following format:
                Row number   | Colum Number   |   Value
         i.e.     1                 1             Name1
                  2                 1             Joe
    TYPES: Begin of t_record,
        name1 like itab-value,
        name2 like itab-value,
        age   like itab-value,
        age1  like itab-value,
        End of t_record.
    DATA: it_record type standard table of t_record initial size 0,
          wa_record type t_record.
    DATA: gd_currentrow type i.
    *Selection Screen Declaration
    PARAMETER p_infile like rlgrap-filename default 'D:\pulkit\VBAP1.xls'.
    *START OF SELECTION
    call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           exporting
                filename                = p_infile
                i_begin_col             = '1'
                i_begin_row             = '1'  "Do not require headings
                i_end_col               = '4'
                i_end_row               = '3'
           tables
                intern                  = itab
           exceptions
                inconsistent_parameters = 1
                upload_ole              = 2
                others                  = 3.
      if sy-subrc <> 0.
        message e010(zz) with text-001. "Problem uploading Excel Spreadsheet
      endif.
    Sort table by rows and colums
      sort itab by row col.
    Get first row retrieved
      read table itab index 1.
    Set first row retrieved to current row
      gd_currentrow = itab-row.
      loop at itab.
      Reset values for next row
        if itab-row ne gd_currentrow.
          append wa_record to it_record.
          clear wa_record.
          gd_currentrow = itab-row.
        endif.
        case itab-col.
          when '0001'.                              "First name
            wa_record-name1 = itab-value.
          when '0002'.                              "Surname
            wa_record-name2 = itab-value.
          when '0003'.                              "Age
            wa_record-age   = itab-value.
          when '0004'.                              "Age1
            wa_record-age1   = itab-value.
        endcase.
      endloop.
      append wa_record to it_record.
    *!! Excel data is now contained within the internal table IT_RECORD
    Display report data for illustration purposes
      loop at it_record into wa_record.
        write:/     sy-vline,
               (10) wa_record-name1, sy-vline,
               (10) wa_record-name2, sy-vline,
               (10) wa_record-age, sy-vline,
               (10) wa_record-age1, sy-vline.
      endloop.
    regards
    Gaurav

  • Validation after Excel File Upload in Table Maintenance

    Hello All,
    I've done extensive research on this topic and still have yet to find the answer. I have created a custom button in the TMG to upload an Excel file to the table maintenance using the FM CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD. I updated the EXTRACT and TOTAL table so it will show up in the TMG interface, but no validations occur. So, I am now trying to do the validations of this file upload. I would like to validate each record and allow the user to modify the error record then continue validating the rest. Essentially I would like to mimic the functionality that occurs when multiple records are copied to the table maintenance and validated one by one. Updating the EXTRACT table through ABAP, does not reach the PAI where the validations occur.
    Is this approach possible? If not, what would be the best way to do validations, inform the user of the error record, and allow modification in the table maintenance interface?
    Thanks,
    Justin

    Or just a report program - have the file name on the selection screen.
    1) Upload the file
    2) Validate the file and produce error messages.
    3) Based on the validations, update the table.
    Rob

  • Flat File Upload as CSV File in BPS.

    Hi Friends,
    We have to upload CSV file to BPS and as of now we are able to upload tab spaced file as per the How to Document.
    Kindly can some body post the COMPLETE CODE changes for Uploading the CSV File in both LOAD and WEB Function Modules.
    For complete code points are guaranteed.

    Hi BI,
    please check the following thread.
    Load flat file to BPS - GUI issue
    I've implemented the file upload for CSV file. please note the changes i've made -
    Code for INIT function module :-
    FUNCTION Z_BPS_FILE_UPLOAD_INIT_CSV.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_AREA) TYPE  UPC_Y_AREA
    *"     VALUE(I_PLEVEL) TYPE  UPC_Y_PLEVEL OPTIONAL
    *"     VALUE(I_PACKAGE) TYPE  UPC_Y_PACKAGE OPTIONAL
    *"     VALUE(I_METHOD) TYPE  UPC_Y_METHOD OPTIONAL
    *"     VALUE(I_PARAM) TYPE  UPC_Y_PARAM OPTIONAL
    *"     REFERENCE(IT_EXITP) TYPE  UPF_YT_EXITP OPTIONAL
    *"     REFERENCE(ITO_CHASEL) TYPE  UPC_YTO_CHASEL OPTIONAL
    *"     REFERENCE(ITO_CHA) TYPE  UPC_YTO_CHA OPTIONAL
    *"     REFERENCE(ITO_KYF) TYPE  UPC_YTO_KYF OPTIONAL
    *"  EXPORTING
    *"     REFERENCE(ETO_CHAS) TYPE  ANY TABLE
    *"     REFERENCE(ET_MESG) TYPE  UPC_YT_MESG
      DATA: lto_chas TYPE yto_chas,
      ls_chas     TYPE ys_chas,
      ls_exitp    TYPE upf_ys_exitp,
      ls_mesg     TYPE upc_ys_mesg,
      ls_chasel   TYPE upc_ys_chasel, "<<<INSERT
      ls_charng   TYPE upc_ys_charng. "<<<INSERT
      DATA: lt_filetab TYPE filetable,
      ls_filetab   TYPE file_table,
      l_file       TYPE string,
      l_separator  TYPE char01,
      l_action     TYPE i,
      l_count      TYPE i.
      FIELD-SYMBOLS: <f> TYPE ANY. "<<<INSERT
    Try to get file name from parameter
      READ TABLE it_exitp INTO ls_exitp WITH KEY parnm = 'FILENAME'.
      IF sy-subrc = 0.
        l_file = ls_exitp-chavl.
      ENDIF.
    If no file name is given, prompt user for it
      IF l_file IS INITIAL.
        CALL METHOD cl_gui_frontend_services=>file_open_dialog
          EXPORTING
            window_title            = 'Select Upload File'
            default_extension       = 'csv'
            file_filter             = 'Text Files (*.csv)'
          CHANGING
            file_table              = lt_filetab
            rc                      = l_count
            user_action             = l_action
          EXCEPTIONS
            file_open_dialog_failed = 1
            cntl_error              = 2
            OTHERS                  = 3.                        "#EC NOTEXT
        IF sy-subrc <> 0.
          CLEAR ls_mesg.
          MOVE-CORRESPONDING syst TO ls_mesg.
          APPEND ls_mesg TO et_mesg.
          EXIT.
        ENDIF.
        CALL METHOD cl_gui_cfw=>flush.
        LOOP AT lt_filetab INTO ls_filetab.
          l_file = ls_filetab.
        ENDLOOP.
        CHECK l_action = 0.
      ENDIF.
      l_separator = 'X'.
    Upload file from front-end (PC)
    File format is tab-delimited ASCII
    l_separator = ';' .
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = l_file
         filetype                = 'DAT'
         has_field_separator     = l_separator
        TABLES
          data_tab                = gt_file_csv
        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.
        CLEAR ls_mesg.
        MOVE-CORRESPONDING syst TO ls_mesg.
        APPEND ls_mesg TO et_mesg.
        EXIT.
      ENDIF.
    Create one dummy combination
    If we don't do this, the upload won't work since the second function
    will not be executed at all in case no transaction data exists so far.
    The combination must be a subset of the planning level!
      " >>> BEGIN INSERT
      CLEAR ls_chas.
      LOOP AT ito_chasel INTO ls_chasel.
        READ TABLE ls_chasel-t_charng INTO ls_charng INDEX 1.
        IF sy-subrc = 0.
          ASSIGN COMPONENT ls_chasel-chanm OF STRUCTURE ls_chas TO <f>.
          IF sy-subrc = 0.
            <f> = ls_charng-low.
          ENDIF.
        ENDIF.
      ENDLOOP.
      " <<< END INSERT
      COLLECT ls_chas INTO lto_chas.
      eto_chas = lto_chas.
    ENDFUNCTION.
    Include should contains following declarations-
    TYPES:      begin of itab_CSV,
                           text(255) type c,
                     end of itab_CSV.
    Global table to temporarily store loaded data.
    DATA: gt_file_CSV TYPE STANDARD TABLE OF itab_csv WITH DEFAULT
    KEY.
    Hope it will help you.
    Regards
    Tarun

  • Excel File Upload on ESS

    Hi All,
    I have the requirement to upload an excel file on ESS. To achieve this, I have created a module pool program, which allows me to select the path of file that is present on my desktop and read it for further processing. Using the FM GUI_UPLOAD, I am able to successfuly upload a text file (in .txt format) but not an Excel file (.xls format). If I try uploading xls file, it converts the data into junk characters ##### etc.
    Is there any function module which will allow me to read an excel file in this module pool program ; and allow me to read its contents??
    P.S. The module pool program succesfully reads and excel file in R/3, but does not work on ESS...Why so? And what may be the workaround for this???

    I think the easiest approach is to create a webdynpro for this.
    There you can use a file upload element

  • File Upload/Download, updating to SAP

    Hi All:
    Has anyone implemented the file upload functionality?
    Could you please share the details.... Iam successfully passing the file name from WD but get short dump with
    "   Termination occurred in the ABAP program "SAPLCNDP" - in
         "DP_CONTROL_ASSIGN_TABLE".
        The main program was "SAPMSSY1 ".
        In the source code you have the termination point in line 1
        of the (Include) program "LCNDPU10"".
    Iam using  "cl_gui_frontend_services=>gui_upload " to upload to SAP.
    Thanks in advance.

    Look at this blog. It may help you:
    <a href="/people/raja.thangamani/blog/2007/11/12/how-to-create-attachments-in-business-transaction-from-webdynprojava attachments in SAP</a>
    <a href="/people/raja.thangamani/blog/2007/11/29/displaydelete-attachment-from-business-transactions-using-webdynpro-java attachment from SAP</a>
    Raja T

  • Problem in File Upload - URGENT

    Hi All,
    Advance thanks for your reply
    My Query
    we are not mention the clint-no in my flat file
    During file upload its client no add to itab
    i will mention code also
    parameters: p_file type rlgrap-filename obligatory
    DEFAULT 'c:\temp\pcard.dat'.
    at selection-screen on value-request for p_file.
      call function 'WS_FILENAME_GET'
       exporting
         mask                   = ',.,..'
       importing
         filename               = p_file
    exceptions
       inv_winsys             = 1
       no_batch               = 2
       selection_cancel       = 3
       selection_error        = 4
       others                 = 5.
    call function 'WS_UPLOAD'
           exporting
                filename                = p_file
                filetype                = 'DAT'
           tables
                data_tab                = itAB
           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
                others                  = 10.
    Please send the guide lines or  code for my query
    i look forwar to your reply
    Regards
    Raj

    Check this
    Uploading files from PC(Presentation Server)  
    There are also a number of other function modules which could be used for uploading/downloding files
    between SAP and the presentation server.
    *   Retrieve data file from presentation server(Upload from PC)
    DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'. 
    DATA: begin of it_datatab occurs 0,
      row(500) type c,
    end of it_datatab.
      CALL FUNCTION 'GUI_UPLOAD'
           EXPORTING
                filename        = i_file
                filetype        = 'ASC'
           TABLES
                data_tab        = it_datatab  "ITBL_IN_RECORD[]
           EXCEPTIONS
                file_open_error = 1
                OTHERS          = 2.
    *& Report  ZUPLOADTAB                                                  *
    *& Example of Uploading tab delimited file                             *
    REPORT  zuploadtab                    .
    PARAMETERS: p_infile  LIKE rlgrap-filename
                            OBLIGATORY DEFAULT  '/usr/sap/'..
    *DATA: ld_file LIKE rlgrap-filename.
    DATA: gd_file type string.
    *Internal tabe to store upload data
    TYPES: BEGIN OF t_record,
        name1 LIKE pa0002-vorna,
        name2 LIKE pa0002-name2,
        age   TYPE i,
        END OF t_record.
    DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
          wa_record TYPE t_record.
    *Internal table to upload data into
    DATA: BEGIN OF it_datatab OCCURS 0,
      row(500) TYPE c,
    END OF it_datatab.
    *Text version of data table
    TYPES: BEGIN OF t_uploadtxt,
      name1(10) TYPE c,
      name2(15) TYPE c,
      age(5)  TYPE c,
    END OF t_uploadtxt.
    DATA: wa_uploadtxt TYPE t_uploadtxt.
    *String value to data in initially.
    DATA: wa_string(255) TYPE c.
    CONSTANTS: con_tab TYPE x VALUE '09'.
    *If you have Unicode check active in program attributes then you will
    *need to declare constants as follows:
    *class cl_abap_char_utilities definition load.
    *constants:
    *    con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFILE.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
      CALL FUNCTION <b>'WS_FILENAME_GET'</b>
           EXPORTING
                def_filename     = p_infile
                mask             = ',*.txt.'
                mode             = 'O'
                title            = 'Upload File'(078)
           IMPORTING
                filename         = p_infile
           EXCEPTIONS
                inv_winsys       = 1
                no_batch         = 2
                selection_cancel = 3
                selection_error  = 4
                OTHERS           = 5.
    *START-OF-SELECTION
    START-OF-SELECTION.
      gd_file = p_infile.
      CALL FUNCTION <b>'GUI_UPLOAD'</b>
        EXPORTING
          filename                = gd_file
          has_field_separator     = 'X'  "file is TAB delimited
        TABLES
          data_tab                = it_record
        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 NE 0.
          write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
          skip.
        endif.
    * Alternative method, where by you split fields at each TAB after you
    * have returned the data. No point unless you dont have access to
    * GUI_UPLOAD but just included for information 
    *  CALL FUNCTION 'GUI_UPLOAD'
    *       EXPORTING
    *            filename        = gd_file
    *            filetype        = 'ASC'
    *       TABLES
    *            data_tab        = it_datatab  "ITBL_IN_RECORD[]
    *       EXCEPTIONS
    *            file_open_error = 1
    *            OTHERS          = 2.
    *  IF sy-subrc NE 0.
    *  ELSE.
    *    LOOP AT it_datatab.
    *      CLEAR: wa_string, wa_uploadtxt.
    *      wa_string = it_datatab.
    *      SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
    *                                      wa_uploadtxt-name2
    *                                      wa_uploadtxt-age.
    *      MOVE-CORRESPONDING wa_uploadtxt TO wa_record.
    *      APPEND wa_record TO it_record.
    *    ENDLOOP.
    *  ENDIF.
    *END-OF-SELECTION
    END-OF-SELECTION.
    *!! Text data is now contained within the internal table IT_RECORD
    * Display report data for illustration purposes
    LOOP AT it_record INTO wa_record.
      WRITE:/     sy-vline,
             (10) wa_record-name1, sy-vline,
             (10) wa_record-name2, sy-vline,
             (10) wa_record-age, sy-vline.
    ENDLOOP.
    http://www.sapdevelopment.co.uk/file/file_updown.htm
    Hope this helps.
    Kindly reward and close the thread.

  • Purpose each of these is: Gui_upload and upload

    Hi Friends,
    Kindly let me know what the Exact Purpose each of these is: Gui_upload and upload
    What is the difference between those two?
    Akshitha.

    Hi,
    UPLOAD fm is the old function module which is now obsolete. From 4.6C onwards SAP has delivered new FM's for uploading and that is GUI_UPLOAD.
    the diff is  UPLOAD pops up a box during runtime to accept the file path the GUI_UPLOAD does not pop up any box during runtime instead takes the path as a paramter.
    This is what SAP HELP SAYS
    Files on the Presentation Server
    WS_UPLOAD and WS_DOWNLOAD, the function modules used until now are not part of the standard set of ABAP commands. They are used to display the file interface on the presentation server. WS_UPLOAD and WS_DOWNLOAD are not compatible with USs and have been replaced by GUI_UPLOAD and GUI_DOWNLOAD.
    The new function modules, GUI_UPLOAD and GUI_DOWNLOAD, have an interface that also allows you to write Unicode format to the local hard drive. For a description of these interfaces, refer to the documentation for each function module, available under SAP Easy Access " Development " Function Builder " Goto " Documentation.
    Instead of using the function modules, you can use the static methods GUI_UPLOAD and GUI_DOWNLOAD of the global class CL_GUI_FRONTEND_SERVICES.
    Cheers
    VJ
    Message was edited by:
            Vijayendra  Rao

  • File Upload on Visual Composer

    Dear colleagues,
    I need to build the functionality to do a File upload on Visual Composer. The user should be able to select a file from his local PC and upload it into a table or DSO.
    I have created a function module that uses the function 'GUI_UPLOAD' to do the upload. If I execute the FM from transaction SE37 it works fine, selects the file and loads the data into the table. However, if I embed that FM into Visual Composer it does not work anymore.
    Is it because it uses GUI technology that cannot be called from java environment of VC?
    Anybody has a hint on how to solve this? Is there any standard functionality to do it?
    Thanks,
    Salvador Gimeno

    Hi,
    Salvador  Gimeno wrote:
    Dear colleagues,
    I need to build the functionality to do a File upload on Visual Composer. The user should be able to select a file from his local PC and upload it into a table or DSO.
    I have created a function module that uses the function 'GUI_UPLOAD' to do the upload. If I execute the FM from transaction SE37 it works fine, selects the file and loads the data into the table. However, if I embed that FM into Visual Composer it does not work anymore.
    Is it because it uses GUI technology that cannot be called from java environment of VC?
    Yes, the GUI_UPLOAD relies on the "SAP Gui connection" which is not possible in a Web environnement like the Visual Composer.
    In languages such as Web Dynpro (Java or ABAP) or BSP, you can upload file to the server.
    You might have to "mix" technologies to provide upload and still keep using VC.
    Salvador  Gimeno wrote:
    Anybody has a hint on how to solve this? Is there any standard functionality to do it?
    I think this upload functionality is about to be released with Ehp1

Maybe you are looking for

  • N96 hardware????? where can i get it need help!!!

    My very very new phone just got water damage with sea water .... I hope someone knows how i can get the motherboard.. i love this phone.. Even Nokia service centre cant help me !!!!

  • Pl Order Creation with help of PPDS PDS

    Dear All, We are trying to create plan order with help of PPDS PDS. But i am not able to create Pl Orders with PDS which have multiple setups. it gives error for locked activity network, but if i use ppm insted it creats the order. Any input would be

  • NW2004s: Homogeneous systemcopy ABAP + JAVA

    When doing a combined ABAP + Java systemcopy via R3load procedure, the "old" configurations in the propertysheets on the filesystem may get lost. What is the general procedure here to find out, what needs to be manually adapted after a systemcopy? I

  • Where i can get manual/drivers/bios for MS-6332 (i815, FlexATX)??

    Where i can get manual/drivers/bios for MS-6332 (i815, FlexATX) ?? Can't find anything about this M/B on the site.

  • Synchronizer Token Pattern - Generic example

    Hi We have web applications not developped with struts or JSF, it's just a servlet/JSP design. We have big troubles with multiple forms submitted at the login-form, so our intention it's to "protect" this page with the synchronizer token pattern. Whe