Excel file to Ztable

Hi,
I have 2 upload data of 1,000 rows from excel sheet to my Ztable. How to write code for it.
thanks & regards
ram

Check the below program and here uploading the data from excel file to Ztable
REPORT ZLWMI151_UPLOAD no standard page heading
                       line-size 100 line-count 60.
*tables : zbatch_cross_ref.
data : begin of t_text occurs 0,
       werks(4) type c,
       cmatnr(15) type c,
       srlno(12) type n,
       matnr(7) type n,
       charg(10) type n,
       end of t_text.
data: begin of t_zbatch occurs 0,
      werks like zbatch_cross_ref-werks,
      cmatnr like zbatch_cross_ref-cmatnr,
      srlno like zbatch_cross_ref-srlno,
      matnr like zbatch_cross_ref-matnr,
      charg like zbatch_cross_ref-charg,
      end of t_zbatch.
data : g_repid like sy-repid,
       g_line like sy-index,
       g_line1 like sy-index,
       $v_start_col         type i value '1',
       $v_start_row         type i value '2',
       $v_end_col           type i value '256',
       $v_end_row           type i value '65536',
       gd_currentrow type i.
data: itab like alsmex_tabline occurs 0 with header line.
data : t_final like zbatch_cross_ref occurs 0 with header line.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
  g_repid = sy-repid.
at selection-screen on value-request for p_file.
  CALL FUNCTION 'F4_FILENAME'
       EXPORTING
            PROGRAM_NAME = g_repid
       IMPORTING
            FILE_NAME    = p_file.
start-of-selection.
Uploading the data into Internal Table
  perform upload_data.
  perform modify_table.
top-of-page.
  CALL FUNCTION 'Z_HEADER'
  EXPORTING
    FLEX_TEXT1       =
    FLEX_TEXT2       =
    FLEX_TEXT3       =
*&      Form  upload_data
      text
FORM upload_data.
  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
       EXPORTING
            FILENAME                = p_file
            I_BEGIN_COL             = $v_start_col
            I_BEGIN_ROW             = $v_start_row
            I_END_COL               = $v_end_col
            I_END_ROW               = $v_end_row
       TABLES
            INTERN                  = itab
       EXCEPTIONS
            INCONSISTENT_PARAMETERS = 1
            UPLOAD_OLE              = 2
            OTHERS                  = 3.
  IF SY-SUBRC <> 0.
    write:/10 'File '.
  ENDIF.
  if sy-subrc eq 0.
    read table itab index 1.
    gd_currentrow = itab-row.
    loop at itab.
      if itab-row ne gd_currentrow.
        append t_text.
        clear t_text.
        gd_currentrow = itab-row.
      endif.
      case itab-col.
        when '0001'.
          t_text-werks = itab-value.
        when '0002'.
          t_text-cmatnr = itab-value.
        when '0003'.
          t_text-srlno = itab-value.
        when '0004'.
          t_text-matnr = itab-value.
        when '0005'.
          t_text-charg = itab-value.
      endcase.
    endloop.
  endif.
  append t_text.
ENDFORM.                    " upload_data
*&      Form  modify_table
      Modify the table ZBATCH_CROSS_REF
FORM modify_table.
  loop at t_text.
    t_final-werks = t_text-werks.
    t_final-cmatnr = t_text-cmatnr.
    t_final-srlno = t_text-srlno.
    t_final-matnr = t_text-matnr.
    t_final-charg = t_text-charg.
    t_final-erdat = sy-datum.
    t_final-erzet = sy-uzeit.
    t_final-ernam = sy-uname.
    t_final-rstat = 'U'.
    append t_final.
    clear t_final.
  endloop.
  delete t_final where werks = ''.
  describe table t_final lines g_line.
  sort t_final by werks cmatnr srlno.
Deleting the Duplicate Records
  perform select_data.
  describe table t_final lines g_line1.
  modify zbatch_cross_ref from table t_final.
  if sy-subrc ne 0.
    write:/ 'Updation failed'.
  else.
    Skip 1.
    Write:/12 'Updation has been Completed Sucessfully'.
    skip 1.
    Write:/12 'Records in file ',42 g_line .
    write:/12 'Updated records in Table',42 g_line1.
  endif.
  delete from zbatch_cross_ref where werks = ''.
ENDFORM.                    " modify_table
*&      Form  select_data
      Deleting the duplicate records
