Excel remains in memory after using by DOI.

Hi.
I'm trying to use DOI but
Excel instance remains in memory after I have run macro and leave program. If I don't run any macro - everything is Ok.
I run macro by this way:
    CALL METHOD document->execute_macro
      EXPORTING
        macro_string = 'MyMacro'
        param_count  = 0
      IMPORTING
        error      = error.
Before leaving the program I release DOI objects as in demo
    IF NOT documentproxy IS INITIAL.
      CALL METHOD documentproxy->close_document.
      CALL METHOD c_oi_errors=>show_message
        EXPORTING
          type = 'E'.
      FREE documentproxy.
    ENDIF.
    IF NOT olecontrol IS INITIAL.
      CALL METHOD olecontrol->destroy_control.
      FREE olecontrol.
    ENDIF.
Thanks for your help.
Mike Menkov.

Hello, long time no see,
but anyway, executing a macro prevents excel then to be closed over ole, as i've tried many ways to get it done, here is a work-around.
it's frustating that I cannot use excel as Inplace there, because users could then easily USE or even UPLOAD their own excel-spreadsheets over the custom control with the use of ALV-Grid firstly, wich is really nice. Because of this 'bug', (i think it definitely is one, but don't know on wich side, MS or SAP) excel-spreadsheet functionality over ALV-Grid imho simply cannot be used fine with spreadsheets containing 'bigger' macros which where executed over ole - in eo_start_macro.
For closing this issue, I just wanted to add how I could 'overcome' the sympthoms of this still remaining temp-files (+excel holding them open) when using excel + ole automation over SAPGUI:
You could just NOT use excel "Inplace" on a custom control of a dynpro, but outside SAP, still OLE-driven.
Start it in foreground guarantees you can close the temp-file with or without saving at a time and not surprisingly at the end on shutdown, because the controls of excel (and excel as a whole) are visible anytime - ole automation works also fine this way.
This is the order of preparing excel and setting data into it i've done it, therefore i've created a single include for all the excel-ole stuff:
(complete source could be looked up at http://pastebin.com/zmr6xdZm)
1.eo_get_templ_uri
2.eo_build_spreadsheet_interface - goes ahead with parameter inplace_enabled = SPACE
3.eo_build_named_area
4.eo_set_data_into_sheet
5.eo_start_macro
after the data is sent to excel (+ the macro on the spreadsheet has done it's job), excel is holding the filled temp file (spreadsheet) in foreground, so users can directly close it with- or without saving.
*** using inplace_enabled = SPACE here, on Initializing the control
CALL METHOD cl_control->init_control
   EXPORTING
     inplace_enabled          = ' '
     no_flush                 = 'X'
     INPLACE_SHOW_TOOLBARS    = insert_toolbar
     r3_application_name      = sy-cprog
     parent                   = cl_container
   IMPORTING
     error                    = error
   EXCEPTIONS
*          javabeannotsupported     = 1  " ex. nicht im Minisap
     OTHERS                   = 2.
*** and on Load document from BOR
     CALL METHOD cl_document->open_document
     EXPORTING
       "startup_macro    = 'DieseArbeitsmappe.start' "funkt nicht
       document_title = sy-cprog
       document_url   = doc_url
       no_flush       = 'X'
       open_inplace   = '  '
     IMPORTING
       retcode          = soiret
       error          = error.
     APPEND error TO t_errors.
   ENDIF.
Cheers,
David

Similar Messages

  • Free memory after using GetRS232ErrorString() to avoid memory leak?

    Hello,
    Is it necessary to free memory after using function GetRS232ErrorString() to avoid memory leak?
    Example 1:
    int main();
    char *strError=NULL;
    strError = GetRS232ErrorString(55); /* just an example for error message */
    free(strError ); /* Do I need to free this pointer? */
    Example 2:
    int main();
    MessagePopup ("Error", GetRS232ErrorString(55)); ; /* Will I get a memory leak with this function call? */
    BR
    Frank

    It's a pity that the documentation is indeed so poor in this case, but testing shows that it always returns the same pointer, no matter the error code, so it seems to be using an internal buffer and you are not supposed to free the string (but need to copy it before the next call to GetRS232ErrorString if you need to keep the text). It does however return a different pointer for every thread, so atl least it seems to be thread safe.
    Cheers, Marcel 

  • Available Memory after using app killer

    What shaould my available memory be after using the app killer on the X?  I have seen it as low as 88m and spike all the way up to 228m?

    Depending on the one you are using, Advance Task Killer has a option under the settings menu...

  • After closing firefox, firefox still remains in memory with use of huge amount of memory

    Hello,
    I'm now using 10.0.1 but the behavior started around version 7.x i believe and it's becoming bigger witch every update?.
    My configuration.
    P4, 2.6 Ghz 512 MB memory, 120GB harddrive, Windows XP sp3 with all the updates.
    While using firefox to explore the internet and using Scrapbook to save the pages that i want (Familytree search of our name in the past, present and..) firefox becomes terrible slow, hugh need of resources of swap memory up to 1,2 GB, i want to close firefox. After a 10 to 20 seconds firefox disappears from the screen but when i open (ctrl-alt-del) windows Taskmanager the process is still going on and often even needs more memory for several minutes (> 5) and i have to kill the process to go on. If i restart firefox after that it's treapears like the normal firefox but after a while the same thing happens again.
    Sorry for the (perhaps) mistakes in my writing but englisch is not my native language.
    Theo Smallenbroek

    Some activities may use quite a bit of memory, and if memory is low on the sytem Firefox is forced to page and slow down. Does the problem occur only when you do certain tasks or use a particular site. Does it only occur while you use "Scrapbook" - whatever that is, and have you tried using Firefox in its [[safe mode]]
    There is a posibility that the problem is malware related.
    * see [[is my firefox problem a result of malware]]

  • Executable VI remains in memory after closing the program

    Using LabVIEW 8.5.1
    I've had two problems like this now.  One in a vista machine and the other in a windows 2000 machine.  The program is the same with minor changes between the machines.  At first I thought the problem was in the installer and I had to change the target OS to Vista only, but now I'm not sure that is the issue as it is happening in a win2K machine as well.
    The program runs fine but when we stop the execution and then close the program by hitting the X on the upper right corner of the window it closes the window but the instance remains loaded in memory and I have to go to the task manager to end the task. 
    Any leads on the fixt to this would be helpful.
    Thanks,

    I will check for code left running as this may be the most likely cause.
    As to what Pnt wrote:
    "Although i don't agree with your programming style. The program should not be terminated at that point. It should pass to an idle state, waiting either for a button "Run" to be pressed, or the "X"."
    I am giving you a glimpse of what the code does.  I'm not saying that I'm an expert programer as it is not my full time responsibility.  However, I am asking for help on figuring out what is going on with my code and I understand that it will be hard to pin point the problem without posting the entire program for members to disect.  Having said that, it would also be difficult to get but a glimpse on my programming style without me posting what I would consider a finished program.  For example, (here is another glimpse at my style) the program does go into an idle state waiting for the user to run another recipe or to terminate the program.  If the user decides to run a recipe but needs to abort the recipe, there is an option to do that and the program goes back to idle.  Further more the program can only be stopped while it is idle, a recipe has to be aborted prior to stopping the program (this is required to avoid leaving the furnace in an unsafe state) unless the user forces the program to quit by way of the "end task" which thanks to the note posted in a previous reply I know how to hadle now...  
    Sorry for the deviation from the actual topic, I could go on and on about what the program is supposed to do and how I'm meeting the end user requirements but I don't see the value of that at the momment.

  • Report Generation for Excel does not work after using the Application Builder

    I have a VI that writes data to an Excel file using the Report Generation Toolkit. I recently compiled the VI into a single Application (EXE) using the Application Builder. My VI runs its tests properly, but no data is written to Excel. What could be the cause? I don't receive any error messages.

    Hi
    I usually build exe-files, which sometimes also have report functionality.
    Open the Application Builder and check the following things:
    1. Add the following vis: _Word Dynamic VIs.vi, _Excel Dynamic VIs.vi They should be located in the directory ..\LabVIEW X.X\vi.lib\addons\_office in the llbs _wordsub.llb and _exclsub.llb (report1.jpg)
    2. If you use an Installer, go to the Advanced Settings. There you can select some things to include in the Installer. Check if "NI Reports Support" is selected. (report2.jpg)
    These are the things I always do, if I need reports and I never had problems up to now. I made two screen-shots of these settings.
    Hope this helps.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...
    Attachments:
    report.zip ‏25 KB

  • Memory Leak, Deallocati​ng memory after using imaqImageT​oArray() function

    I have created a program (LW/CVI- Imaq Vision), which uses a timer callback to acquire an image, convert the image to an array using the imaqImageToArray() function, manipulates the data in the array, converts the data to an image, displays the image, and disposes of the image(imaqDispose()), and apparently the imaqImageToArray() function clears the allocation pointer, however does not deallocate the memory, such that the next time the function is called again, imaq allocates new memory, thus eventually the application slows down and freezes due to lack of memory. Does anyone have any suggestions?

    Hello,
    You need to call the imaqDispose() for the assigned pointer to actually clear the allocated memory.
    iPointer = imaqImageToArray(imgInputImage,IMAQ_NO_RECT, &iCols, &iRows);
    imaqDispose (iPointer);
    Let me know if you have further questions regarding this.
    Best regards,
    Yusuf C.
    Applications Engineering
    National Instruments

  • Red icon remain in FEBAN after using transaction F-03

    Hello,
    From our accounting department I get the following issue, I don't know how to solve this:
    In FEBAN there are some red icons after loading the Electronic Bank Statement (EBS).
    Normally, those issues are solved from FEBAN, but now three issues are solved by transaction F-03 (Clear G/L account).
    These issues now still got a red icon in FEBAN, assuming there is an action required. But the clearing is done.
    How can I solve this, so the red icons will become green?

    E Steures,
    Go to SE16, table FEBKO. Enter AZNUM - Statement number and run. You get this number from FEBAN at the beginning digits of the statement folder. 
    Get KUKEY - Short key and go to SE38, report RFEBKA90 and enter like first field ID and make Change status = '8'.
    When you run FEBAN statement will be green.
    Regards

  • Remove apps from memory after use

    on iphone 4 I could tap home button twice, touch line of active apps and remove from active memory
    how do equivalent with iphone 5

    The same way.
    For iOS 7: Double tap the Home Button and swipe up on thwe app preview page

  • Text box tool remains "on" after use

    Adobe Reader 11.0.09 on Mac OSX 10.6.8 (antique)
    QUESTION: How to resolve failure of text-box tool to inactivate after use.  Instead, creates numerous undesired text boxes.
    I am using Adobe Reader 11.0.09 on a Mac with OS 10.6.8 (ancient).  Under the Comment tab, the second set of tools has eleven "Drawing Markups." Typically, when a user has completed the use of one of the markup tools, the tool is no longer highlighted.  In the recent past, the "Text Box" tool remains highlighted after creating a text box with keyed in text.  The next click anywhere on the document creates ANOTHER undesired text box.  Sometimes, when clicking within an existing text box to supplement/edit the text, two or more NEW text boxes are created within the original (i.e., because of a click at the location of desired text editing). Simply as a test, I examined the behavior of each of the eleven markup tools, and found that all but the pencil tool "inactivate" (un-highlight) after the drawing (e.g. a circle/oval or square/rectangle or arrow) is complete.  QUESTION:  Has anyone else observed that one or more "Drawing Markup" icons remain in the "active" status AFTER the mark-up drawing has been completed? If YES, did you find a fix for the annoying problem?

    https://discussions.apple.com/message/25495158#25495158

  • Do all the settings (bookmarks, browsing history etc...) remain on the computer used with "Sync" after signing off?

    Do all the settings (bookmarks, browsing history etc...) remain on the computer used with "Sync" after signing off from your "Sync" account?
    == This happened ==
    Not sure how often

    How is that related to the Firefox Sync extension and service?
    What type of file is that?
    Where are you getting that file from?

  • Problem is releasing excel application from memory using webutil

    Hi Experts,
    This code is working fine but it is not releasing the excel from the memory. if i try the same set of code with Wort.Applicationa or Access.Application it works fine. But only with excel it is not working.
    Is there is any way to kill the excel application?
    application := CLIENT_OLE2.create_obj('Excel.Application');
    CLIENT_OLE2.invoke(application,'Quit');
    CLIENT_OLE2.release_obj(application);
    Thanks & Regards
    Rajesh

    This is probably <Bug:3082119 which is fixed in the production release.
    Regards
    Grant Ronald
    Forms Product Management

  • Microsoft Excel keeps freezing on back after using backspace key

    Don't know if this can be answered here, but I keep trying to use the backspace key in Excel and I keep getting a beachball, where only Excel freezes but I can use the rest of my computer.  Any help?
    I am running Snow Leopard 10.6.8, no office updates needed.  Office 2004.  Never had issues with this until recently.
    Thanks in advance.

    I suggest you try MS's own forums for their Mac products, as it's their software you're having issues with
    http://answers.microsoft.com/en-us/mac

  • Strange memory behaviour using the System.Collections.Hashtable in object reference

    Dear all,
    Recently I came across a strange memory behaviour when comparing the system.collections.hashtable versus de scripting.dictionary object and thought to analyse it a bit in depth. First I thought I incorrectly destroyed references to the class and
    child classes but even when properly destroying them (and even implemented a "SafeObject" with deallocate method) I kept seeing strange memory behaviour.
    Hope this will help others when facing strange memory usage BUT I dont have a solution to the problem (yet) suggestions are welcome.
    Setting:
    I have a parent class that stores data in child classes through the use of a dictionary object. I want to store many differenct items in memory and fetching or alteging them must be as efficient as possible using the dictionary ability of retrieving key
    / value pairs. When the child class (which I store in the dictionary as value) contains another dictionary object memory handeling is as expected where all used memory is release upon the objects leaving scope (or destroyed via code). When I use a system.collection.hashtable
    no memory is released at all though apears to have some internal flag that marks it as useable for another system.collection.hashtable object.
    I created a small test snippet of code to test this behaviour with (running excel from the Office Plus 2010 version) The snippet contains a module to instantiate the parent class and child classes that will contain the data. One sub will test the Hash functionality
    and the other sub will test the dictionary functionality.
    Module1
    Option Explicit
    Sub testHash()
    Dim Parent As parent_class
    Dim d_Count As Double
    'Instantiate parent class
    Set Parent = New parent_class
    'Create a child using the hash collection object
    Parent.AddChildHash "TEST_hash"
    Dim d_CycleCount As Double
    d_CycleCount = 50000
    'Add dummy data records to the child container with x amount of data For d_Count = 0 To d_CycleCount
    Parent.ChildContainer("TEST_hash").InsertDataToHash CStr(d_Count), "dummy data"
    Next
    'Killing the parent when it goes out of scope should kill the childs. (Try it out and watch for the termination debug messages)
    'According to documentation and debug messages not really required!
    Set Parent.ChildContainer("TEST_hash") = Nothing
    'According to documentation not really as we are leaving scope but just to be consistent.. kill the parent!
    Set Parent = Nothing
    End Sub
    Sub testDict()
    Dim Parent As parent_class
    Dim d_Count As Double
    'Instantiate parent class
    Set Parent = New parent_class
    'Create a child using the dictionary object
    Parent.AddChildDict "TEST_dict"
    Dim d_CycleCount As Double
    d_CycleCount = 50000
    'Blow up the memory with x amount of records
    Dim s_SheetCycleCount As String
    s_SheetCycleCount = ThisWorkbook.Worksheets("ButtonSheet").Range("K2").Value
    If IsNumeric(s_SheetCycleCount) Then d_CycleCount = CDbl(s_SheetCycleCount)
    'Add dummy data records to the child container
    For d_Count = 0 To d_CycleCount
    Parent.ChildContainer("TEST_dict").InsertDataToDict CStr(d_Count), "dummy data"
    Next
    'Killing the parent when it goes out of scope should kill the childs. (Try it out and watch for the termination debug messages)
    'According to documentation and debug messages not really required!
    Set Parent.ChildContainer("TEST_dict") = Nothing
    'According to documentation not really as we are leaving scope but just to be consistent.. kill the parent!
    Set Parent = Nothing
    End Sub
    parent_class:
    Option Explicit
    Public ChildContainer As Object
    Private Counter As Double
    Private Sub Class_Initialize()
    Debug.Print "Parent initialized"
    Set ChildContainer = CreateObject("Scripting.dictionary")
    End Sub
    Public Sub AddChildHash(ByRef ChildKey As String)
    If Not ChildContainer.Exists(ChildKey) Then
    Dim TmpChild As child_class_hashtable
    Set TmpChild = New child_class_hashtable
    ChildContainer.Add ChildKey, TmpChild
    Counter = Counter + 1
    Set TmpChild = Nothing
    End If
    End Sub
    Public Sub AddChildDict(ByRef ChildKey As String)
    If Not ChildContainer.Exists(ChildKey) Then
    Dim TmpChild As child_class_dict
    Set TmpChild = New child_class_dict
    ChildContainer.Add ChildKey, TmpChild
    Counter = Counter + 1
    Set TmpChild = Nothing
    End If
    End Sub
    Private Sub Class_Terminate()
    Debug.Print "Parent being killed, first kill all childs (if there are any left!) - muahaha"
    Set ChildContainer = Nothing
    Debug.Print "Parent killed"
    End Sub
    child_class_dict
    Option Explicit
    Public MemmoryLeakObject As Object
    Private Sub Class_Initialize()
    Debug.Print "Child using Scripting.Dictionary initialized"
    Set MemmoryLeakObject = CreateObject("Scripting.Dictionary")
    End Sub
    Public Sub InsertDataToDict(ByRef KeyValue As String, ByRef DataValue As String)
    If Not MemmoryLeakObject.Exists(KeyValue) Then MemmoryLeakObject.Add KeyValue, DataValue
    End Sub
    Private Sub Class_Terminate()
    Debug.Print "Child using Scripting.Dictionary terminated"
    Set MemmoryLeakObject = Nothing
    End Sub
    child_class_hash:
    Option Explicit
    Public MemmoryLeakObject As Object
    Private Sub Class_Initialize()
    Debug.Print "Child using System.Collections.Hashtable initialized"
    Set MemmoryLeakObject = CreateObject("System.Collections.Hashtable")
    End Sub
    Public Sub InsertDataToHash(ByRef KeyValue As String, ByRef DataValue As String)
    If Not MemmoryLeakObject.ContainsKey(KeyValue) Then MemmoryLeakObject.Add KeyValue, DataValue
    End Sub
    Private Sub Class_Terminate()
    Debug.Print "Child using System.Collections.Hashtable terminated"
    Set MemmoryLeakObject = Nothing
    End Sub
    Statistics:
    TEST: (Chronologically ordered)
    1.1 Excel starting memory: 25.324 kb approximately
    Max memory usage after hash (500.000 records) 84.352 kb approximately
    Memory released: 0 %
    1.2 max memory usages after 2nd consequtive hash usage 81.616 kb approximately
    "observation:
    - memory is released then reused
    - less max memory consumed"
    1.3 max memory usages after 3rd consequtive hash usage 80.000 kb approximately
    "observation:
    - memory is released then reused
    - less max memory consumed"
    1.4 Running the dictionary procedure after any of the hash runs will start from the already allocated memory
    In this case from 80000 kb to 147000 kb
    Close excel, free up memory and restart excel
    2.1 Excel starting memory: 25.324 kb approximately
    Max memory usage after dict (500.000 records) 90.000 kb approximately
    Memory released: 91,9%
    2.2 Excel starting memory 2nd consequtive dict run: 27.552 kb approximately
    Max memory usage after dict (500.000 records) 90.000 kb approximately
    Memory released: 99,4%
    2.3 Excel starting memory 3rd consequtive dict run: 27.712 kb approximately
    Max memory usage after dict (500.000 records) 90.000 kb approximately
    Memory released:

    Hi Cor,
    Thank you for going through my post and took the time to reply :) Most apreciated. The issue I am facing is that the memory is not reallocated when using mixed object types and is not behaving the same. I not understand that .net versus the older methods
    use memory allocation differently and perhaps using the .net dictionary object (in stead of the scripting.dictionary) may lead to similar behaviour. {Curious to find that out -> put to the to do list of interesting thingies to explore}
    I agree that allocated memory is not a bad thing as the blocks are already assigned to the program and therefore should be reallocated with more performance. However the dictionary object versus hashtable perform almost identical (and sometimes even favor
    the dictionary object)
    The hashtable is clearly the winner when dealing with small sets of data.
    The issue arises when I am using the hash table in conjunction with another type, for example a dictionary, I see that the dictionary object's memory is stacked on top of the claimed memory space of the hashtable. It appears that .net memory allocation and
    reuse is for .net references only. :) (Or so it seems)
    In another example I got with the similar setup, I see that the total used memory is never released or reclaimed and leakage of around 20% allocated memory remains to eventually crash the system with the out of memory message. (This is when another class
    calls the parent class that instantiates the child class but thats not the point of the question at hand)
    This leakage drove me to investigate and create the example of this post in the first place. For the solution with the class -> parent class -> child class memory leak I switched all to dictionaries and no leakage occurs anymore but nevertheless thought
    it may be good to share / ask if anyone else knows more :D (Never to old to learn something new)

  • How can i restore memory after deleting all photos on my iPad 8.1.2

    iPad 4
    8.1.2
    Photos; not iPhoto app
    Under GENERAL I cannot restore my capacity memory after deleting all my photos from the iPad.
    I do not store photos in the Cloud. I do not use Photo Stream
    I have reset my iPad as well as checked in Image Capture for possible photos still there.
    I have also deleted last 30 days of photos.

    In iOS 8.1.2 photos that are deleted from the Camera Roll are moved to the Recently Deleted album. They remain there for 30 days unless you delete them again from that album. The Recently Deleted album was created because so many people complained that they deleted photos and wanted them back. The Recently Deleted album gives people 30 days to change their mind about deleting photos. For the rest of us, it's kind of a pan to have to delete the photos twice to free up the storage space.
    Oh, and there is no longer an iPhoto that works on iOS devices running iOS 8.1.2.

Maybe you are looking for

  • One Microsoft Server 2003 R2 (small business server) doesn't connect to Context Directory Agent

    I have 2 DC's and I'm trying to get the cda to connect to both dc's.  Both are 2003 R2 but the one I'm having trouble with is Small Business Server.  I've double checked security settings and firewalls, but I'm still receiving the error on one server

  • Library Management

    Does anyone know of a good ebook reader/organizer? I've been looking for one for a while, and none really seem to stand out. Suggestions?

  • Need to disable previous entries in an INPUT field(on pressing spacebar)

    Dear Gurus, On clicking the space-bar of an input field (of a module pool screen), the system will picks the previous entries of the field. Like say for the input field against 'belnr', and I provided 5000001 for the first time and 50000002 for the 2

  • Auto Query Form on Page

    Hi, I'd like to have a form on a page and when the user navigates to that page I'd like the form to pick up a session variable and put it in a field on the form and run a query. So effectively auto querying a form. I've seen it done before but cant s

  • Sorry, having real trouble with this...

    import java.lang.*; public class Alphabet_frequency {      public static void main(String[] args) { int length_of_string;           length_of_string = length("java");           System.out.println(length_of_string); and javac tells me it can't find th