OLE Download to existing Excel file

Hi,
I am using OLE functions to download data to an existing excel file but facing problem in opening the existing file.
I am using the following code to open an existing file
  CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
  SET PROPERTY OF h_excel 'Visible' = 1.
  CALL METHOD OF h_excel 'Workbooks' = h_mapl.
  CALL METHOD OF h_mapl 'Open'
    EXPORTING
    #1 = p_file.
When i debug   CALL METHOD OF h_mapl 'Open' is giving SY-SUBRC = 2.
Please advice how to proceed.
Regrads,
Ramu N.

Hi Ramu.
Check this Demo program RSDEMO01.
Check the transaction code DWDM. you will get some other examples as well.
Thanks,
Venkat.O

Similar Messages

  • What is the best way to insert massive data into an existing excel file?

    dear gurus,
    i am wondering that what is the best way to insert massive data into an existing excel file, more performance perspective.
    the file is read from BDS , and we want to insert data into it .
    the way i can think of is
    1. OLE AUTOMATION
       i think performance will be a big problem
    2. Office integration
        i am not sure it's facing the same performance issue ?
    3 . XXL_SIMPLE_API/FULL_API
        I am not sure whether they can insert data into an existing excel file?
    could you please give me some advices?
    br.
    jun

    Hi,
    If you want to APPEND data( add data to an existing excel file) from SAP, then use GUI_DOWNLOAD fm with APPEND = 'X' paramter.
    Best regards,
    Prashant

  • Populate existing excel file in presentation server

    Hi,
    My requirement is to populate an existing excel file in the presentation server. After the data has been uploaded the file needs to be saved in another name .
    Could someone help me out on this.
    thanks

    hi,
    check this sample code...
    hope it works..
    data: begin of itab occurs 0,
          vbeln like vbak-vbeln,
          posnr like vbap-posnr,
          end of itab.
    select vbeln
           posnr
           from vbap
           up to 20 rows
           into table itab.
    * EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    * handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_WORK  TYPE OLE2_OBJECT,
          H_SHEET TYPE OLE2_OBJECT,
          H_CELL  TYPE OLE2_OBJECT,
          V_COL   LIKE SY-TABIX.     " column number of the cell
    DATA:
      V_STEP(30),
      V_FILE LIKE RLGRAP-FILENAME.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Creating Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * start Excel
      V_STEP = 'Starting Excel'.
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
      CALL METHOD OF H_EXCEL 'APPEND'
        EXPORTING  #1 = 'D:SappdfABAP Trainingsheettr.xls'.
    *  PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * Get the list of workbooks
      V_STEP = 'Preaparing Excel'.
      CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
      PERFORM ERR_HDL.
    ** Add new workbook (create a file)
      CALL METHOD OF H_WORK 'ADD'.
      PERFORM ERR_HDL.
    * Get the created worksheet
    ************************Sheet Number
      CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
    ************************Sheet Number
      PERFORM ERR_HDL.
    * Activate (select) the first sheet
      CALL METHOD OF H_SHEET 'ACTIVATE'.
      PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * output column headings to active Excel sheet
      V_STEP = 'Adding data to Excel'.
      LOOP AT ITAB.
        V_COL = SY-TABIX.
        PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
        PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
      ENDLOOP.
      V_STEP = 'Releasing Excel'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
      H_EXCEL-HANDLE = -1.
    *&      Form  ERR_HDL
    *       text
    *  -->  p1        text
    FORM ERR_HDL.
      IF SY-SUBRC <> 0.
        WRITE: / 'Error in processing Excel File:', V_STEP.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL
    *&      Form  FILL_CELL
    *       text
    *      -->P_1      text
    *      -->P_1      text
    *      -->P_1      text
    FORM FILL_CELL USING  ROW COL VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_CELL
                     EXPORTING #1 = ROW #2 = COL.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_CELL 'Value' = VAL .
      PERFORM ERR_HDL.
    regards
    satesh

  • How to rename and access  worksheet form existing Excel file??

    Hi all,
    Is there any FM to access particular excel worksheet?? I want to <b>download data</b> <b>into a particular sheet</b> <b>of existing excel file</b>. Is there any FM for that??

    Re: Download into Excel Sheet
    regards
    Andreas

  • 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

  • How to get data from an existing Excel file using report generation toolkit

    I'm trying to use the Excel Get Data vi from the report generation toolkit, but i can't figure out how to turn a browsable path into the right type for the VI.  I've tried using the New Report.vi, but that doesn't work unless you use a template.  It won't open an existing excel file and make it an open report to pull data from.
    Essentially, i have a bunch of excel files that have data in them and i want to use a VI to analyze the data.  So, i'm trying to pull in all the data directly from the excel file so i don't have to reproscess them all into text so i can use the more standard spreadsheet VIs.  But to even convert the excel file programtically in labview won't i still need to be able to open the excel file and get the data?
    Solved!
    Go to Solution.

    I C.
    Got it,
    the reason why I can view it using my Excel file because its in .CSV.
    I open Microsoft Excel to open .CSV file.
    But you can also open .csv file with notepad.
    So, you cannot open .xls with Read Spreadsheet File
    I learn something everyday
    Best regards,
    Krispiekream

  • Downloading ALV to excel file

    Hi all,
       i am trying to download ALV to excel file.
       but as the alv contains many fields,
       the row in the excel is automatically wrapped to the
       next row ..
       what i want is the row in excel should come as it is
       in the ALV (whole thing in one line) and should not wrap to next row
      Regards,
      Tarang

    Hi Shah,
    <b>
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'</b>
        EXPORTING
          I_CALLBACK_PROGRAM      = V_REPID
          I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
          IS_LAYOUT               = WA_LAYOUT
          I_SAVE                  = 'A'
          IT_FIELDCAT             = I_FLDCAT_HEAD
          IT_SORT                 = IT_SORT
          IT_EVENTS               = I_EVENTS
        TABLES
          T_OUTTAB                = IT_FINAL
        EXCEPTIONS
          PROGRAM_ERROR           = 1
          OTHERS                  = 2.
      IF SY-SUBRC = 0.
    <b>     CALL FUNCTION 'GUI_DOWNLOAD'</b>
         EXPORTING
          BIN_FILESIZE                    =
            FILENAME                        = 'C:\Documents and Settings\vikranthk\Desktop\vikranth.xls'
           FILETYPE                        = 'ASC'
          APPEND                          = ' '
          WRITE_FIELD_SEPARATOR           = ' '
          HEADER                          = '00'
          TRUNC_TRAILING_BLANKS           = ' '
          WRITE_LF                        = 'X'
          COL_SELECT                      = ' '
          COL_SELECT_MASK                 = ' '
          DAT_MODE                        = ' '
          CONFIRM_OVERWRITE               = ' '
          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                      = ' '
        IMPORTING
          FILELENGTH                      =
          TABLES
            DATA_TAB                        = it_final.
          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
    Thanks
    Vikranth Khimavath
    Message was edited by: Khimavath Vikranth

  • Does Numbers recognise dropboxes in a existing Excel file, say as pop-ups?

    I need to use an existing Excel file containing drop boxes, save it, and transefer the amended xls file to a PC. Will Numbers handle this? Thanks  

    Unfortunately not. Excel uses data validation while Numbers has a special cell format called a pop up menu. They are not compatible in either direction. They get replaced with whatever value is currently in the cell.

  • How to send existing excel file through mail

    Hello Friends,
    I have to send mail with Excel File attachement. i have already exist Excel file and that file i hv to send through mail. so pl help me out for sending existing excel file .
    i.e. user pickup the exist excel file and that file would be sent to particular mail id.
    thank you,
    Marmik

    Hi marmik,
    1. There is some trick involved
    in the binary files.
    2. I have made a program (and it works fantastic)
    ONLY 6 LINES FOR EMAILING
    BELIEVE ME
    ITS A FANTASTIC PROGRAM.
    IT WILL WORK LIKE OUTLOOK EXPRESS !
    3. The user is provided with
    a) file name
    b) email address to send mail
    and it sends ANY FILE (.xls,.pdf .xyz..)
    Instantaneously !
    4. Make two things first :
    1. Include with the name : ZAMI_INCLFOR_MAIL
    2. Report with the name : ZAM_TEMP147 (any name will do)
    3. Activate both and execute (2)
    4. After providing filename, email adress
    5. Code for Include :
    10.08.2005 Amit M - Created
    Include For Mail (First Req F16)
    Modification Log
    Data
    DATA: docdata LIKE sodocchgi1,
    objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
    objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objhex LIKE solix OCCURS 10 WITH HEADER LINE,
    reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    DATA: tab_lines TYPE i,
    doc_size TYPE i,
    att_type LIKE soodk-objtp.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    FORM
    FORM ml_customize USING objname objdesc.
    Clear Variables
    CLEAR docdata.
    REFRESH objpack.
    CLEAR objpack.
    REFRESH objhead.
    REFRESH objtxt.
    CLEAR objtxt.
    REFRESH objbin.
    CLEAR objbin.
    REFRESH objhex.
    CLEAR objhex.
    REFRESH reclist.
    CLEAR reclist.
    REFRESH listobject.
    CLEAR listobject.
    CLEAR tab_lines.
    CLEAR doc_size.
    CLEAR att_type.
    Set Variables
    docdata-obj_name = objname.
    docdata-obj_descr = objdesc.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addrecp USING preceiver prec_type.
    CLEAR reclist.
    reclist-receiver = preceiver.
    reclist-rec_type = prec_type.
    APPEND reclist.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addtxt USING ptxt.
    CLEAR objtxt.
    objtxt = ptxt.
    APPEND objtxt.
    ENDFORM. "ml_customize
    FORM
    FORM ml_prepare USING bypassmemory whatatt_type whatname.
    IF bypassmemory = ''.
    Fetch List From Memory
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = listobject
    EXCEPTIONS
    OTHERS = 1.
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'LIST_FROM_MEMORY'.
    ENDIF.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    COMPRESSED_SIZE =
    TABLES
    in = listobject
    out = objbin
    EXCEPTIONS
    OTHERS = 1
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ENDIF.
    Header Data
    Already Done Thru FM
    Main Text
    Already Done Thru FM
    Packing Info For Text Data
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'TXT'.
    APPEND objpack.
    Packing Info Attachment
    att_type = whatatt_type..
    DESCRIBE TABLE objbin LINES tab_lines.
    READ TABLE objbin INDEX tab_lines.
    objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = att_type.
    objpack-obj_name = 'ATTACHMENT'.
    objpack-obj_descr = whatname.
    APPEND objpack.
    Receiver List
    Already done thru fm
    ENDFORM. "ml_prepare
    FORM
    FORM ml_dosend.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = docdata
    put_in_outbox = 'X'
    commit_work = 'X' "used from rel. 6.10
    IMPORTING
    SENT_TO_ALL =
    NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    CONTENTS_HEX = objhex
    OBJECT_PARA =
    object_parb =
    receivers = reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8
    IF sy-subrc <> 0.
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH docdata-obj_name.
    ENDIF.
    ENDFORM. "ml_customize
    FORM
    FORM ml_spooltopdf USING whatspoolid.
    DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    Call Function
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = whatspoolid
    TABLES
    pdf = pdf
    EXCEPTIONS
    err_no_otf_spooljob = 1
    OTHERS = 12.
    Convert
    PERFORM doconv TABLES pdf objbin.
    ENDFORM. "ml_spooltopdf
    FORM
    FORM doconv TABLES
    mypdf STRUCTURE tline
    outbin STRUCTURE solisti1.
    Data
    DATA : pos TYPE i.
    DATA : len TYPE i.
    Loop And Put Data
    LOOP AT mypdf.
    pos = 255 - len.
    IF pos > 134. "length of pdf_table
    pos = 134.
    ENDIF.
    outbin+len = mypdf(pos).
    len = len + pos.
    IF len = 255. "length of out (contents_bin)
    APPEND outbin.
    CLEAR: outbin, len.
    IF pos < 134.
    outbin = mypdf+pos.
    len = 134 - pos.
    ENDIF.
    ENDIF.
    ENDLOOP.
    IF len > 0.
    APPEND outbin.
    ENDIF.
    ENDFORM. "doconv
    CODE FOR PROGRAM
    5.
    REPORT zam_temp147 .
    INCLUDE zami_inclfor_mail.
    DATA
    DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : file_name TYPE string.
    data : path like PCFILE-PATH.
    data : extension(5) type c.
    data : name(100) type c.
    SELECTION SCREEN
    PARAMETERS : receiver TYPE somlreci1-receiver lower case.
    PARAMETERS : p_file LIKE rlgrap-filename
    OBLIGATORY.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CLEAR p_file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM ml_customize USING 'Tst' 'Testing'.
    PERFORM ml_addrecp USING receiver 'U'.
    PERFORM upl.
    PERFORM doconv TABLES itab objbin.
    PERFORM ml_prepare USING 'X' extension name.
    PERFORM ml_dosend.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    FORM
    FORM upl.
    file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_name
    filetype = 'BIN'
    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.
    path = file_name.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    CHECK_DOS_FORMAT =
    IMPORTING
    DRIVE =
    EXTENSION = extension
    NAME = name
    NAME_WITH_EXT =
    PATH =
    EXCEPTIONS
    INVALID_DRIVE = 1
    INVALID_EXTENSION = 2
    INVALID_NAME = 3
    INVALID_PATH = 4
    OTHERS = 5
    ENDFORM. "upl
    regards,
    amit m.

  • Open an existing Excel file created by Report Generation Toolkit

    How would I open an existing Excel file that has been created by the LabVIEW Report Generation Toolkit?
    Let me explain my application. I have made a test program to collect data on a device. Each time I run the program I want it to append a new row onto an existing data file. Since the tests I do are sometimes over a period of days, I cannot keep the program open and running continuously. So I have to open an existing file and append the new data to it. In technical terms, what I need is to get the 'report out' reference to the existing Excel data file without losing the data that is already there.

    For info on accessing Excel do a search in the examples for the word "Excel" you will get an example that shows how to open a spreadsheet and manipulate the data. This should get you started.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to Append an existing Excel file?

    I am using the jexcel api to write to a new excel file. Each time i run my program, it creates a new Excel File by the name i give it. my code to create the excelFile is as below:-
    File excelFile=new File(workDir+"\\"+fileName+".xls");
    WritableWorkbook workbook = Workbook.createWorkbook(excelFile);
    After this code i write some data to a worksheet in the above mentioned excel file. But my requirement is that I want to create the excel if it does not exist, and if it exists, then the data should be appended to the worksheet in the existing excel file. At present it creates a new excel file and does not append it.
    How can it be done? does anyone have any suggestions as to how can i tackle this problem? please suggest something.
    Ankit

    There is no ready-to-run example, as you are searching for, available.
    This has several reasons:
    - It depends on the version of Excel. Examples for Excel 2007 might not work with Excel 2010 for instance.
    - No one just wants to open Excel without doing anything with it.
    The second point is something, i want to ask you:
    Why do you want to open an existing Excel file at all? What is it, what you want to do after opening it?
    If you have LV/C/C#/VB examples doing what you are looking for, why do you want to have it in TestStand directly, so NOT using existing code (saving time and effort) and basically re-inventing the wheel?
    ActiveX is an interface for remote controlling and embedding applications with/in other applications on Windows systems. It is a PROGRAMMING interface.
    So naturally, examples and tutorials exist for programming languages. Those examples are easily converted to TestStand sequences with a basic knowledge of the programming language and TestStand. Providing links for such tutorials/examples is a valid way to give support to fellow developers because we expect the fellow to have that basic knowledge. 
    If that knowledge is not present, i highly recommend to fill that gap.
    just my 2 cents,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Downloading report in excel file

    When I download reoprt in excel file then if material no is 0002134 then in the excel file this becomes 2134,
    I am saving file from the Menu System->Save-> Local fiie and then selecting spreadsheet.
    When I save as text file then it is not removing leading zeros, only in excel file it is removing leading zeros.
    I wanted to know that how to download in excel file so that my material no should download as it is .
    Thanks
    APrasad

    Menu System->Save-> Local fiie and then selecting spreadsheet.
    Spreadsheet is not EXCEL. It is a an internal format.
    if you enter xls as extension, then you just tell Microsoft to open this file with excel.
    Excel then automatically coverts it to its own rules.
    When download with Menu System->Save-> Local fiie and then selecting spreadsheet enter the file extension txt
    Then open Excel, use file > open
    find your file and open it, Excel will come up with an import assistant.
    there you can define if the column is to be loaded as numbers or text.

  • Send email with existing excel-file as attachment

    Is there a function to send an e-mail with an attachment which is an existing excel-file on my C:\-drive.
    I found lots of possibilities to send mail with internal tables as attachment but in my case the attachment is an existing excel-file (c:\test.xls)...
    thanx

    Hi,
    FOund these function modules
    Try this out.
    ISR_FI_SEND_EMAIL             
    ISR_FI_SEND_EMAIL_NEW_USER    
    SLS_CUST_SEND_EMAIL_TOOL      
    OR
    report y_cr17_mail.
    data method1 like sy-ucomm.
    data g_user like soudnamei1.
    data g_user_data like soudatai1.
    data g_owner like soud-usrnam.
    data g_receipients like soos1 occurs 0 with header line.
    data g_document like sood4 .
    data g_header like sood2.
    data g_folmam like sofm2.
    data g_objcnt like soli occurs 0 with header line.
    data g_objhead like soli occurs 0 with header line.
    data g_objpara  like selc occurs 0 with header line.
    data g_objparb  like soop1 occurs 0 with header line.
    data g_attachments like sood5 occurs 0 with header line.
    data g_references like soxrl occurs 0 with header line.
    data g_authority like sofa-usracc.
    data g_ref_document like sood4.
    data g_new_parent like soodk.
    data: begin of g_files occurs 10 ,
      text(4096) type c,
       end of g_files.
    data : fold_number(12) type c,
           fold_yr(2) type c,
           fold_type(3) type c.
    parameters ws_file(4096) type c default 'c:\debugger.txt'.
    Can me any file fromyour pc ....either xls or word or ppt etc ...
    g_user-sapname = sy-uname.
    call function 'SO_USER_READ_API1'
    exporting
       user                            = g_user
       PREPARE_FOR_FOLDER_ACCESS       = ' '
    importing
       user_data                       = g_user_data
    EXCEPTIONS
       USER_NOT_EXIST                  = 1
       PARAMETER_ERROR                 = 2
       X_ERROR                         = 3
       OTHERS                          = 4
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    fold_type = g_user_data-outboxfol+0(3).
    fold_yr = g_user_data-outboxfol+3(2).
    fold_number =  g_user_data-outboxfol+5(12).
    clear g_files.
    refresh : g_objcnt,
      g_objhead,
      g_objpara,
      g_objparb,
      g_receipients,
      g_attachments,
      g_references,
      g_files.
    method1 = 'SAVE'.
    g_document-foltp  = fold_type.
    g_document-folyr   = fold_yr.
    g_document-folno   = fold_number.
    g_document-objtp   = g_user_data-object_typ.
    *g_document-OBJYR   = '27'.
    *g_document-OBJNO   = '000000002365'.
    *g_document-OBJNAM = 'MESSAGE'.
    g_document-objdes   = 'sap-img.com testing by program'.
    g_document-folrg   = 'O'.
    *g_document-okcode   = 'CHNG'.
    g_document-objlen = '0'.
    g_document-file_ext = 'TXT'.
    g_header-objdes =  'sap-img.com testing by program'.
    g_header-file_ext = 'TXT'.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
      exporting
        method             = method1
       office_user        = sy-uname
       ref_document       = g_ref_document
       new_parent         =  g_new_parent
    importing
       authority          =  g_authority
    tables
       objcont            = g_objcnt
       objhead            = g_objhead
       objpara            = g_objpara
       objparb            = g_objparb
       recipients         = g_receipients
       attachments        = g_attachments
       references         = g_references
       files              = g_files
      changing
        document           = g_document
       header_data        = g_header
      FOLMEM_DATA        =
      RECEIVE_DATA       =
    File from the pc to send...
    method1 = 'ATTCREATEFROMPC'.
    g_files-text = ws_file.
    append g_files.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
      exporting
        method             = method1
       office_user        = g_owner
       ref_document       = g_ref_document
       new_parent         =  g_new_parent
    importing
       authority          =  g_authority
    tables
       objcont            = g_objcnt
       objhead            = g_objhead
       objpara            = g_objpara
       objparb            = g_objparb
       recipients         = g_receipients
       attachments        = g_attachments
       references         = g_references
       files              = g_files
      changing
        document           = g_document
       header_data        = g_header
    method1 = 'SEND'.
    g_receipients-recnam = 'MK085'.
    g_receipients-recesc = 'B'.
    g_receipients-sndex = 'X'.
    append  g_receipients.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
      exporting
        method             = method1
       office_user        = g_owner
       ref_document       = g_ref_document
       new_parent         =  g_new_parent
    importing
       authority          =  g_authority
    tables
       objcont            = g_objcnt
       objhead            = g_objhead
       objpara            = g_objpara
       objparb            = g_objparb
       recipients         = g_receipients
       attachments        = g_attachments
       references         = g_references
       files              = g_files
      changing
        document           = g_document
       header_data        = g_header.
    *-- End of Program
    Thanks & Regards,
    Judith.

  • I export an ACCESS table to an existing Excel file. Seemed like it was working fine, but now I see that it DOES NOT clear the file first.

    Thus - if I transferred 10 records last time, and there are only 6 to transfer this time, it replaces records 1 thru 6 in Excel, but LEAVES records 7-10 in the Excel file ?? 

    When you export the access Table to an existing excel file ,you should get the message like the screenshot below:
    If you click 'Yes' ,a new workbook will created ,the problem you mentioned doesn't exist.
    Maybe you can try to export data within Excel. On the Data Tab->Click
    From Access->choose the database file, then when you update your database in Access, these data will updated automatically.
    Wind Zhang
    TechNet Community Support

  • How to export diadem channels to an existing excel file with a certain configuration

    Hello,
    I would like to export some channels from the Data Portal of Diadem  to an existing excel file. The excel file consists of many spreadsheets and each channel  should match one spreadsheet.
    I´ve tried to use EXCELExport() function but it doesn´t work.(this function is designed for something else, it generates a new excel file). I´ve tried to access to each spreadsheet and copy the information throughout a for statement but this solution needs a lot of time. If somebody has any idea, please help.   
    Solved!
    Go to Solution.

    Hi Ovidius,
    You have two options that I can think of.  You can export the data from the Data Portal to a temporary file, probably a CSV file, then load the data from file into the Excel template, OR you could stick with the Excel ActiveX approach but change to assigning a range of cells instead of individual cell values one at a time.
    There is an Excel File Export option in DIAdem, but it always creates a new Excel file, it can not be used to export to an existing Excel file.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