FORM select_data.
  select werks
         cmatnr
         srlno from zbatch_cross_ref
         into table t_zbatch for all entries in t_final
         where werks = t_final-werks
         and  cmatnr = t_final-cmatnr
         and srlno = t_final-srlno.
  sort t_zbatch by werks cmatnr srlno.
  loop at t_zbatch.
    read table t_final with key werks = t_zbatch-werks
                                cmatnr = t_zbatch-cmatnr
                                srlno = t_zbatch-srlno.
    if sy-subrc eq 0.
      delete table t_final .
    endif.
    clear: t_zbatch,
           t_final.
  endloop.
ENDFORM.                    " select_data
Thanks
Seshu

Similar Messages

  • Uploading data from an excel file to ztable

    Hi,
    I tried to upload an excel file to ztable using fm 'ALSM_EXCEL_TO_INTERNAL_TABLE'.In the o/p I can see only 3 rows and all the date and time fields are not properly displayed in the o/p.What would be the reason?Can anyone give me a suggestion?
    Regards,
    Hema

    Hi,
    pls check my code.
                       Data Definitions                                  *
      Internal Tables
    DATA : t_zrb_hdr TYPE STANDARD TABLE OF ZRB_HDR WITH HEADER LINE,
           t_field_catalog  TYPE slis_t_fieldcat_alv.
    Declaration of the Internal Table with Header Line comprising of the uploaded data.
    DATA: BEGIN OF t_file_upload OCCURS 0.
    INCLUDE STRUCTURE ALSMEX_TABLINE. " Rows for Table with Excel Data
    DATA: END OF t_file_upload.
    form UPLOAD_EXCEL_FILE .
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = p_file
        i_begin_col                   = '1'
        i_begin_row                   = '2'
        i_end_col                     = '10'
        i_end_row                     = '250'
      tables
        intern                        = t_file_upload
    EXCEPTIONS
      INCONSISTENT_PARAMETERS       = 1
      UPLOAD_OLE                    = 2
      OTHERS                        = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • How to upload normal excell file to ztable

    Hi All there,
    Can anybody tell me how to upload normal excell file to ztable directly.
    pl provide detail coding
    Regards
    Sagar

    Hi Sagar,
       first upload the excel data into your internal table using a FM than upload the data to your ZTABLE using BDC.
    parameters:
      p_file type rlgrap-filename          " File name
      data:
        lw_file  type string.              " File Path
    data:
      t_bdcdata type
       standard table
             of bdcdata,
      fs_bdcdata type bdcdata.             " Work area for bdcdata
    * Messages of call transaction
    data:
      t_messtab type
       standard table
             of bdcmsgcoll,
      fs_messtab type bdcmsgcoll.          " Work area for messtab
    at selection-screen on value-request for p_file.
      call function 'F4_FILENAME'
       exporting
         program_name        = syst-cprog
         dynpro_number       = syst-dynnr
         field_name          = ' '
       importing
         file_name           = p_file.
      lw_file = p_file.
      call function 'GUI_UPLOAD'
        exporting
          filename                    = lw_file
          filetype                    = 'ASC'
          has_field_separator         = 'X'
          dat_mode                    = 'X'
        tables
          data_tab                    = t_final_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.                               " IF SY-SUBRC <> 0
      if t_final_data is initial.
        message 'File not found'(003) type 'E'.
      endif.                               " IF T_FINAL_DATA IS INITIAL
    end-of-selection.
      perform upload_0585_data_using_bdc.  " populate the bdcdata table using tcode SHDB
      call transaction 'PA30' using t_bdcdata
                               mode 'A'
                           messages into t_messtab.
    form upload_0585_data_using_bdc.
      loop at t_final_data into fs_final_data.
    perform bdc_field       using 'Q0585-ACNTR(07)'
                                   w_curr.
    perform bdc_field       using 'Q0585-ACOPC'
                                   lw_flag.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPD'.
    perform bdc_dynpro      using 'MP058500' '2000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBCK'.
    perform bdc_dynpro      using 'SAPMP50A' '1000'.
    endloop.
    *        Start new screen                                              *
    form bdc_dynpro using program dynpro.
      clear fs_bdcdata.
      fs_bdcdata-program  = program.
      fs_bdcdata-dynpro   = dynpro.
      fs_bdcdata-dynbegin = 'X'.
      append fs_bdcdata to t_bdcdata.
    endform.                               " Form bdc_dynpro using program...
    *        Insert field                                                  *
    form bdc_field using fnam fval.
        clear fs_bdcdata.
        fs_bdcdata-fnam = fnam.
        fs_bdcdata-fval = fval.
        append fs_bdcdata to t_bdcdata.
    endform.                               " Form bdc_field using fnam fval
    With luck,
    Pritam.

  • Error while uploading data to ztable from excel file

    Hi,
    I have a requirement where i have to upload data from excel file to ztable.I have used the fm 'ALSM_EXCEL_TO_INTERNAL_TABLE' for reading the excel file.After reading the excel file i have used INSERT zrb_hdr from table t_zrb_hdr for updating the ztable with data .
    here it is giving error as the data base table zrb_hdr and the internal table t_zrb_hdr should be declared of same type .
    I got this error b'coz i have changed the date and time fields in t_zrb_hdr table to char type.so the structure of zrb_hdr and t_zrb_hdr are not same.If i don't change the date and time fields,in the o/p i am not getting proper date and time formats.
    now how can i upload data into ztable?

    Hi,
    Try this.
    Data: itab type standard table of ztable,
             wa_itab type ztable.
    loop at t_zrb_hdr into wa_t_zrb_hdr.
       wa_itab-date = wa_t_zrb_hdr-date.
       wa_itab-time = wa_t_zrb_hdr-time.
       like  move all the fiedl to wa_itab...........
       append itab with wa_itab.
    Endloop.
    now insert the records from itab to the database table ztable.
    Thanks,
    Muthu.

  • How to update Ztable from Excel file and how to check conditions ,

    HI this uday,
    pls help me how can i update Ztable from Excel file and how to check conditions .
    regards
    uday
    Moderator message: please (re)search yourself before asking.
    Edited by: Thomas Zloch on Jul 13, 2010 12:00 PM

    Hi
    Use Fm : ALSM_EXCEL_TO_INTERNAL_TABLE.
    L_INTERN : internal table with your fields .
    make sure that the fields in the Excel should be formatted (as numeric , characher ) depending upon the data types .
    LOOP AT L_INTERN INTO WA_LINTERN .
            MOVE WA_LINTERN-COL TO L_INDEX.
            ASSIGN COMPONENT  L_INDEX OF STRUCTURE WA_INREC TO <FS> .
            IF SY-SUBRC = 0.
              MOVE WA_LINTERN-VALUE TO <FS>.
            ENDIF.
            AT END OF  ROW .                                    "#EC *
              APPEND WA_INREC TO IT_DATA.  "
              CLEAR WA_INREC.
            ENDAT.
         ENDLOOP.
    Regards
    Swapnil

  • How to upload Excel data in Ztables fastly & easily.

    Dear ALL,
    I  want to compare material codes in 2 different excel sheets.
    I have downloaded output from 2 different SQVI into 2 different excel sheets.
    Now I want to compare these 2 sheets to get matching codes or unmatching codes.
    I can use VLOOKUP in excel also. But How can I make use of ABAP by downloading these excel data in 2 different Ztables and compare these 2 tables with some user defined TC (transaction code) ?
    For this activity How to upload Excel data(2 sheets) in 2 Ztables fastly & easily ?
    Is there any method other than SCAT , BDC and LSMW  ???
    Or which is best method in above ?
    Pl' reply.
    Thanks.

    Have a look at the program
    *: Description                                                :
    *: This is a simple example program to get data from an excel :
    *: file and store it in an internal table.                    :
    *: Author : www.sapdev.co.uk, based on code from Jayanta      :
    *: SAP Version : 4.7                                          :
    REPORT  zupload_excel_to_itab.
    TYPE-POOLS: truxs.
    PARAMETERS: p_file TYPE  rlgrap-filename.
    TYPES: BEGIN OF t_datatab,
          col1(30)    TYPE c,
          col2(30)    TYPE c,
          col3(30)    TYPE c,
          END OF t_datatab.
    DATA: it_datatab type standard table of t_datatab,
          wa_datatab type t_datatab.
    DATA: it_raw TYPE truxs_t_text_data.
    At selection screen
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          field_name = 'P_FILE'
        IMPORTING
          file_name  = p_file.
    *START-OF-SELECTION.
    START-OF-SELECTION.
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
        I_FIELD_SEPERATOR        =
          i_line_header            =  'X'
          i_tab_raw_data           =  it_raw       " WORK TABLE
          i_filename               =  p_file
        TABLES
          i_tab_converted_data     = it_datatab[]    "ACTUAL DATA
       EXCEPTIONS
          conversion_failed        = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3.
      ENDLOOP.
    Message was edited by:
            K N  REDDY

  • How to import data into a Z table from excel file?

    hi,
    i have a custom created Z table into which i want to import some data from an excel file. which function can i use to do so because SE16 allows me to insert data only one by one via a data entry screen. this is time consuming. i want to import data from excel file so that its faster.

    HI,
    this program uploads data from excel and modifies ztable,(inserts records into ztable), check this and modify according to ur requirement)
    This program uploads material number from excel sheet and does
    ******modifications to material number if required by the user
    ******and updates the table zmatnr with new material against the old material number
    REPORT  zmat_no message-id zebg.
    TYPE-POOLS  truxs.
    TABLES:zmatnr.
    DATA : itab LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    DATA row LIKE alsmex_tabline-row.
    data : g_matnr like mara-matnr.
    data : count type i.
    data : itab_count type i.
    data : gi_final like zmatnr occurs 0 with header line.
    *data : begin of gi_final occurs 0,
          mat_old like mara-matnr,
          mat_new like mara-matnr,
          end of gi_final.
    ***********************Selection Screen*************************
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETER : pfname LIKE rlgrap-filename OBLIGATORY.
    select-options : records for count.
    SELECTION-SCREEN END OF BLOCK b1.
    *********************At Selection Screen*************************
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfname.
      PERFORM search.
    START-OF-SELECTION.
    perform process.
    form process.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = pfname
          i_begin_col             = 1
          i_begin_row             = 2
          i_end_col               = 12
          i_end_row               = 65000
        TABLES
          intern                  = itab
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      describe table itab lines itab_count.
       row = 1.
      loop at itab.
        if itab-row <> row.
          append gi_final.
          clear gi_final.
        endif.
        case itab-col.
          when '1'.
          CLEAR G_MATNR.
          gi_final-OLD_MATNR = itab-value.
          CONCATENATE 'NEW' gi_final-old_matnr INTO itab-value.
            gi_final-new_MATNR = itab-value.
          endcase.
        row = itab-row.
      append gi_final.
      clear gi_final.
      endloop.
      CALL FUNCTION 'PROGRESS_INDICATOR'
      EXPORTING
        I_TEXT  = 'File Has Been Successfully Uploaded from Workstation ' .
      if not gi_final[] is initial.
        if not records-low is initial .
          if not records-high is initial.
            records-high = records-high + 1.
            DESCRIBE TABLE gi_final LINES count.
            IF records-high < count.
              DELETE gi_final FROM records-high TO count.
            ENDIF.
            IF records-low <> 1.
              IF records-low <> 0.
                DELETE gi_final FROM 1 TO records-low.
              ENDIF.
            ENDIF.
          endif.
        endif.
      endif.
      IF NOT GI_FINAL[] IS INITIAL.
        CALL FUNCTION 'PROGRESS_INDICATOR'
         EXPORTING
           I_TEXT  = 'Processing zmatnr table'
           I_OUTPUT_IMMEDIATELY = 'X'.
          if itab_count <> count.
             message i000 with 'records are not matching'.
             exit.
          else.
             modify zmatnr from table gi_final.
             message i000 with 'data base table modified successfully'.
          endif.
      endif.
    endform.
    *&      Form  search
          text
    -->  p1        text
    <--  p2        text
    FORM search .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          static    = 'X'
        CHANGING
          file_name = pfname.
    ENDFORM.                    " search
    regards
    siva

  • Uploading Excel file to SAP

    Hi Friends,
    Iam trying to Upload Excel file into SAP using the FM
    ALSM_EXCEL_TO_INTERNAL_TABLE. But it is going to dump n the error is                                                                             
    The call to the function module "ALSM_EXCEL_TO_INTERNAL_TABLE" is incorrect:                                                                               
    In the function module interface, you can specify only                          
    fields of a specific type and length under "INTERN".                            
    Although the currently specified field                                          
    "ITAB" is the correct type, its length is incorrect.                            
    I have attached the code also.
    Please let me know where iam getting the error.
    Code :
    Tables : mara,
             ztable.
    parameters : p_infile like rlgrap-filename.
    data : begin of itab occurs 0,
           matnr like mara-matnr,
           mbrsh like mara-mbrsh,
           matkl like mara-matkl,
           end of itab.
           CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
             EXPORTING
               FILENAME                      = p_infile
               I_BEGIN_COL                   = 1
               I_BEGIN_ROW                   = 1
               I_END_COL                     = 100
               I_END_ROW                     = 100
             TABLES
               INTERN                        = itab
           EXCEPTIONS
             INCONSISTENT_PARAMETERS       = 1
             UPLOAD_OLE                    = 2
             OTHERS                        = 3
           IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.
    sort itab by matnr.
    loop at itab.
    write:/ itab.
    *modify ztable from table itab.
    endloop.

    hi check this code:
    DATA : BEGIN OF TYP_INPUT ,
               MATNR LIKE MARA-MATNR,
               WERKS LIKE MARC-WERKS,
               LGORT LIKE MARD-LGORT,
               LGNUM LIKE MLGN-LGNUM,
               LGTYP LIKE MLGT-LGTYP,
               LTKZA LIKE MLGN-LTKZA,
               LTKZE LIKE MLGN-LTKZE,
               LGBKZ LIKE MLGN-LGBKZ,
               LGPLA LIKE MLGT-LGPLA,
            END OF TYP_INPUT.
    *Input File Data
    DATA : IT_FILE LIKE TYP_INPUT OCCURS 0 WITH HEADER LINE.
    *"INTERNAL TAB TO TAKE EXCEL SHEET.
    DATA : IT_EXCEL    LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
           CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
            EXPORTING
                 FILENAME                = P_PFILE
                 I_BEGIN_COL             = 1
                 I_BEGIN_ROW             = 2
                 I_END_COL               = 9
                 I_END_ROW               = 6000
            TABLES
                 INTERN                  = IT_EXCEL
            EXCEPTIONS
                 INCONSISTENT_PARAMETERS = 1
                 UPLOAD_OLE              = 2
                 OTHERS                  = 3.
    * IT_EXCEL CONTAINS DATA IN THE FORM OF ROW, COL, VALUE       *
    * CONVERTING THAT INTERNAL TABLE TO FORMAT THAT OF EXCEL SHEET *
       IF NOT IT_EXCEL[] IS INITIAL.
         SORT IT_EXCEL BY ROW COL.
         LOOP AT IT_EXCEL.
           CASE IT_EXCEL-COL.
            WHEN 1.
                  IT_FILE-MATNR = IT_EXCEL-VALUE.
            WHEN 2.
                  IT_FILE-WERKS = IT_EXCEL-VALUE.
            WHEN 3.
                  IT_FILE-LGORT = IT_EXCEL-VALUE.
            WHEN 4.
                  IT_FILE-LGNUM = IT_EXCEL-VALUE.
            WHEN 5.
                  IT_FILE-LGTYP = IT_EXCEL-VALUE.
            WHEN 6.
                  IT_FILE-LTKZA = IT_EXCEL-VALUE.
            WHEN 7.
                  IT_FILE-LTKZE = IT_EXCEL-VALUE.
            WHEN 8.
                  IT_FILE-LGBKZ = IT_EXCEL-VALUE.
            WHEN 9.
                  IT_FILE-LGPLA = IT_EXCEL-VALUE.
           ENDCASE.
           AT END OF ROW.
             APPEND IT_FILE.
             CLEAR IT_FILE.
           ENDAT.
         ENDLOOP.
       ELSE.
         MESSAGE I000  WITH 'The input file is empty'.
         STOP.
       ENDIF.

  • How to upload a excel file using BDC

    how should i upload a file using BDC
    i have downloaded a excel file containing the values of  table A006 a X server.
    now i hav to upload it into new server Y server using BDC , how do i do it?
    wat all things one shud consider ?

    Hi,
    This is very simple, follow the below mention steps to do so:
    1.Declare an internal table having same structure as db table, but take all the fields type as 'C' and length same as defined in the table.
    TYPES:BEGIN OF it,
      key(20) TYPE c,
      indicator(20) TYPE c,
      bldat(20) TYPE c,"bkpf-bldat
      budat(20) TYPE c,"bkpf-budat
      END OF it.
    DATA: itab TYPE STANDARD TABLE OF it,
          wa TYPE it.
    2.Include TRUX as type pool and declare a variable of type trux_t_text_data to be passed in the FM that actually reads data from excel sheet into above declared intrenal table.
    TYPE-POOLS: truxs.
    DATA: it_raw TYPE truxs_t_text_data.
    3. Call the FM 'TEXT_CONVERT_XLS_TO_SAP' and pass the file name and the internal table name into the parameter
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
    *    I_FIELD_SEPERATOR          = 'X'
         i_line_header              = 'X'
          i_tab_raw_data             = it_raw
          i_filename                 = p_file "name of the excel file
        TABLES
          i_tab_converted_data       = itab[] "internal table where data will be stored
       EXCEPTIONS
         conversion_failed          = 1
         OTHERS                     = 2
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    4. loop at internal table and modify the ztable/dbtable where data to be upload .
    Hope this solve your problem.
    Pooja

  • Uploading my Excel file

    Hi
    I have an Excel File I wanted to upload it to a SAP Z table. How it can be done.
    I saw an option in edit menu for download the data from database table to excel file.But there is no option for upload the data from excel table to database table.
    My excel file name is total.xls. It is stored in C:\. My Database table name is Zud_total.
    Please guide me in doing the same.
    Thanks & Regards
    Nigesh

                           DATA DECLARATION
    DATA : vit_val LIKE TABLE OF <ztable>.
    DATA : v_fname TYPE string .
                           SELECTION SCREEN
    PARAMETER : p_fname LIKE rlgrap-filename. "File Name
                           AT SELECTION SCREEN
    Creating F4 Help for Browsing the file
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          file_name     = p_fname
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    START-OF-SELECTION.
      v_fname = p_fname.
    *Uploading the File
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = v_fname
          filetype                = 'ASC'
          has_field_separator     = '#'
        TABLES
          data_tab                = vit_iso
        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.
    *POPULATING THE TABLE Z Customized
      MODIFY <Ztable name> FROM TABLE vit_val.
      IF sy-subrc = 0.
        WRITE : / 'FILE UPLOADED FROM : ' , p_fname.
        MESSAGE s000(38) WITH '<Ztablename>  POPULATED SUCCESSFULLY!!'.
      ENDIF.
    Just replace < Ztablename > with ur table name.
    Hope this will be helpful.

  • Report Generation tool kit for MS office (Opening an existing excel file and appending to the bottom)

    I don't have any problems creating and filling an excel sheet with data. I use the New Report.vi, Easy Title.vi, and Easy Text.vi to create the file. I then save and dispose properly.
    What I don't seem to be able to do is open the exsting file and append data to the end of the sheet.
    Thanks in advance for your help.
    todd

    Hi Todd,
    You can do this by creating a new Excel report with the existing excel file path wired to the "template" input. Then use "Excel Get Last Row.vi" (located under Report Generation\Excel Specific\Excel General) to obtain the location of the last row. Then use that location to input new data into the file.
    Hope this helps,
    Dan

  • .excel file takes lot of time to open after running Custom Program

    DB:11.2.0.2.0
    Oracle Apps:12.1.3
    O/S:AIX 6.1
    Hi All,
    Issue Description:
    When the report is submitted, the data gets populated into the table in less than 30secs and xml gets generated within a minute.
    But the program takes some time in displaying the output around 5 mins but when we tried with html, it opens up quickly.
    The template has a complex matrix, layout wherein, we are using nested FOR loops to display the data in the required format.
    Yesterday, we ran the report “Custom GL STAT Trial Balance Report” in DEV Instance and for around 500+ records, it took around 5 mins.
    The excel file is only 1 MB and xml generated is 245 KB
    Moreover, recently we had increased the OPP jvm to 3GB to avoid java.lang.memory error what was occurring earlier.
    select DEVELOPER_PARAMETERS
    from FND_CP_SERVICES
    where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES where
    CONCURRENT_QUEUE_NAME = 'FNDCPOPP');
    2 3 4
    DEVELOPER_PARAMETERS
    J:oracle.apps.fnd.cp.gsf.GSMServiceController:-mx3072m
    Could this issue be due to JVM increase issue or something else?
    How, could we monitor the jvm while the report is running to troubleshoot the issue?
    Thanks for your time and help on this if anyone is willing to share such an experience faced before?
    Regards,

    DB:11.2.0.2.0
    Oracle Apps:12.1.3
    O/S:AIX 6.1
    Hi All,
    Issue Description:
    When the report is submitted, the data gets populated into the table in less than 30secs and xml gets generated within a minute.
    But the program takes some time in displaying the output around 5 mins but when we tried with html, it opens up quickly.
    The template has a complex matrix, layout wherein, we are using nested FOR loops to display the data in the required format.
    Yesterday, we ran the report “Custom GL STAT Trial Balance Report” in DEV Instance and for around 500+ records, it took around 5 mins.
    The excel file is only 1 MB and xml generated is 245 KB
    Moreover, recently we had increased the OPP jvm to 3GB to avoid java.lang.memory error what was occurring earlier.
    select DEVELOPER_PARAMETERS
    from FND_CP_SERVICES
    where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES where
    CONCURRENT_QUEUE_NAME = 'FNDCPOPP');
    2 3 4
    DEVELOPER_PARAMETERS
    J:oracle.apps.fnd.cp.gsf.GSMServiceController:-mx3072m
    Could this issue be due to JVM increase issue or something else?
    How, could we monitor the jvm while the report is running to troubleshoot the issue?
    Thanks for your time and help on this if anyone is willing to share such an experience faced before?
    Regards,

  • How can i print an Excel file when in the full screen mode (no print options on toolbar or right clk

    using Vista, sometimes after creating and saving an excel file, the document is not visible when the file is reopened.
    selecting full screen mode makes the document visible, but the toolbars disappear and the print option does not show up on a right click.  How can i print the document and see the document in some other mode than full screen?

    In order to print, you can click the CTRL+P keys to launch the print dialog,
    Regarding the missing toolbar, try clicking the ALT key to shouw the software menu, then look around under the view option for any available toolbar settings,
    If you cannot find it, i would recommend you to try the Microsoft support forums, as they have some more knowledge with their software features
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • Is there a way to open Excell file from the server and display in the UI and save it back on to the

    Hello there,
    Is there a way to open Excell file from the server and display in the UI and save it back on to the server? (like showing xell file as a datagrid - add rows, columns etc.)

    Hi Mike,
    Welcome you to the forum.
    You may try:
    SELECT * FROM MyDBNameHere.dbo.OUSR T0
    Thanks,
    Gordon

  • Error While uploading a EXCEL file in Web dynpro - HR_KR_XSTRING_TO_STRING

    Hi,
       I am getting an error while trying to upload a excel file.  I am using the function HR_KR_XSTRING_TO_STRING for conversion. The error message is  "Unable to interpret    as a number"

    First of all, are you sure you know what you are working with here.  If this is standard Excel file in the Microsoft binary/propriatery format there is not function module or class in ABAP that can magically just transform this to a character string.  You should search the forums as this has been discussed extensively.  On that topic, please also do not post duplicate threads.  I have already locked your other thread with the same basic question.
    Instead of the binary/propriatery format of Excel, the file should be saved on the client as a text based format - like XML or Text Tab Delimited. You can then use several different options on the server to convert the XSTRING to STRING and process the content (becuase it was text based to begin with).  You could use CL_BCS_CONVERT, the function modules in the function group SCMS_CONV, or the class CL_ABAP_CONV_IN_CE.

Maybe you are looking for

  • My new I pad screen is yellow , what do I do now . Help

    Please help what do I do when the new I pad screen turns yellow .

  • Can't open a file in premiere 2014

    I downloaded the last upgrade but everytime i'm trying to open a specific project file it's telling me that the file has been saved on a newer version of premiere and it can't open it.

  • Multi-clip Question

    I'm using Multi-clip in FCP 7 to edit a two cam shoot. I've noticed that after rendering a Multi-clip video track, the independent camera views no longer show in the Viewer. They show when playback is stopped but when playback starts, the Viewer appe

  • DESADV01 inbound idoc issue- Mappping to LIPS-LICHN

    I have an Inbound Idoc DESADV01 , I want the e1edp09-charg field to be moved to LIPS-LICHN field of the New Inbound delivery. How can this be done. Regards, Sugopa Ray

  • Newbie help with cache design/custom filter

    Hello, I'm very new to Coherence, so you'll have to forgive me if these are easy questions. I have an application that contains 1.5 million products. Each product has a map of prices for our client list. So internally, each product object I'm caching