Reg transfer of data from excel to internal table

hi
i need to upload datas from Excel sheet to Internal Table.For this i use d FM
ALSM_EXCEL_TO_INTERNAL_TABLE.but the problem is if a particular field has no value in excel sheet,then its not  uploaded into internal table.then next field value has come to that blank place in d internal table. what i need is if the excel sheet has a blank value for a field then a blank value is added in d inetrnal table also.

Use below program logic
Program    : ZLWMI151_UPLOAD(Data load to ZBATCH_CROSS_REF Table)
Type       : Upload program
Author     : Seshu Maramreddy
Date       : 05/16/2005
Transport  : DV3K919574
Transaction: None
Description: This program will get the data from XLS File
             and it upload to ZBATCH_CROSS_REF Table
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
Reward points if it is helpful
Thanks
Seshu

Similar Messages

  • Upload data from Excel to Internal table in ECC

    Hello SDN,
    Here I am facing a problem for uploading the data from excel sheet to internal table in ECC6.0
    Main problem is we don't have any FM ALSM_EXCEL_TO_INTERNAL_TABLE.
    Please provide me the solution how to upload the data from excel to internal table through class. If possible please provide me the sample code so that it will be very helpful for me.
    Waitingfor your valuable response.
    Thanks & Regards,
    Kumar.

    Hi,
    you can use OLE to acces (not only) excel, but this will only work in dialog processing.
    regards,
    Hans

  • To upload data from excel to internal table

    hi
    in excel sheet it contains 4 tabs.to upload data from excel to internal table i have used this fm
    text_convert_xls_to_sap .but error wil comeing.that error in tables parameter.iternal table does not contain data.ple help me.(v 6.0) ple give me one example with coding

    Hello,
    Take a look on this: [ABAP - Upload data from Excel to Sap using OO|https://wiki.sdn.sap.com/wiki/x/xOw].
    Regards.

  • In SRM How to upload data from Excel to Internal Table

    Hello Experts,
    As seen the Function Module 'ALSM_EXCEL_TO_INTERNAL_TABLE' does not exists in SRM.
    Is there any alternative to upload the data direct from excel to Internal table using any other FM. As seach did't get any relevant FM.
    Please advice..
    Thanks..

    did u try this
    TEXT_CONVERT_XLS_TO_SAP
    in this manner
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
          i_line_header              = 'X'
          i_tab_raw_data             = lt_raw
          i_filename                 = p_path
        TABLES
          i_tab_converted_data       = gt_output
        EXCEPTIONS
          conversion_failed          = 1
          OTHERS                     = 2.
    this FM works on DOI
    so
    SAP document about DOI:
    http://help.sap.com/saphelp_nw2004s/helpdata/EN/e9/0be775408e11d1893b0000e8323c4f/frameset.htm
    SAP Demo Program about DOI: SAPRDEMOEXCELINTEGRATION.
    the fm you mentioned works on OLE
    so you could refer,
    SAP document about OLE:
    http://help.sap.com/saphelp_46c/helpdata/EN/59/ae3c98488f11d189490000e829fbbd/frameset.htm
    Also you can refer this post
    Download of SRM Contracts in Excel - Unit of Measurement Missing
    Let me know if this works ..
    Regards
    Manthan.
    Edited by: Manthan_R on Feb 23, 2010 12:18 PM

  • Upload data from Excel to Internal table

    Hi,
    I am facing a peculiar problem in uploading the data in excel sheet to internal table.
    The excel file contains material number and product hierarchy number. The product hierarchy number for some material is downloaded as 5.73101E17 for the value 573100910115782000. Though I expand the sheet the display is the same 5.73101E17. When i upload the sheet using the f'n module "ALSM_EXCEL_TO_INTERNAL_TABLE" the value is taken as it is (5.73101E+17) into the internal table which is wrong. I tried to change the data type to type n. Then the value is uploaded as 5731011700000000.
    Please propose a solution to this without having to change the format of the column from general to "number without decimals"
    Regards,
    Sam

    HI
    see this example code which EXCEL TO INTERNAL TABLE AND THEN TO APPLICATION
    *& Report  ZSD_EXCEL_INT_APP
    REPORT  ZSD_EXCEL_INT_APP.
    parameter: file_nm type localfile.
    types : begin of it_tab1,
            f1(20),
            f2(40),
            f3(20),
           end of it_tab1.
    data : it_tab type table of ALSMEX_TABLINE with header line,
           file type rlgrap-filename.
    data : it_tab2 type it_tab1 occurs 1,
           wa_tab2 type it_tab1,
           w_message(100)  TYPE c.
    at selection-screen on value-request for file_nm.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      PROGRAM_NAME        = SYST-REPID
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
       STATIC              = 'X'
      MASK                = ' '
      CHANGING
       file_name           = file_nm
    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.
    refresh it_tab2[].clear wa_tab2.
    file = file_nm.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file
        i_begin_col                   = '1'
        i_begin_row                   =  '1'
        i_end_col                     = '10'
        i_end_row                     = '35'
      tables
        intern                        = it_tab
    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.
    loop at it_tab.
      case it_tab-col.
       when '002'.
        wa_tab2-f1 = it_tab-value.
       when '004'.
        wa_tab2-f2 = it_tab-value.
      when '008'.
        wa_tab2-f3 = it_tab-value.
    endcase.
    at end of row.
      append wa_tab2 to it_tab2.
    clear wa_tab2.
      endat.
    endloop.
    data : p_file TYPE  rlgrap-filename value 'TEST3.txt'.
    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    *--- Display error messages if any.
      IF sy-subrc NE 0.
        MESSAGE e001(zsd_mes).
        EXIT.
      ELSE.
    *---Data is downloaded to the application server file path
        LOOP AT it_tab2 INTO wa_tab2.
          TRANSFER wa_tab2 TO p_file.
        ENDLOOP.
      ENDIF.
    *--Close the Application server file (Mandatory).
      CLOSE DATASET p_file.
    loop at it_tab2 into wa_tab2.
      write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
    endloop.

  • Download data from excel to internal table in CRM system?

    Hi Experts,
    Can we read multiple work sheets from an Excel work book to internal tables in CRM system?
    Ex.. Work book has 2 work sheets.  One header sheet and one item sheet.  Can we read this into two internal tables and process the data.
    If yes, pls do let me know the FM name.
    Thanks in advance,
    Cheers'
    Surekha.

    ALSM_EXCEL_TO_INTERNAL_TABLE 
    check this function module

  • Upload data from Excel to internal table without using Screen

    Hi,
    My reqirment is to read the excel input data and then upload it to internal table for further proceeing but without using selection input screen. I mean can I mention the fixed file name and the path in the function module iself for the input file.

    1.First create one internal table as u have created ur EXCEL file.
    e.g: if ur EXCEL file contains 3 fields col1 col2 and col3.
           data: begin of wa,
                     col1(10),
                     col2(10),
                     col3(10),
                   end of wa,
                   itab like standard table of wa.
    data: filename type string 'C:\FOLDER\DATA.XLS'
    If u dont want to use the screen, then pass the file name directly to the GUI_UPLOAD FM.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = filename
       FILETYPE                      = '.XLS'
      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.
    This will serve ur puspose.
    loop at itab into wa.
    write: / wa-col1,wa-col2,wa-col3.
    endloop.
    Thanks & Regards
    Santhosh

  • How to transfer data from a dynamic internal table

    Hi All
    I want to transfer data from a dynamic internal table<dyn_table>
    to a non dynamic internal table itab which should have the same structure as <dyn_table>.
    How can this be done?
    Regards,
    Harshit Rungta

    As stated earlier this can be done only through field symbols...
    You cannot create an non dynamic internal table with ANY structure...using DATA statement
    If the strucutre is defined well and good...you can create an non-dynamic internal table...
    If you do not know the structure then the internal table has to be dynamic...and to be generated using field symbols
    DATA: lv_ref TYPE REF TO data.
    FIELD-SYMBOLS: <fs_dyn_table> TYPE STANDARD TABLE.
    * You create a dynamic internal table...
    CREATE DATA lv_ref LIKE (your_dynamic_internal_table).
    ASSIGN lv_ref->* TO <fs_dyn_table>.
    Now...do the transfer.
    <fs_dyn_table> = "your_dynamic_internal_Table
    Hope it helps!

  • How do I transfer all data from my old internal hard drive to a new internal hard drive

    How do I transfer all data from my old internal hard drive to a new internal hard drive? I have an iMac with a 320gb internal HD that is full and I am replacing it with a 2tb internal drive. I have several external drives; 1 tb, 2tb and 3 tb. The 2 tb is being used for Time Machine. Do I have to buy an enclosure? If so, where would I get an inexpensive one?
    I also want to partition the new internal drive for Windows, and I'm not sure how much space to use for that. I plan to use Windows to check my work in PowerPoint created on my Mac for clients on PCs.

    Do you already have Time Machine making backups onto the 2TB drive? If so, after you get the internal drive replaced, boot up into the recovery partition (hold down ⌘R) and restore the latest Time Machine backup that you have onto the new internal drive.
    I recommend always having two backups. I'd use SuperDuper to make a complete clone of your internal drive onto an external drive in addition to having the Time Machine backup.
    Boot Camp is what is used to make partitions for Windows. How much space to allocate depends on how much space you expect Windows to use up based on how you plan to use it.

  • Upload data from excel to oracle table

    Hi,
    if i'm user and using an application and i want to upload data from excel to oracle table on button click . Is it possible by using sql loader.
    If yes then please clarify it .
    is it possible from client end.
    thanks
    kam

    Yes it is possible using SQL*LDR, External tables and ORCL Export Utility. Though I didn't try Export Utility to load the external files.
    SQLLdr sysntax:
    Create a control file.
    It looks like this
    Load data
    Infile 'source.dat' 
    Into Table tablename
    Fields terminated by ',' optionally enclosed by '"'
    {code}
    then use sqlldr command from your OS.
    {code}
    sqlldr userid/password@sid control = filename.ctl, data = source.dat, log = logname.log, bad = badname.log, discard = discardname.discard
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Data from Excel to ADF table

    Hi,
    I need to export data from excel to ADF table and edit the data and finally send it back to database.
    Would you kindly let me know how to proceed in this?
    Many thanks in advance
    Regards

    This depends on your excel file structure.
    You can use ADF Desktop Integration or
    something like this(for simple excel files):
    for excel -> adf table
    http://technology.amis.nl/2010/09/16/adf-11g-import-from-excel-into-an-adf-table/
    For adf table -> excel:
    http://www.baigzeeshan.com/2010/04/exporting-table-to-excel-in-oracle-adf.html
    http://adfreusablecode.blogspot.com/2012/07/export-to-excel-with-styles.html
    Dario

  • How  to load the data from excel  file  into table in oracle using UTL_FI

    How to load the data from excel file into table in oracle
    and from table to excel file
    using UTL_FILE package
    Please give me some example

    This is something i tried in oracle apex
    http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
    Regards,
    CKLP

  • How to fetch the data from query to internal table ?

    Dear all ,
             I would like to fetch the query data(sq01) into my internal table ? is it possible to do that ?
    Best Regards,
    Carlos

    Hi
    Try this <b>RRW3_GET_QUERY_VIEW_DATA</b>
    Also, you can have a look at this...
    <a href="/people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-ii Query results into Internal table</a>
    Regards
    Raj

  • Reading data from XML to Internal table

    Hi Experts,
    I got a requirement to read the data fom xml to internal table.is it possible to store deep internel table data into flat internal tables?my internel table contains 4 internel table and these 4 internel table contains 2 internel tables each...can any one help me o this...
    points will be rewarded...
    Regards,
    Rakhi

    Hi Rakhi,
    * Structure to Get the Client Details as in XML format
      DATA: BEGIN OF client,
              BEGIN OF Personal_Details,
                kunnr like kna1-kunnr,
                name1 like kna1-name1,
                adrnr like kna1-adrnr,
              END OF Personal_Details,
              BEGIN OF Address,
                street like adrc-street,
                city1  like adrc-city1,
              END OF Address,
              BEGIN OF Communication,
                fax_number like adrc-fax_number,
                tel_number like adrc-tel_number,
              END OF Communication,
            END OF client.
      DATA: it_client TYPE TABLE OF client WITH HEADER LINES,
            result LIKE client.
      DATA: xml_string TYPE string.
    *  Get the Client Details into the structure to be made as an XML string
      TRY.
    *  Convert the Structure to XML string
          CALL TRANSFORMATION  ('ID')
            SOURCE para = it_client
            RESULT XML xml_string.
    *  Convert the XML string to structure - result
          CALL TRANSFORMATION  ('ID')
            SOURCE XML xml_string
            RESULT para = result.
      CATCH cx_st_error.
      ENDTRY.
    best regards,
    Thangesh

  • Transfer of data from excel to Oracle database? Please reply as soon as possible

    Hello:
    How can I transfer data from MS Excel into Oracle8/8i database.
    Please give me step by step instructions or necessary code required
    Thank you
    Dinakar

    Save the excel data in .CSV file format, then use SqlLoader.
    Your SqlLoader control file might look as follows
    LOAD DATA
    INFILE c:\test_data.csv
    APPEND
    INTO TABLE emp
    FIELDS TERMINATED BY ","
    (fld1, fld2, fld3, ...)

Maybe you are looking for

  • Is there a way to run a For Loop independen​tly within a While Loop in LabVIEW 2013?

    In my program I would like to run a For loop inside of a While loop, and have them run independently, at their own execution rates.  As a test, I wrote a simple VI with a While loop with 1 second timing, and into this I inserted a For loop with 3 sec

  • Error when determining a number from object BI_TSDTEL and number 01

    Hi BW Experts, After Transporting Infosources (Master & Transaction) to BW QA, the transfer rules were not getting activated in QA. The following error message was diaplyed. "Error when determining a number from object BI_TSDTEL and number 01 Object

  • HOW DO I ENABLE COOKIES SO I CAN ACCESS MY GMAIL?

    My gmail account is not allowing me access because the computer is saying something about my cookie settings and I have NO EARTHLY IDEA WHAT IT IS ASKING ME TO DO! I've tried to follow your useless directions to change settings and am getting NOWHERE

  • JBuilder deprecation warnings

    I'm working on a project using JBuilder, and some of our methods have been deprecated, but I don't get any deprecation warnings when I compile any of the classes that call the deprecated methods. I understand that it won't warn me when the class cont

  • CS6 - problem to install 'myriad mm'

    Please, who can help with special font 'myriad mm' We changed to Creative Suite CS6 from a older version und have trouble to install our official and paid type 'myriad mm' from 1994. Is there a way to install this font in Illustrator 64bit version? T