Creating objects in a loop

Hi
I have read that creating objects in a loop degrades performance. Can someone explain why this should be so?

Hi
I have read that creating objects in a loop degrades
performance. Can someone explain why this should be
so?Every object creation takes time, so if you create
lot of unnecessary temporary items in loop it degrades
performance (so it is nothing loop specific).

Similar Messages

  • Creating objects in a second instance

    I have created a second instance through the console of a directory server, which has been configured with the same rootdn as the original.
    When I open up the console why in the new instance does it show the rootdn on the config tab but the original doesnt ......
    also ....
    why when i go into the second instance i try creating data objects for root suffixes ive created to mirror the original instance, does it create them under cn=config ......
    Thanks
    G

    Hi
    I have read that creating objects in a loop degrades
    performance. Can someone explain why this should be
    so?Every object creation takes time, so if you create
    lot of unnecessary temporary items in loop it degrades
    performance (so it is nothing loop specific).

  • How can I importing when create object?

    Hi Gurus,
    I’m beginner with OO Abap. Please give me a hand with this.
    I’m using the programming interface REPORT  Z_TEST_ST_TEXT_EDITOR for text editor found on /people/igor.barbaric/blog/2005/06/06/the-standard-text-editor-oo-abap-cfw-class which is good and useful for me (highly recommended) but I need to import the text created (t_text)  in method constructor in order to send it via e.mail.
    Could anybody tell me how to get/import the text created?
    Thank you in advance.
    Below is the coding. (program which uses the developed class and method consisting the created text)
    DATA: o_txe     TYPE REF TO <b>zcl_standard_text_editor</b>,
          v_caption TYPE char100,
          s_thead   TYPE thead.
    call screen
    CALL SCREEN 0100.
    MODULE s0100_start
    MODULE s0100_start OUTPUT.
        SET PF-STATUS 'BASIC'.
        s_thead-tdname   = 'VENDOR0000000011'.
        s_thead-tdid     = 'ST'.
        s_thead-tdobject = 'TEXT'.
        s_thead-tdspras  = sy-langu.
        CONCATENATE 'Standard text:' s_thead-tdname
                    INTO v_caption SEPARATED BY space.
        IF o_txe IS INITIAL.
    <b>       CREATE OBJECT o_txe</b>         
    EXPORTING i_thead   = s_thead
                       i_caption = v_caption. 
    <b>IMPORTING????</b>
         ENDIF.
    ENDMODULE.
    <b>method CONSTRUCTOR</b>.
    DATA: o_dialogbox TYPE REF TO cl_gui_dialogbox_container,
          t_text      TYPE STANDARD TABLE OF tdline,
          s_event     TYPE cntl_simple_event,
          t_events    TYPE cntl_simple_events,
          t_lines     TYPE STANDARD TABLE OF tline,
          v_text      TYPE tdline,
          v_text_temp TYPE tdline,
          v_line_temp TYPE tdline,
          v_line_len  TYPE i,
          v_index     TYPE i.
    FIELD-SYMBOLS: <line> TYPE tline.
    me->thead   = i_thead.
    me->caption = i_caption.
    *------ containers
    IF i_container IS INITIAL.
        CREATE OBJECT o_dialogbox
                EXPORTING top     = 50
                          left    = 200
                          height  = 150
                          width   = 500
                          caption = i_caption.
        me->main_container = o_dialogbox.
        SET HANDLER me->on_container_close FOR o_dialogbox.
    ELSE.
        me->main_container = i_container.
    ENDIF.
    IF me->splitter IS INITIAL.
        CREATE OBJECT me->splitter
                EXPORTING
                     parent        = me->main_container
                     orientation   = me->splitter->orientation_vertical
                     sash_position = 10. "percentage of containers
       ------ toolbar
        CREATE OBJECT me->toolbar
              EXPORTING parent = me->splitter->top_left_container.
        CALL METHOD me->toolbar->add_button
             EXPORTING  fcode       = me->c_save
                        is_disabled = ' '
                        icon        = '@2L@' "icon_system_save
                        butn_type   = cntb_btype_button.
        CALL METHOD me->toolbar->add_button
             EXPORTING  fcode       = me->c_close
                        is_disabled = ' '
                        icon        = '@3X@' "icon_close
                        butn_type   = cntb_btype_button.
    *------ register events
        REFRESH t_events.
        s_event-eventid = cl_gui_toolbar=>m_id_function_selected.
        s_event-appl_event = ' '.
        APPEND s_event TO t_events.
        CALL METHOD me->toolbar->set_registered_events
              EXPORTING events = t_events.
        SET HANDLER: me->on_toolbar_func_sel FOR me->toolbar.
    *------ create textedit control
        CREATE OBJECT me->textedit
           EXPORTING parent = me->splitter->bottom_right_container.
    ENDIF.
    get text
    CALL FUNCTION 'READ_TEXT'
            EXPORTING ID       = me->thead-tdid
                      LANGUAGE = me->thead-tdspras
                      NAME     = me->thead-tdname
                      OBJECT   = me->thead-tdobject
            TABLES    LINES    = t_lines
            EXCEPTIONS ID                      = 1
                       LANGUAGE                = 2
                       NAME                    = 3
                       NOT_FOUND               = 4
                       OBJECT                  = 5
                       REFERENCE_CHECK         = 6
                       WRONG_ACCESS_TO_ARCHIVE = 7
                       OTHERS                  = 8.
    *------- convert text to text editor format
    LOOP AT t_lines ASSIGNING <line>.
        IF <line>-tdformat = space OR <line>-tdformat = '=' OR sy-tabix = 1.
            v_line_temp = <line>-tdline.
            CONCATENATE v_text v_line_temp INTO v_text_temp.
        ELSE.
            CONCATENATE: cl_abap_char_utilities=>cr_lf <line>-tdline
                         INTO v_line_temp.
            CONCATENATE  v_text v_line_temp   INTO v_text_temp.
        ENDIF.
        IF sy-subrc = 0.
            v_text = v_text_temp.
        ELSE.
            APPEND v_text TO t_text.
            v_text = v_line_temp.
        ENDIF.
    ENDLOOP.
    IF sy-subrc = 0.
        APPEND v_text TO <b>t_text</b>.
    ENDIF.
    *------- display text
    CALL METHOD me->textedit->set_text_as_stream
             EXPORTING text = t_text.
    me->t_initial_text = t_text.
    endmethod.

    good book on ABAP objects(OOPS)
    http://www.esnips.com/doc/bc475662-82d6-4412-9083-28a7e7f1ce09/Abap-Objects---An-Introduction-To-Programming-Sap-Applications
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    Rewards if useful......................
    Minal

  • ABAP OO:  Duplication of selected data in created objects?

    I am new to ABAP OO and I have a conceptual question/concern that I cannot resolve.  Can someone explain what I am missing?
    I would think that selecting and storing (in internal tables) a large amount of data from many related database tables and, at the same time, creating and storing objects from this same data would unnecessarily consume a huge amount of memory.  To avoid this problem, it seems that the selected data and created objects should not be stored in internal tables simultaneously.
    Does this concern make sense?  If so, how is this problem best handled?
    Does it make sense to delete the corresponding data once the objects are created (to free memory)?
    Or does it make sense to keep the data and only temporarily create objects as needed?
    Thanks.

    Hello Matt
    The approach you describe is to select data first and the feed the object instances with them. <b>Why not let the object instances do the data selection themselves?</b>
    I will give you an example what I mean.
    (1) Lets assume I want to write an application that allows to deal with cost center hierarchies. On the selection screen you can choose one or many cost center hierarchies.
    (2) Using the selection criteria I would select all cost center hierarchies but without any details (just the key values).
    (3) Next I would loop over the cost center hierarchies and create a cost center hierarchy instance (a class you have to define yourself) for each key value. The CONSTRUCTOR of this class will have an IMPORTING parameter like <i>id_kostl_hier</i>.
    (4) In the CONSTRUCTOR method I first check if the cost center hierarchy exists (if not raise an exception-class based exception) and then do the selection of the hierarchy details (e.g. the cost centers).
    (5) The instances are collected in an itab of the "frame" application.
    Using this approach you will have little duplication of data within your application. Furthermore, if you really have to deal with huge amounts of data then you could read them only on demand (like in tree controls where the sub-nodes usually are read when the parent node is expanded).
    Hope I could give you some fresh insights into this exciting topic.
    Regards
      Uwe

  • ABAP OBJECTS: Dynamic Create object

    Hi folks!
    I have a problem... I need to create a dynamic type object with:
    <b>DATA: my_instance TYPE REF TO class1.
    CREATE OBJECT my_instance TYPE (class2).</b>
    <i>* where class1 is a superclass of class2.</i>
    When I do:
    <b>my_instance ?= m_parent.</b>
    <i>* where m_parent is an instance of class1</i>
    My problem is when I want to access to an attribute of the class2, the compiler says that it cannot find the attribute <i>(this is OK, because the attribute is only in the class2).</i>
    My question:
    Is there anyway to access to an atribute of second class when is not in the first class? (i don't want to create the attribute as an attribute of the first class).
    Thanx!!!!

    Hi David,
    When you do the debugging, you are dealing with run-time - i.e., the program is now running and you are just interrupting it at each statement to examine the program state. You will reach the point where the object is already created. That is why you can see all those attributes. But when you comiple, the program is not yet <i>running</i>, so the attributes will be unknown because of the dynamic type specification.
    I think you will have to redesign the program logic. As i had already said in my earlier post, it is not proper to have the attributes specified statically while the class itself is specified dynamically.
    Your situation is somewhat similar to -
    DATA ITAB TYPE TABLE OF SPFLI.
    PERFORM TEST TABLES ITAB.
    FORM TEST TABLES ITAB.
      LOOP AT ITAB.
        WRITE: / ITAB-CARRID.
      ENDLOOP.
    ENDFORM.
    Hope the point is clear.
    Regards,
    Anand Mandalika.

  • ABAP OO, Creating object dynamically

    Hi everybody,
         I’m currently working on some Abap OO examples. Everything is working ok except for the following: Creating objects dynamically.
    This is what I’d like to do:
    Lets say we obtain a bunch of sales orders using a simple select statement and place them in an internal table. For each entry in our internal table, I’d like to generate a new sales order object. This salesorder object is a simple class with a constructor with an Id and some other attributes.
    When this is done, I’d like to append every object to a new object, say basket, so that this basket contains something like an internal table within each record a reference to the salesorder. Is this easy to do? I’m using the example that is described in the sap guide (create object pointer type (class_name) but it looks to me that you still have to declare the reference variables before you can create the object.
    Hmm, I think Java is better suited for a job like this.
    Hope you can help,
    Cheers and Best wishes
    Laurens Steffers
    The Netherlands.

    Hi,
    Its not all that difficult in ABAP as well. The following code is based on Chapter 5, Listing 5.20 from book ABAP Objects.
    What you need is an internal table of type <your sales object> e.g.
    DATA: BEGIN OF obj_sales_order
            sales_order_no LIKE <sales_order_no_type>,
            <...>,
            objref TYPE REF TO <SALES_ORDER_CLASS>
          END OF obj_sales_order,
          reftab LIKE SORTED TABLES OF obj_sales_order
                      WITH UNIQUE KEY sales_order_no
                                      <other key attributes>.
    Now all you need to do is to do a SELECT...ENDSELECT loop, and:
    SELECT ...
    obj_sales_order-sales_order_no = <selection result>
    obj_sales_order-<other key attr> = <selection result>
    READ TABLE reftab INTO obj_sales_order
                      FROM obj_sales_order.
    IF sy-subrc <> 0.
      CREATE OBJECT obj_sales_order-objref
             EXPORTING ...
             EXCEPTIONS ...
      IF sy-subrc <> 0.
        MESSAGE ...
        CONTINUE.
      ELSE.
        INSERT obj_sales_order INTO TABLE reftab.
      ENDIF.
    ENDIF.
    CALL METHOD obj_sales_order-objref-><method>.
    ENDSELECT.
    Hope this help.
    Regards

  • How to create objects in stack

    I am working on Weblogic 10 and JDK 1.5. In Java the objects are always created in heap. Can anybody tell me how to create objects in stack?

    SKMoharana wrote:
    i need objects to be allocated in stack as my application should respond in real time (time predictable).I heard this is possible in Mustang.If I am understanding you correctly, allocating objects on the stack will not help you, and creating objects on the heap will not hurt you.
    It is provably impossible to create a truly time predictable application (in any language), so what you're really looking to do is create a program that responds acceptably quickly for an acceptable percentage of the time. For this you can create benchmarks like "responds in 250 milliseconds or less 99.5% of the time".
    To this end, you could create a prototype program that creates the objects you wish on the heap, and see if there actually is a problem. Don't fall into the trap of premature optimization.
    Even if you do discover that your object creation IS the problem, heap allocation is not the problem. Take a look at this article. It takes ten machine instructions, less than 1 millisecond, to allocate an object.
    Your performance problems are most likely in the object initialization (look for long loops or deep recursions), the display (if this is a GUI application), or your network connection (if this is a web application).

  • Creating object class dynamically

    Hi ,
    I need to create object dynamically for a class.eg when i loop thru internal table i need to create an object per pass of the loop and no of entries  in itab can be known at runtime only
    Any clues
    Regards
    Swatantra

    Check this sample program, where it is creating a number of objects and appending them to a object list. 
    report zrich_0001.
    types: begin of telements,
           element(30) type c,
           value(30) type c,
           end of telements.
    *       CLASS lcl_element DEFINITION
    class lcl_element definition.
      public section.
        data: ielements type table of telements,
              xelements type telements.
        methods: constructor importing im_elements type telements,
                 write_out.
    endclass.
    *       CLASS lcl_element IMPLEMENTATION
    class lcl_element implementation.
      method constructor.
        append im_elements to ielements.
      endmethod.
      method write_out.
        loop at ielements into xelements.
          write:/ xelements-element, xelements-value.
        endloop.
      endmethod.
    endclass.
    data: itab type table of telements with header line.
    data: r_element type ref to lcl_element.
    data: r_elementlist type table of ref to lcl_element.
    start-of-selection.
    * Create the initial list of elements.
      itab-element = 'ELEMENTA'.
      itab-value   = 'Val_A'.
      append itab.
      itab-element = 'ELEMENTB'.
      itab-value   = 'Val_B'.
      append itab.
      itab-element = 'ELEMENTC'.
      itab-value   = 'Val_C'.
      append itab.
    * Create instances of the element object
    * and add to the list
      loop at itab .
        create object r_element
            exporting
                 im_elements = itab.
        append r_element to r_elementlist.
      endloop.
    * loop at the list and write out the element objects.
    * Notice that the r_elementlist is an internal table
    * which contains 3 objects.  Those three objects each
    * contain 1 internal table with one record each.
      loop at r_elementlist into r_element.
        call method r_element->write_out.
      endloop.
    Regards,
    Rich Heilman

  • Class that creates objects?

    Hello everyone! Im quite new to java and oop, but im enjoying using it quite a lot. I have read some books but everything is so fresh it is easy to get confused. I think this is a very basic questions but, here it goes:
    I have this simple class:
    public class Soda {
    int id;
    int sid;
    String brand;
    String flavor;
    }And now i want to fetch an URL that will return a text string for example "|1|23|Fanta|Orange". Now i want to create a Soda Object from this string (The String could have several Sodas)".... forget the parsing needed and the fectching for the text and everything else (Im using J2ME, and i have it solved)... but more basically:
    how can i make a *method that creates Soda objects*? Funny how i get confused with the simplest things.
    Thank you everyone for your comments and help!
    Alejandro

    AlexR wrote:
    while(something) {
    Soda soda=new Soda();}and each iteration of the while loop will create a different object? or overwrite over and over the created soda object?Each iteraion will create a new Soda object, and overwrite the soda variable with a reference to that object. If you want to have access to all the Soda objects after the loop exits, you need to add references to them to a collection or array.
    [http://java.sun.com/docs/books/tutorial/collections/]
    [http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html]
    Also, you can create constructors that take arguments.
    String brand = (parse brand from string);
    String flavor = (parse flavor from string);
    Soda soda = new Soda(brand, flavor);
    public class Soda {
      private final String brand;
      private final String flavor;
      public Soda(String brand, String flavor) {
        this.brand = brand;
        this.flavor = flavor;
    }

  • Internetexplorer.application activex component can't create object

    I am getting the infamous 429 error with a new image of Windows 2003 Server.
    I am sure this is an issue with the Windows 2003 Server image, so I have to figure out a work around to get this  to work.  No updates to the image are possible.  I have been searching for a solution for a couple of days and nothing I have
    tried has worked so any assistance you can provide is most welcome.
    This script works just fine on my Windows 7 machine and used to work just fine on the previous image of Windows 2003 Server I had which is no longer available:
    Err.Number: 429
    Err.Description: "ActiveX component can't create object"
    Here is the code:
    On Error Resume Next
    Set fsoObj = CreateObject("Scripting.FileSystemObject")
    Dim objIE
    Err.Clear
    Set objIE = CreateObject( "InternetExplorer.Application" )
    If ( Err.Number <> 0 ) Then
       WScript.Echo "Number (" & Err.Number & ")" & vbCrLf _
                  & "Description [" & Err.Description & "]"
       WScript.Quit
    End If
    objIE.Navigate "about:blank"
    objIE.Width          = 200
    objIE.Height         = 300
    Do Until objIE.ReadyState = 4
       WScript.Sleep 200
    Loop
    Do While objIE.Busy
       WScript.Sleep 200
    Loop
    bodyStr = javaScriptStr & "<table align='center'><tr><td align='center' colspan='2'>Click Run or Cancel</td></tr>" _
            & "<tr align='center'>" & vbCrLf _
            & "<td colspan='2'>" & vbCrLf _
            & "<input type='submit' value=' Run ' " & "OnClick='VBScript:OK.Value=1'>" & vbCrLf _
            & " &nbsp; &nbsp; " & vbCrLf _
            & "<input type='submit' value=' Cancel ' " & "OnClick='VBScript:CANCEL.Value=1'>" & vbCrLf _
            & "</td></tr>" & vbCrLf _
            & "</table>" & vbCrLf _
            & "<input type='hidden' id='CANCEL' name='CANCEL' value='0'>" & vbCrLf _
            & "<input type='hidden' id='OK' name='OK' value='0'>"
    objIE.Document.Body.InnerHTML = bodyStr
    objIE.Visible = True
    Do While ( ( objIE.Document.All.CANCEL.Value = 0 ) AND ( objIE.Document.All.OK.Value = 0 ) )
       WScript.Sleep 200
       If Err Then ' user clicked red X (or alt-F4) to close IE window
          objIE.Quit
          Set objIE = Nothing
          logFile.WriteLine Now & " - aborting input!"
       End if
    Loop
    objIE.Quit

    I tested this cleaned up version on WS2003.  It works exactly the same way as it does on Windows 8 and Windows 7.
    Set objIE = CreateObject( "InternetExplorer.Application" )
    objIE.Navigate "about:blank"
    objIE.Width = 200
    objIE.Height = 300
    Do While objIE.Busy
    WScript.Sleep 200
    Loop
    bodyStr = javaScriptStr & "<table align='center'><tr><td align='center' colspan='2'>Click Run or Cancel</td></tr>" _
    & "<tr align='center'>" & vbCrLf _
    & "<td colspan='2'>" & vbCrLf _
    & "<input type='submit' value=' Run ' " & "OnClick='VBScript:OK.Value=1'>" & vbCrLf _
    & " &nbsp; &nbsp; " & vbCrLf _
    & "<input type='submit' value=' Cancel ' " & "OnClick='VBScript:CANCEL.Value=1'>" & vbCrLf _
    & "</td></tr>" & vbCrLf _
    & "</table>" & vbCrLf _
    & "<input type='hidden' id='CANCEL' name='CANCEL' value='0'>" & vbCrLf _
    & "<input type='hidden' id='OK' name='OK' value='0'>"
    objIE.Document.Body.InnerHTML = bodyStr
    objIE.Visible = True
    On Error Resume Next
    Do While ( ( objIE.Document.All.CANCEL.Value = 0 ) AND ( objIE.Document.All.OK.Value = 0 ) )
    If Err Then ' user clicked red X (or alt-F4) to close IE window
    WScript.Echo Now & " - aborting input!"
    WScript.Quit
    End if
    WScript.Sleep 200
    Loop
    WScript.Echo Now & " - EXITING!"
    objIE.Quit
    ¯\_(ツ)_/¯

  • Run-time error '429': ActiveX component can't create object

    HI,
    I am having the following error in my Excel VBA Run-time error '429': ActiveX component can't create object  when running the following code:
    Dim objDistiller As New ACRODISTXLib.PdfDistiller6
    objDistiller.FileToPDF2 filePath & ".PS", filePath & ".PDF", "T:\Templates\PDFSettings\Standard.joboptions", 1
    This code has been working for years on all our systems, but due to recent security issues our administrator changed all user accounts to not have local administrator rights and now when we run this code we get the above error message.
    I have had a look at DComcnfg.exe to try and get it to work by setting the default property permissions to allow access by Everyone but I am still getting the error.
    Any help would be greatly appreciated.
    Regards.
    Shane Chapman.

    Hi Shane,
    Here is another way to create PDF with Macro using another API than Distiller. This API is faster too.
    Probably this post is not of interest anymore but here is how I have done it:
    1. Download PDFCreator: http://sourceforge.net/projects/pdfcreator/
    2. Use the following Macro:
    Option Explicit
    Sub printPDFmacro()
    'Author : Ken Puls (www.excelguru.ca)
    'Macro Purpose: Print to PDF file using PDFCreator
    ' (Download from http://sourceforge.net/projects/pdfcreator/)
    ' Designed for early bind, set reference to PDFCreator
    Dim pdfjob As PDFCreator.clsPDFCreator
    Dim sPDFName As String
    Dim sPDFPath As String
    '/// Change the output file name here! ///
    sPDFName = "Facture-" & nclient2 & " le " & Format(Date, "yyyy-mm-dd") & ".pdf"
    sPDFPath = "E:\Partenaire Scolaire\Comptabilite\Factures"
    PDFFileName2 = sPDFPath & "\" & sPDFName
    Set pdfjob = New PDFCreator.clsPDFCreator
    With pdfjob
    If .cStart("/NoProcessingAtStartup") = False Then
    MsgBox "Can't initialize PDFCreator.", vbCritical + _
    vbOKOnly, "PrtPDFCreator"
    Exit Sub
    End If
    .cOption("UseAutosave") = 1
    .cOption("UseAutosaveDirectory") = 1
    .cOption("AutosaveDirectory") = sPDFPath
    .cOption("AutosaveFilename") = sPDFName
    .cOption("AutosaveFormat") = 0 ' 0 = PDF
    .cClearCache
    End With
    'Print the document to PDF
    ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
    'Wait until the print job has entered the print queue
    Do Until pdfjob.cCountOfPrintjobs = 1
    DoEvents
    Loop
    pdfjob.cPrinterStop = False
    'Wait until PDF creator is finished then release the objects
    Do Until pdfjob.cCountOfPrintjobs = 0
    DoEvents
    Loop
    pdfjob.cClose
    Set pdfjob = Nothing
    end sub
    Have any questions, just have to poke me.
    Michael

  • Crystal Report Addon Error : ActiveX Component Can't Create Object

    Hello Experts,
    We are facing an problem when we start the Crystal Report Addon .The error message getting
    displayed is  "CR_Crypto ActiveX Component Can't Create Object".This issue is happening only on the
    server its working fine on the client. We had even unistalled and re-installed the addon in the server but
    still it throws the error when we start the addon.
    Please help us to resolve this issue
    Thanks,
    Vishwanath

    Dear Friend,
                 I had described the problem to our technical support team, and they replied as follows u2013
    They solved the Script related error by several stages.
    They checked the machine for any mal-ware existence by the tool provided by Microsoft (MS Mal-ware remover).
    Then they tried by installing the following patches from Microsoft u2013
    http://support.microsoft.com/kb/949140
    Windows Script 5.7 for Windows XP
    http://www.microsoft.com/downloads/details.aspx?familyid=887fce82-e3f5-4289-a5e3-6cbb818623aa&displaylang=en
    Windows Script 5.6 for Windows Server 2003
    http://www.microsoft.com/downloads/details.aspx?FamilyId=C717D943-7E4B-4622-86EB-95A22B832CAA&displaylang=en
    Windows Script 5.6 for Windows XP and Windows 2000
    The internal matter to this problem was about the following DLL and its version u2013
    C:\WINDOWS\system32
    vbscript.dll
    5.5.0.8820
    Desired
    5.6.0.8820
    Check, if the information helps you.

  • Runtime error 429, activeX component cant create object while using netbet pro on windows 7 & 8.1 HELP!!!

    runtime error 429, activeX component cant create object while using netbet pro
    does anyone know what I could do to fix this problem??? netbet pro was't available for a while then it's back but has yet to run

    What's netbet pro?
    I'd recommend asking questions about third party applications in the vendor's forum, not a Microsoft forum meant for admin scripting.
    EDIT: Ah, some gambling website...
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • Creating objects when count is greater than 1

    Hi
    I'm trying to create a runbook that checks service manager for incidents that have been created in the last 10 minutes of the same category. When the result of this check brings back more than 5 objects I want a problem to be created with the incidents linked
    to the problem. 
    I know a junction will be required somewhere in order to stop the create object running multiple times but when this occurs I cannot address the scobject guids in the create relationship step. I have attached a screenshot of the runbook below.
    Thanks

    Hi,
    Flatten the "Get Object Count" Activity so it triggers only once.
    Regards,
    Stefan
    www.sc-orchestrator.eu ,
    Blog sc-orchestrator.eu

  • Yes, I want to create object-relational schema from DTD.

    Thank you for reply~~
    I want to create object-relational schema from DTD using object type or collections as mentioned.
    In reply, it is impossible.
    But, I read Oracle supports storing an XML document with object-relation. I executed storing sample, but I had to create schema manually.
    Is it really impossible to create OR schema from DTD automatically?

    Yes. You need to create your database schema before insert XML data to it.

Maybe you are looking for