Upload data from multiple worksheets of excel file into SAP by using MIME?

Hi all,
I'm trying to getting the data from a multiple worksheet excel file by usin the MIME Repository.
First of all i realizied it like [here|http://abap-explorer.blogspot.com/2008/12/upload-data-from-multiple-worksheets-of.html] in a normal ABAP Report.
By trying to transfer the code to a WebDynpro Component, i get problems.
With this part of code, because ActiveX is not allowed in our Webbrowser. So i have to find another solution to get the data from the excel file.
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = iref_control
error   = iref_error
I tried to rebuild this solution in webdynpro. But it dont works.
So my next step was trying to Read the Excel sheet directly from MIME by getting the Content (XString).
But there is no useful information Just a mix out of '######' and other symbols.
By converting it into String the same problem.
Maybe someone has an idea how to rebuild [this code|http://abap-explorer.blogspot.com/2008/12/upload-data-from-multiple-worksheets-of.html] in Webdynpro that it works correctly.
Currently Im Using the Fileupload UI Element. All Works fine. I can Upload the Excel file to MIME Repository and i can open it from there.
But i cant get the same clear informationen from the file, to write it later in a Database, like before without webdynpro.
i hope someone can help me.
Edited by: Sascha Baumann on Apr 20, 2009 4:28 PM

You can't read the native binary Excel Format in server side ABAP.  The functions and classes that did this in Classic Dynpro used OLE Automation via the SAPGUI Control Framework to remotely control Excel to read the data.  Because in the browser you have no connection to the SAPGUI or are sandboxed inside the browser; the same functionality is not possible. 
I would suggest that you look into saving the Excel file as a open, text format.  You might be able to use XML (although the Excel XML format can be complex) to support multiple sheets. You would have to build the logic yourself (using XSLT or the iXML parser) to process the XML format back into ABAP data.

Similar Messages

  • How to retrieve data from a read-only Excel file

    Hi Developers,
    I'm trying to retrieve data from a read-only Excel file. I used the same code that I used to retrieve data from a normal Excel file, but it can't work.
    My code is as followed:
    try
    InputStream KpExcel = new FileInputStream("kp.xls");
    HSSFWorkbook Kpwb = new HSSFWorkbook(KpExcel);
    HSSFSheet Kpsheet = Kpwb.getSheetAt(0);
    catch(Exception e)
    e.printStackTrace();
    System.out.println("Exception: "+e.getMessage());
    The error I received is as followed:
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:224)
    at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:160)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:210)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:191)
    at photoproductionsystem.IncomingWIPPanel.getKp(IncomingWIPPanel.java:118)
    at photoproductionsystem.IncomingWIPPanel.<init>(IncomingWIPPanel.java:76)
    at photoproductionsystem.TabbedDisplay.<init>(TabbedDisplay.java:47)
    at photoproductionsystem.Display.create(Display.java:73)
    at photoproductionsystem.Display.init(Display.java:44)
    at photoproductionsystem.Display.main(Display.java:229)
    Caused by: java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at org.apache.poi.hssf.record.UnknownRecord.<init>(UnknownRecord.java:62)
    at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:57)
    at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
    at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)
    at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
    at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
    ... 15 more
    Can someone please help me with my problem? Thanks a lot in advance!

    Madeline wrote:
    how do I ask at Apache mailing list?I wonder why it seems to be a strange idea to some people to look at the software vendor's site for product support. :p
    http://poi.apache.org/mailinglists.html

  • Help Required:How Upload Excel file Into Oracle Table Using PLSQL Procedure

    Please Help , Urgent Help Needed.
    Requirement is to Upload Excel file Into Oracle Table Using PLSQL Procedure/Package.
    Case's are :
    1. Excel File is On Users/ Client PC.
    2. Application is on Remote Server(Oracle Forms D2k).
    3. User Is Using Application Using Terminal Server LogIn.
    4. So If User Will Use to GET_FILE_NAME() function of D2K to Get Excel File , D2k Will Try to pick File from That Remote Server(Bcs User Logind from Terminal Server Option).
    5. Cannot Use Util_File Package Or Oracle Directory to Place That File on Server.
    6. we are Using Oracle 8.7
    So Need Some PL/SQL Package or Fuction/ Procedure to Upload Excel file on User's Pc to Oracle Table.
    Please Guide me wd some Code. or with Some Pl/SQL Package, or With SOme Hint. Or any Link ....
    Jus help to Sort This Issue ........
    you can also write me on :
    [email protected], [email protected]

    TEXT_IO is a PL/SQL package available only in Forms (you'll want to post in the Forms forum for more information). It is not available in a stored procedure in the database (where the equivalent package is UTL_FILE).
    If the Terminal Server machine and the database machine do not have access to the file system on the client machine, no application running on either machine will have access to the file. Barring exceptional setups (like the FTP server on the client machine), your applications are not going to have more access to the client machine than the operating system does.
    If you map the client drives from the Terminal Server box, there is the potential for your Forms application to access those files. If you want the files to be accessible to a stored procedure in the database, you'll need to move the files somewhere the database can access them.
    Justin

  • FM to get Data from Sheet of an excel file to Internal table??

    Hello Champs!!!
    I have a problem in Excel File's Data Getting.
    There are diffrent Sheets in a single Excel file. I need data of a perticular sheet into an internal Table.
    Like there are 2 Sheets in an Excel file EXCEL1, Sheet1 & Sheet2. Both Sheet have diffrent Data in it.
    Now i only need Data of Sheet1 of this Excel FIle Excel1.
    How can i get it?
    Can you please help me in this?
    Thanks in Advance!!!!
    Girija Shankar

    Welcome to SCN
    Please search before you post next time:BDC, upload data from multi excel sheets

  • Writing data from a table to Excel file

    Hello friends,
    I am using Forms 5.0 on Windows NT. I need to write data from table A to Excel sheet from trigger 'when-botton-pressed'. Could you help me Any help will be appriciated.
    Thanks
    Charg
    null

    HERE IS THE CODE.
    YOU CAN RUN IT USING THE DEPT TABLE.
    PROCEDURE export_transaction_to_excel IS
    application ole2.obj_type;
    workbooks ole2.obj_type;
    workbook ole2.obj_type;
    worksheets ole2.obj_type;
    worksheet ole2.obj_type;
    cell ole2.obj_type;
    fdes varchar2(250);
    rowcounter number:=1;
    local_cursor_record number:=:system.cursor_record;
    old_cursor_style varchar2(100);
    errors_occured boolean:=false;
    ole_error exception;
    pragma exception_init(ole_error, -305500);
    my_alert_id alert;
    alert_respnse number;
    procedure place_value_in_cell(rownum_in in number,colnum_in in number,value_in in varchar2) is
    args ole2.list_type;
    begin
    args:=ole2.create_arglist;
    ole2.add_arg(args,rownum_in);
    ole2.add_arg(args,colnum_in);
    --cell:=ole2.invoke_obj(worksheet,'Cells',args);
    cell:=ole2.get_obj_property(worksheet,'Cells',args);
    ole2.destroy_arglist(args);
    ole2.set_property(cell,'Value',value_in);
    ole2.release_obj(cell);
    end place_value_in_cell;
    procedure savespreadsheet is
    args ole2.list_type;
    vDatestamp varchar2(20);
    begin
    fdes:='C:\TESTFORM.XLS';
    vDatestamp:=to_char(sysdate,'mmddyyyyy')&#0124; &#0124;'-'&#0124; &#0124;to_char(sysdate,'hh24miss');
    args:=ole2.create_arglist;
    ole2.add_arg(args,fdes);
    ole2.invoke(worksheet,'SaveAs',args);
    ole2.destroy_arglist(args);
    ole2.invoke(application,'Quit');
    end savespreadsheet;
    procedure open_excel_workbook is
    begin
    application:=ole2.create_obj('Excel.Application');
    workbooks:=ole2.get_obj_property(application,'Workbooks');
    workbook:=ole2.invoke_obj(workbooks,'Add');
    worksheets:=ole2.get_obj_property(application,'Worksheets');
    worksheet:=ole2.invoke_obj(worksheets,'Add');
    end open_excel_workbook;
    procedure write_column_header is
    begin
    place_value_in_cell(rowcounter,1,'Depart No');
    place_value_in_cell(rowcounter,2,'Depart Name');
    place_value_in_cell(rowcounter,3,'Loc');
    rowcounter:=rowcounter+1;
    end write_column_header;
    procedure export_the_data is
    original_receipt number;
    original_date date;
    original_transmital_number number;
    begin
    go_block('dept');
    first_record;
    loop
    place_value_in_cell(rowcounter,1,to_char(:deptno));
    place_value_in_cell(rowcounter,2,:dname);
    place_value_in_cell(rowcounter,3,:loc);
    exit when :system.last_record='TRUE';
    next_record;
    rowcounter:=rowcounter+1;
    end loop;
    end export_the_data;
    BEGIN
    begin
    old_cursor_style:=get_application_property(cursor_style);
    set_application_property(cursor_style,'BUSY');
    open_excel_workbook;
    write_column_header;
    export_the_data;
    exception
    when form_trigger_failure then
    raise;
    when ole_error then
    message('error sending data to excel');
    message(' ');
    errors_occured:=true;
    end;
    savespreadsheet;
    ole2.release_obj(worksheet);
    ole2.release_obj(worksheets);
    ole2.release_obj(workbook);
    ole2.release_obj(workbooks);
    ole2.release_obj(application);
    if not errors_occured then
    go_record(local_cursor_record);
    end if;
    set_application_property(cursor_style,old_cursor_style);
    END export_transaction_to_excel;

  • Upload data from Internal table to text file with  '~' separator

    can anyone help me to download data from internal table to flat file with  ''  separator. GUI_DOWNLOAD is not working in my case ....like for ''  separator

    Here it is
    REPORT  zkb_test1.
    TYPE-POOLS: truxs.
    DATA: i_scarr TYPE TABLE OF scarr,
    i_conv_data TYPE truxs_t_text_data.
    SELECT * FROM scarr INTO TABLE i_scarr.
    CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
      EXPORTING
        i_field_seperator    = '~'
      TABLES
        i_tab_sap_data       = i_scarr
      CHANGING
        i_tab_converted_data = i_conv_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.
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        filename                = 'C:\Test1.txt'
        filetype                = 'ASC'
      CHANGING
        data_tab                = i_conv_data
      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
        not_supported_by_gui    = 22
        error_no_gui            = 23
        OTHERS                  = 24.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Regards
    Kathirvel

  • Need help in uploading an excel file into SAP

    Hi All,
    I got a requirement to upload an excel file to SAP.
    But When i tried with the FM "ALSM_EXCEL_TO_INTERNAL_TABLE" , file  not getting uploaded to internal table.
    Getting expection 2, UPLOAD_OLE...
    I think the problem is with the file... the following the sample text of the file...
    Technical IdentNo.     Line No.     Text                                 Location
    BS-PZ-180                   1     035-05 EXZENTER-SCHNECKENPUMPE             0026
    BS-PZ-180                   2          LIEFERANT : SOCSIL-INTER SA  ECUBLENS     0026
    BS-PZ-180                   3          HERSTELLER : MONO PUMPS LIMITED  MANCH     0026
    BS-PZ-180                   4          MODELL/TYP : SH 60                             0026
    But when I tried with only one Column..its getting successfully uploaded...
    Pls suggest me how to upload the file? ( May be with sample code)
    Also pls let me know hw to handle the file..which contains 5 differnt sheets of texts.. ( May be with sample code)
    Your suggestion will be highly appreciated...
    Thanks,
    Priya

    Hi,
    Use the FM: TEXT_CONVERT_XLS_TO_SAP.  It will work perfectly.  I used this function module and uploaded data from xls to sap.  check the following code:
    TYPE-POOLS: truxs.
    PARAMETERS: p_file TYPE  rlgrap-filename.
    TYPES: BEGIN OF t_datatab,
          PROP_NAME like SDOKPROP-PROP_NAME,
          PROP_CHECK like SDOKPROP-PROP_CHECK,
          TABNAME like SDOKPROP-TABNAME,
          FIELDNAME like SDOKPROP-FIELDNAME,
          DESCRIPT(30) type c,
          END OF t_datatab.
    DATA: it_datatab type standard table of t_datatab,
          itab  TYPE STANDARD TABLE OF t_datatab,
          wa_itab TYPE 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.
    SELECT * FROM sdokprop INTO CORRESPONDING FIELDS OF TABLE itab
    WHERE PROP_NAME LIKE 'DMS%'.
    WRITE / 'Before Modification'.
      LOOP AT itab INTO wa_itab.
        WRITE:/1 wa_itab-PROP_NAME, 27 wa_itab-PROP_CHECK, 31 wa_itab-TABNAME, 65 wa_itab-FIELDNAME, 96 wa_itab-DESCRIPT.
        CLEAR wa_itab.
      ENDLOOP.
      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.
      WRITE / 'After Modification'.
    MODIFY sdokprop FROM TABLE it_datatab.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/1 wa_datatab-PROP_NAME, 27 wa_datatab-PROP_CHECK, 31 wa_datatab-TABNAME, 65 wa_datatab-FIELDNAME, 96 wa_datatab-DESCRIPT.
        CLEAR wa_datatab.
      ENDLOOP.
      IF sy-subrc = 0.
        MESSAGE 'successfull' TYPE 'S'.
      ELSE.
        MESSAGE 'failed' TYPE 'E'.
      ENDIF.
    Regards,
    Bhaskar

  • Can anybody help how to upload an excel file into sap-crm urgent

    hi guys,
    i need the right function module to upload the excel file from the presentation server in to sap-crm.
    1) I know we use the function module 'ALSM_EXCEL_TO_INT_TABLE' in sap-r/3 but this function module is not exist in sap-crm.
    2) i tried with the function moduel 'GUI_UPLOAD' but its not uploading correctly i am gettting hases(#).
    Please can any one provide the right function module to upload the excel into sap-crm with an sample code.
    thanks
    viswa guntha

    Hi Visma,
    Please check this link for sample custom FM.
    Re: function mudule for MS excel file to sap crm
    Hope this will help.
    Regards,
    Ferry Lianto
    Please reward points if helpful as away to say thanks.

  • Uploading File into SAP Transaction using BSP

    Hi Everybody,
    I would like to know how to save the file into SAP Transaction thro BSP. I have one requirement,For example,the captured file from the web should be attached into the Equipment master (Transaction Code IE02).Its possible via SAP GUI.But i would like to know how it can be done from BSP.The same example applicable to sales order also..
    Also i wondering where these files get stored.
    Anybody could help me out of this issue please?...
    Naga Bokkisam

    You can do that using BDS..But you need to find the Business object to store it under Equipment Master or Sales order.
    Here is the example where i stored the document under Warranty process, ie sub set of Equipment master:
    Here BUS2222 is business object for Warranty Process:
      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER                = STR_FILE_CONTENT
        TABLES
          BINARY_TAB            = I_FILE_CONTENT.
      CALL FUNCTION 'BDS_BUSINESSDOCUMENT_CREA_TAB'
        EXPORTING
          CLASSNAME             = 'BUS2222' "classname_select
          CLASSTYPE             = 'BO'" classtype_select
        CLIENT                = SY-MANDT
          OBJECT_KEY            = OBJECT_KEY
        BINARY_FLAG           = 'X'
        TABLES
          SIGNATURE             = I_SIGNATURE
          COMPONENTS            = I_COMPONENTS
        CONTENT               = I_FILE_CONTENT
    EXCEPTIONS
       NOTHING_FOUND         = 1
       PARAMETER_ERROR       = 2
       NOT_ALLOWED           = 3
       ERROR_KPRO            = 4
       INTERNAL_ERROR        = 5
       NOT_AUTHORIZED        = 6
       OTHERS                = 7     .
    Let me know if you need any detail..
    <i>*Reward each useful answer</i>
    Raja T

  • Steps to prepare and upload legacy master data excel files into SAP?

    Hi abap experts,
    We have brand new installed ECC system somehow configured but with no master or transaction data loaded .It is new empty system....We also have some legacy data in excel files...We want to start loading some data into the SAP sandbox step by step and to see how they work...test some transactions see if the loaded data are good etc initial tests.
    Few questions here are raised:
    -Can someone tell me what is the process of loading this data into SAP system?
    -Should this excel file must me reworked prepared somehow(fields, columns etc) in order to be ready for upload to SAP??
    -Users asked me how to prepared their legacy excel files so they can be ready in SAP format for upload.?Is this an abaper job or it is a functional guy job?
    -Or should the excel files be converted to .txt files and then imported to SAP?Does it really make some difference if files are in excel or .txt format?
    -Should the Abaper determine the structure of those excel file(to be ready for upload ) and if yes, what are the technical rules here ?
    -What tools should be used for this initial data loads? CATT , Lsmw , batch input or something else?
    -At which point we should test the data?I guess after the initial load?
    -What tools are used in all steps before...
    -If someone can provide me with step by step scenario or guide of loading some kind of initial master data - from .xls file alignment to the real upload - this will be great..
    You can email me some upload guide or some excel/txt file examples and screenshots documents to excersize....
    Your help is appreciated it.!
    Jon

    hi,
    excel sheet uploading:
    http://www.sap-img.com/abap/upload-direct-excel.htm
    http://www.sap-img.com/abap/excel_upload_alternative-kcd-excel-ole-to-int-convert.htm
    http://www.sapdevelopment.co.uk/file/file_upexcel.htm
    http://www.sapdevelopment.co.uk/ms/mshome.htm

  • Reg: Downloading  and Uploading Date from Oracle Forms11g to Excel

    Hi All,
    We are migrating to Oracle Forms11g from oracle forms6i , i need to knwo how the Report can be generated in 11g to Ecxel . For Uploading and Downloading.
    Please suggest any idea and suggestions.
    Thanks in Advances
    Gunisetty Venkatesulu

    Hi All,
    Any idea to upload and download to excel in Oracle forms11g using webutil , excel interaction should be on Client system .
    Uploading time excel should open in Client sysetm.
    Downloading Time User will select the Excel file from Client system.
    Please give any idea or suggestions will be appreaciated for this. Iam new to webutil.
    Gunisetty Venkatesulu

  • How to download data from different sheet of excel file.

    Hi Friends,
    I have a Excel file with different sheet like sheet 1, sheet 2 and so on,
    and i have to download each sheet data in to different internal tables.
    Is there any FM or something else.
    Pl. help
    Thanks
    Sunil.

    Hi,
       You can create the function module for this.
    The code sample is as below:
    *Code Sample *
    FUNCTION Z_UPLOADING_FROM_2SHEETS.
    ""Local interface:
    *" IMPORTING
    *" VALUE(FILE_NAME) LIKE RLGRAP-FILENAME
    *" VALUE(START_ROW_SHEET1) TYPE I
    *" VALUE(START_COLUMN_SHEET1) TYPE I
    *" VALUE(START_ROW_SHEET2) TYPE I
    *" VALUE(START_COLUMN_SHEET2) TYPE I
    *" VALUE(END_ROW_SHEET1) TYPE I
    *" VALUE(END_COLUMN_SHEET1) TYPE I
    *" VALUE(END_ROW_SHEET2) TYPE I
    *" VALUE(END_COLUMN_SHEET2) TYPE I
    *" TABLES
    *" IT_DATA1 STRUCTURE ALSMEX_TABLINE
    *" IT_DATA2 STRUCTURE ALSMEX_TABLINE
    *" EXCEPTIONS
    *" INCONSISTENT_PARAMETERS
    *" UPLOAD_OLE
    DATA DECLARATION
    DATA: excel_tab TYPE ty_t_sender,
    excel_tab1 TYPE ty_t_sender.
    DATA: ld_separator TYPE c.
    DATA: application TYPE ole2_object,
    workbook TYPE ole2_object,
    SHEET TYPE OLE2_OBJECT,
    range TYPE ole2_object,
    worksheet TYPE ole2_object.
    DATA: h_cell TYPE ole2_object,
    h_cell1 TYPE ole2_object.
    DATA: ld_rc TYPE i.
    MESSAGE DEFINATION
    DEFINE m_message.
    case sy-subrc.
    when 0.
    when 1.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    when others. raise upload_ole.
    endcase.
    END-OF-DEFINITION.
    PARAMETER CHECK
    IF START_ROW_SHEET1 > END_ROW_SHEET1.
    RAISE inconsistent_parameters.
    ENDIF.
    IF START_COLUMN_SHEET1 > END_COLUMN_SHEET1.
    RAISE inconsistent_parameters.
    ENDIF.
    IF START_ROW_SHEET2 > END_ROW_SHEET2.
    RAISE inconsistent_parameters.
    ENDIF.
    IF START_COLUMN_SHEET2 > END_COLUMN_SHEET2.
    RAISE inconsistent_parameters.
    ENDIF.
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    ld_separator = cl_abap_char_utilities=>horizontal_tab.
    OPENING EXCEL FILE
    IF application-header = space OR application-handle = -1.
    CREATE OBJECT application 'Excel.Application'.
    m_message.
    ENDIF.
    CALL METHOD OF APPLICATION 'Workbooks' = WORKBOOK.
    m_message.
    CALL METHOD OF application 'Workbooks' = workbook.
    m_message.
    CALL METHOD OF workbook 'Open' EXPORTING #1 = FILE_NAME.
    m_message.
    CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 1.
    m_message.
    CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 1.
    m_message.
    CALL METHOD OF SHEET 'Activate'.
    m_message.
    GET PROPERTY OF application 'ACTIVESHEET' = sheet.
    m_message.
    MARKING OF WHOLE SPREADSHEET
    CALL METHOD OF sheet 'Cells' = h_cell
    EXPORTING #1 = START_ROW_SHEET1 #2 = START_COLUMN_SHEET1.
    m_message.
    CALL METHOD OF sheet 'Cells' = h_cell1
    EXPORTING #1 = END_ROW_SHEET1 #2 = END_COLUMN_SHEET1.
    m_message.
    CALL METHOD OF sheet 'RANGE' = range
    EXPORTING #1 = h_cell #2 = h_cell1.
    m_message.
    CALL METHOD OF range 'SELECT'.
    m_message.
    Copy marked area (SHEET1) into Clippboard
    CALL METHOD OF range 'COPY'.
    m_message.
    Read clipboard into ABAP
    CALL METHOD cl_gui_frontend_services=>clipboard_import
    IMPORTING
    data = excel_tab
    EXCEPTIONS
    cntl_error = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE a037(alsmex).
    ENDIF.
    PERFORM separated_to_intern_convert TABLES excel_tab IT_DATA1
    USING ld_separator.
    Clear the clipboard
    REFRESH excel_tab.
    CALL METHOD cl_gui_frontend_services=>clipboard_export
    IMPORTING
    data = excel_tab
    CHANGING
    rc = ld_rc
    EXCEPTIONS
    cntl_error = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    OTHERS = 4
    Working in Second Excel Work Sheet
    CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 2.
    m_message.
    CALL METHOD OF SHEET 'Activate'.
    m_message.
    GET PROPERTY OF application 'ACTIVESHEET' = sheet.
    m_message.
    Mark Sheet2
    CALL METHOD OF sheet 'Cells' = h_cell
    EXPORTING #1 = START_ROW_SHEET2 #2 = START_COLUMN_SHEET2.
    m_message.
    CALL METHOD OF sheet 'Cells' = h_cell1
    EXPORTING #1 = END_ROW_SHEET2 #2 = END_COLUMN_SHEET2.
    m_message.
    CALL METHOD OF sheet 'RANGE' = range
    EXPORTING #1 = h_cell #2 = h_cell1.
    m_message.
    CALL METHOD OF range 'SELECT'.
    m_message.
    Copy Marked Area (Sheet2) into Clippboard
    CALL METHOD OF range 'COPY'.
    m_message.
    Read Clipboard into ABAP
    CALL METHOD cl_gui_frontend_services=>clipboard_import
    IMPORTING
    data = excel_tab1
    EXCEPTIONS
    cntl_error = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE a037(alsmex).
    ENDIF.
    PERFORM separated_to_intern_convert TABLES excel_tab1 IT_DATA2
    USING ld_separator.
    Clear Clipboard
    REFRESH excel_tab.
    CALL METHOD cl_gui_frontend_services=>clipboard_export
    IMPORTING
    data = excel_tab1
    CHANGING
    rc = ld_rc
    EXCEPTIONS
    cntl_error = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    OTHERS = 4
    Leaving Application .
    CALL METHOD OF application 'QUIT'.
    m_message.
    FREE OBJECT application.
    m_message.
    ENDFUNCTION.

  • How to Transfer SAP data to perticular Worksheet in Excel file

    Hi,
    I have a requirenment to Transfer SAP data to Perticular WorkSheet in an Existing Excel file, i tries using EXCEL_OLE_STANDARD_DAT but this FM deletes all Existing worksheets in the Excel file and creates only one new worksheet and adds data to it.
    Please Help me to solve this issue.....
    Thanks
    Srilatha

    hello,
    what kinf of data do you need to transfer?
    master data
    or
    payroll results?
    regards
    stefan

  • How to Downlaod Data from Alv List to Excel File

    Hi,
      I have a Requirement like While download data from ALV to Excel File .After Download data into Excel we will not allow user to edit the Excel data..
    Plz  help me to complete this scenario.
    Thanks & Regards,
    Kumaran Duraiswamy.

    hi,
    try these following fm's
    MS_EXCEL_OLE_STANDARD_DAT
    EXCEL_OLE_STANDARD_DAT
    CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
    EXPORTING
    file_name = 'Your Path' " enter your path to save the file.
    CREATE_PIVOT = 0
    * DATA_SHEET_NAME = ' '
    * PIVOT_SHEET_NAME = ' '
    * PASSWORD = ' '
    * PASSWORD_OPTION = 0
    VISIBLE = '0'
    No_DIALOG = 'X'
    TABLES
    * PIVOT_FIELD_TAB =
    DATA_TAB = t_deli_final
    * FIELDNAMES =
    EXCEPTIONS
    FILE_NOT_EXIST = 1
    FILENAME_EXPECTED = 2
    COMMUNICATION_ERROR = 3
    OLE_OBJECT_METHOD_ERROR = 4
    OLE_OBJECT_PROPERTY_ERROR = 5
    INVALID_FILENAME = 6
    INVALID_PIVOT_FIELDS = 7
    DOWNLOAD_PROBLEM = 8
    OTHERS = 9
    IF sy-subrc 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    2nd fm
      CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
           EXPORTING
                FILE_NAME                 = 'Your Path' "path to save your file
                DATA_SHEET_NAME           = V_SHEET_NAME
           TABLES
                DATA_TAB                  = TLX
           EXCEPTIONS
                FILE_NOT_EXIST            = 1
                FILENAME_EXPECTED         = 2
                COMMUNICATION_ERROR       = 3
                OLE_OBJECT_METHOD_ERROR   = 4
                OLE_OBJECT_PROPERTY_ERROR = 5
                INVALID_FILENAME          = 6
                INVALID_PIVOT_FIELDS      = 7
                DOWNLOAD_PROBLEM          = 8
                OTHERS                    = 9.
      IF SY-SUBRC NE 0.
        WRITE:/ 'ERROR OPENING EXCEL'.
      ENDIF.
    ELSE.
      WRITE:/ 'ERROR OR NO DATA'.
    ENDIF.

  • Uploading EXCEL file into Internal Table Using GUI_UPLOAD

    Can any one please give me an example use of FM "GUI_UPLOAD" which to upload a EXCEL file????? (not .txt)

    Use the forum search option [GUI_UPLOAD FOR EXCEL|https://forums.sdn.sap.com/search.jspa?threadID=&q=GUI_UPLOADFOREXCEL&objID=c42&dateRange=all&numResults=15&rankBy=10001]) or sdn wiki/code gallery ([UPLOAD EXCEL|https://wiki.sdn.sap.com/wiki/dosearchsite.action?searchQuery.queryString=upload+Excel&searchQuery.spaceKey=conf_global])  - Same question already answered many time
    GUI_UPLOAD doesnt perform such conversion (Excel, Word, PDF) and wont give you a suitable result, use one of the FM mentioned above or [office integration|http://help.sap.com/saphelp_47x200/helpdata/en/21/b53138e1ba11d2bdbe080009b4534c/frameset.htm] or OLE or convert your Excel sheet to a simpler format : txt, csv, xml.
    Regards,
    Raymond

Maybe you are looking for

  • Please help me....Having trouble accessing iTunes store it won't load on my computer but will on Hubbys

    I can't seem to get the iTunes store to load on my computer it lets me go through my playlists and stuff but not the store.  My hubby has no trouble loading the iTunes store on his computer though the only differences between our computers is mine is

  • Strange Transaction Behavior

    Using WLS6.0, sp 1, EJB2.0 CMP Entity Beans:           If I modify 2 existing Entity EJBs (an Order EJB and an OrderLineItem           EJB, for example) within a single user transaction and an exception           occurs, modifications to both entitie

  • T430s - Unable to install Windows 8.1 update / Requires Rapidboot to be uninstalled

    Hi folks, I'm trying to install the Windows 8.1 update on my Windows 8 Pro but I'm in front of an issue. After doing the check to perform the update, it does ask me to uninstall RapidBoot in order to perform the update. I've checked in my programs to

  • Word files with no extensions  .doc

    Hi if a start up staroffice 8.0 on linux with a word file, with no .doc extension it's not working. soffice file (works on solaris, does not work on linux) soffice file.doc ( works on both platforms) It looks like the soffice solaris version loads th

  • 10.4.6 Update and DVD-Video

    Hi all. Today I've updated from 10.4.5 to 10.4.6. Today I can't see my DVD-Video on my powerbook g4 combo. When I insert a DVD-Video on my drive, DVD Video Player app starts but shows nothing. No icon on my desktop. No problem with data DVD and CDs.