Maybe you are looking for

  • How do I create a certificate to remove signature field issues?

    I would like to start using digital signatures for some internal documents. We are a small site with about 20 PC users (3 of them Apple). We can create PDFs with signature fields but every time we sign the document, when somebody needs to sign again

  • Creating a new folder containing links to files or applications

    I am creating a portable workstation for a group of people using a Macbook. To make their job easier to find relevant tutorials, I wanted to give them a way to access the tutorials grouped in different ways. I was planning on adding a number of folde

  • Problem while activating message mapping

    Hi all,    I am facing a problem while activating message mapping in IR.It says Object being edited by XXXX and cannot be activated.It's giving my user name itself and even it doesn't allow to go to edit mode even.But I am not opening  it twice.How t

  • Tomcat 4.0 and Oracle 10g takes 100% CPU and grinds to a halt

    Hi, I have a system to support that is currently running on Tomcat 4.0 on a Windows Server 2003 R2 SP2 machine with 3.06Ghz, 4Gb Memory, 2Gb Page file connecting to an Oracle 8.1.6 database on a Windows NT 4 virtual server with 3.2Ghz, 1152Mb Memory,

  • Subcontract order  component delivery Error

    Hi.. I have created a Subcontract PO for disposing a material .Vendor will cahrge me for disposal services provided. i will provide material to b disposed as compnents with subcontract PO. i have 2 subcontarct POs for 2 different POs. For 1 PO , vend