How To Create Object Wrappers

Hi there,
I would like to implement some better and custom error handling in some of the business objects.  Objects such as the Recordset and Documents can have a tendency to 'die' on a line that errors and I would like to create wrappers for these classes so I can handle them using common methods.
I have tried to create new classes inheriting from RecordsetClass and DocumentsClass and everything compiles fine but produces COM errors as soon as I try to access them at runtime.  Are we just out of luck trying to enhance these classes?  Is our only option to write a one-off wrapper that simply handles the SBO object type internally in our new class?
It would seem very beneficial to be able to extend these objects in order to implement common methods and business rules.  Has anyone been successful at doing this?
Here is my class declaration that fails when I try to access it at runtime:
using System;
using System.Runtime.InteropServices;
using SAPbobsCOM;
namespace NMO.SAP.Shared
    /// <summary>
    /// PLS Wrapper for the SAP Documents object
    /// </summary>
    public class SBODocuments : DocumentsClass
        private SAPbobsCOM.Company sboCompany;
        public SBODocuments(SAPbobsCOM.Company company)
            this.sboCompany = company;
        /// <summary>
        /// New implementation of the Add method returning true or false
        /// </summary>
        /// <returns>True or false</returns>
        public new Boolean Add()
            Boolean retVal = true;
            try
                // Add method returns 0 if successful
                if (base.Add() != 0)
                    retVal = false;
                    SBOErrorHandler.HandleSAPError(this.sboCompany);
            catch (COMException cex)
                retVal = false;
                SBOErrorHandler.HandleSAPError(this.sboCompany, cex);
            catch (Exception ex)
                retVal = false;
                SBOErrorHandler.HandleSAPError(this.sboCompany, ex);
            return retVal;
Thanks very much,
David

David,
A good aproach would be to convert .COM objects to .NET
This application <a href="http://www.aurigma.com/Products/COMtoNET/">COMtoNET</a>
Will generate all the C# Code needed to convert COM objects to .NET, and then you'll be able to catch any event, error and so on.

Similar Messages

  • How to create objects in ABAP Webdynpro?

    Hi,
    I want to create the object for the class: <b>CL_GUI_FRONTEND_SERVICES.</b>
    then i want to call file_save_dialog method.
    how shoud i write the code, plz?

    I have written this code:
    v_guiobj TYPE REF TO cl_gui_frontend_services.
    <u> ?????????????</u>
    v_guiobj->file_save_dialog( ...).
    How to create object in the place of ?????????????.
    Bcoz, when i run this i am getting:
    <b>Access via Null object reference not possible.</b>

  • How to create object at infoview

    Hi all
    i am using SAP BO 3.1
    How to create object called SL NO this is not available at universe and second object  "code" is coming from universe.
    final output should be like this
    SL NO
    code
    1
    Non-Emergency ED Utilization
    2
    Office Visits
    3
    Inpatient Stays
    thanks in advance!!
    Ranjeet

    Hi Ranjeet
    Insert one column in that report. Write formula like this...
    =LineNumber()-1
    Regards,
    G

  • 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).

  • How to create objects to paint itselfs without specifiy the location

    How to create objects to paint itselfs without specifiy the location using Java 2D

    shot in the dark: pass in the Graphics2D context to the method ?

  • How to create objects dynamically (with dynamic # of parameters)

    I need to create a set of objects based on a definition from an XML file (obtained from the server) and add them to my scene.
    I understand how to create the object using getDefinitionByName (and the limitations regarding classes needing to be referenced to be loaded into the SWF).
    But some objects require parameters for the constructor, and some don't. The XML can easily pass in the required parameter information, but I can't figure out how to create a new object with a dynamic set of arguments (something akin to using the Function.call(obj, argsArray) method.
    For example, I need something like this to work:
    var mc=new (getDefinitionByName(str) as Class).call(thisNewThing, argsArray)
    Currently this is as far as I can get:
    var mc=new (getDefinitionByName(str) as Class)(static, list, of, arguments)
    Thoughts?

    I think what Dave is asking is a bit different.
    He's wanting to know how to invoke the constructor of an object dynamically (when he only knows the # of constructor arguments at runtime).
    This class I know will do it but seems to be a hack:
    http://code.google.com/p/jsinterface/source/browse/trunk/source/core/aw/utils/ClassUtils.a s?spec=svn12&r=12
    See the 'call' method, which first counts the # of arguments then invokes one of 'n' construction methods based on the number of constructor args.
    I've yet to find a clean AS3 way of doing things ala 'call' though.
    -Corey

  • How to create object in sproxy--

    Hi  all
    i am new to XI
    how to create a new object in sproxy transction
    there is no such option called create in sproxy transction , i can only see a option called edit object
    kindly hepl me out , to create new object in spoxy.

    Hi,
    What do you mean by create a new object in the proxy?
    Means you want to generate the proxy class?
    if yes then we have two proxies
    1. Client Proxy: If the sender is R/3 then we have to create the client proxy, by using one SE38 program we can call this proxy
    2. Server Proxy: If the R/3 is at receiver side then we call this as server proxy. it executes by itself.
    Client proxy:
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
    Server Proxy:
    /people/siva.maranani/blog/2005/04/03/abap-server-proxies
    Proxy generation
    http://help.sap.com/saphelp_nw04/helpdata/en/ba/d4c23b95c8466ce10000000a114084/content.htm
    If you create the Service interface or message interface in the XI/PI then that interface we can view in the R/3 system when we execute the SPROXY transaction.
    Regards
    Ramesh

  • How to create object for a interface (or) how to use ITextModel Interface

    Hi,
    I am new to vc++ and indesign, i am using windows xp as OS and Indesign CS3 as version, now i want to know how to create an object for the ITextModel Interface (or) how to use the ITextModel interface, for getting the selected text and to manipulate the content, for this i tried myself to the best for more than a week,
    but i not get any solution or any idea to do it, so i post this scrap, if any one knows kindly help me immediately, if u want any more details kindly reply me i am ready to give..
    Regards,
    ram

    Hi, Ram,
    as Jongware already has explained in a previous thread, this is the scripting forum, the SDK forum is next door.
    Besides, your question has already been answered over there in SDK forum - with a reference to an existing example, including documented source. There is also plenty more documentation (780 pages alone in the programming guide) and other working examples.
    The brief response was a perfect match to the vague, general scope of the question. If you want more details, be more specific yourself. Do not just touch such major topics as selection, text, object architecture in one sentence to expect a silver bullet. Instead, stick to one detail, find and read the relevant examples and documentation (did I mention the programming guide?) yourself e.g. using keyword search. Quote your code where you're stuck.
    Being new to both VC++ and InDesign is an explanation but no excuse. IMO, same goes for "using windows xp as OS". All together are bad starting conditions if you intend to write a plugin. Even a seasoned C++ programmer with some years of experience in publishing quirks will easily require months, so don't become impatient after just a week.
    If you need quick results and have a programming background such as a recent Java101, reconsider scripting (this forum). It can bring you amazingly far and you'll learn InDesign through a simplified object model. Same principles apply - there is plenty documentation and a good choice of examples.
    Regards,
    Dirk

  • How to create object by getting class name as input

    hi
    i need to create object for the existing classes by getting class name as input from the user at run time.
    how can i do it.
    for exapmle ExpnEvaluation is a class, i will get this class name as input and store it in a string
    String classname = "ExpnEvaluation";
    now how can i create object for the class ExpnEvaluation by using the string classname in which the class name is storted
    Thanks in advance

    i think we have to cast it, can u help me how to cast
    the obj to the classname that i get as inputThat's exactly the point why you shouldn't be doing this. You can't have a dynamic cast at compile time already. It doesn't make sense. Which is also the reason why class.forName().newInstance() is a very nice but also often very useless tool, unless the classes loaded all share a mutual interface.

  • How to create object[][] dinamically

    I know that if I want to create object[][] I have to do something like this
    Object[][] obj = new Object[3][4];
    but I don't know how long my obj is... what can I do? I'd like to do something like new object[][]; like arraylist or something like that
    thanks a lot

    Well, I have a db and some query on it... so I won't know how many rows there are... Maybe the best solution is the first one (ArrayList Of ArrayList).
    Thanks to all of you

  • How to create Object related messages using cl_bsp_wd_message_service?

    Hi Gurus,
    Can any ony explain how to create the object related messages using add_message method of cl_bsp_wd_message_service?
    Thanks,
    Murali.

    Hi Murali,
    Check the below code .. hope it helps..
      DATA lr_msg_service     TYPE REF TO cl_bsp_wd_message_service.
      DATA lr_exception       TYPE REF TO cx_root.
      DATA lr_rtti            TYPE REF TO cl_abap_objectdescr.
      DATA lv_msg_type        TYPE        symsgty.
      DATA lv_msg_id          TYPE        symsgid.
      DATA lv_msg_number      TYPE        symsgno.
      DATA lv_msg_v1          TYPE        symsgv.
      DATA lv_msg_v2          TYPE        symsgv.
      DATA lv_msg_v3          TYPE        symsgv.
      DATA lv_msg_v4          TYPE        symsgv.
      DATA lv_msg_level       TYPE        bsp_wd_message_level.
      DATA lr_verification    TYPE REF TO if_bsp_wd_message_handler."#EC NEEDED
      DATA lv_important_info  TYPE        abap_bool.
      DATA lv_exc_prog_name   TYPE        syrepid.
      DATA lv_exc_incl_name   TYPE        syrepid.
      DATA lv_exc_src_line    TYPE        i.
      lr_exception = ir_exception.
    drill down to first exception
      WHILE lr_exception->previous IS BOUND.
        lr_exception = lr_exception->previous.
      ENDWHILE.
      lr_rtti ?= cl_abap_typedescr=>describe_by_object_ref( p_object_ref = lr_exception ).
      lr_exception->get_source_position( IMPORTING program_name = lv_exc_prog_name
                                                   include_name = lv_exc_incl_name
                                                   source_line  = lv_exc_src_line ).
    prepare message
      lr_msg_service = cl_bsp_wd_message_service=>get_instance( ).
      lv_msg_type   = if_genil_message_container=>mt_warning.
      lv_msg_id     = 'CRM_IC_APPL'.
      lv_msg_number = '003'.
      lv_msg_v1     = lr_rtti->get_relative_name( ).
      lv_msg_v2     = ir_exception->get_text( ).
      lv_msg_v3     = lv_exc_incl_name.
      lv_msg_v4     = lv_exc_src_line.
      lv_msg_level  = '9'.
    add message to error log
      lr_msg_service->add_message(
          iv_msg_type       = lv_msg_type
          iv_msg_id         = lv_msg_id
          iv_msg_number     = lv_msg_number
          iv_msg_v1         = lv_msg_v1
          iv_msg_v2         = lv_msg_v2
          iv_msg_v3         = lv_msg_v3
          iv_msg_v4         = lv_msg_v4
          iv_msg_level      = lv_msg_level
          iv_verification   = lr_verification
          iv_important_info = lv_important_info ).
    Regards,
    Raghu

  • How to create Object!

    Hi all,
            Can anyone tell me how to create an object of the class CL_BP_HEAD_CORPACCOUNTDET_CTXT .
    Please reply as fast as possible.
    Regards,
    Vijay

    Hi Balasubramanian,
    The below steps might help u out.
    1.      Call the function Create Object.
    You have the following options:
    ¡        Choose Object ->New () in the main menu (or the pushbutton Create Object ).
    ¡        Position the cursor on a structure node in the navigation area and choose New () from the context menu.
    In this case, there are already entries in the Create Object dialog, corresponding to the position of the cursor in the navigation area.
    Integration Builder (Integration Directory): You have positioned the cursor on the Service node of a communication party. If you call the function Create Object from the context menu, there are already entries for the object type Service and the party field.
    You cannot create objects of type RFC or IDoc again.
           2.      Enter the required information. Select the object type first and then specify the object key.
    An input help  is available to help you specify the key values. To call the input help, use the icon . The value selection offered by the input help may depend on which values have already been defined for the other key attributes.
    Integration Builder (Integration Repository): The namespace selection depends on the selected software component version.
           3.      To confirm your entries, choose Create.
    This calls the object editor for this object. The specifications that you made when you created the object are displayed in the header. You can edit the object further in the work area of the object editor.
    Once you have confirmed your entries by choosing Create in the Create Object dialog, you can no longer change the object key.
    Reward if helpful.
    Thankyou,
    Regards.

  • How to create object through  transaction snro

    Hi ,
       I want to create an object through Snro transaction.
    I dont know how to use this transaction.
    Please Help.
    Thanks in advance.
    Nikita

    Nikita,
    Based on the transaction code, respective function consultant will create number range.
    If u want a number series for some other purpose in ur program u can create object in snro as below.
    1. Enter a object name and click 'CREATE' button
    2. In the next screen give relevant description
    3. In 'Number length domain' field u can specify the length of number .. example if u give char10, then it will be a ten digit number series.
    4.Enter warning percentage.. the purpose is to throw warning message 10 % before when ur number series about to exhaust.
    5. After entering those details --> press save button.
    6. Again come to main screen (SNRO initial screen) then click number raneg tab inthe application tool bar.it will take u to next screen.
    7. In that click internal change push button
    8. IN the resulting screen enter ur number range series,
    example
    01     00000001     09999999
    02     10000000     19999999 etc
    9. click save button..NOw ur number series is ready for use.
    Regards,
    Aswin.

  • How to create object from Table?

    Hi all,
    Is there any command to create an object type from a table?
    I i want to that command to create object type from emp table insted of typing the following command:
    CREATE TYPE emp_t AS OBJECT
    (empno NUMBER(6),
    ename VARCHAR2(25),
    job VARCHAR2(10),
    mgr NUMBER(6),
    hiredate DATE,
    sal NUMBER(8,2),
    comm NUMBER(2,2))
    any help would highly be appriciated.
    Thank you in advance,
    Alireza

    Hi Jafar,
    Thanks for your attention,
    I dont want to create synonym,
    I just want to create some Object types and work with XMLDB and create xsd or somthing like that using XMLDB packages.
    I supose There shold be a simple way to do that.
    Alireza

  • How to create object class for a z table

    Hi All,
    I have a z table and I want to register the changes of fields should be logged to CDHDR and CDPOS table.
    Is this possible?
    If yes how can I creat an object class for a z table. I have already checked the change document option in z data element.
    Please help.
    Regards,
    Jeetu
    Moderator message: standard functionality, please search for available information/documentation before asking.
    locked by: Thomas Zloch on Oct 6, 2010 6:16 PM

    Tcode SCDO. You'll need to create a change document for you Z table and then use the FM created to record the changed data.

Maybe you are looking for

  • Can't find this info anywhere... Can I upgrade from CS3 to CS5 or CS5.5?

    After using Adobe products for years and years, it's not only my opinion but the opinion of many of my colleagues that CS upgrades are only worth it about every other upgrade. That might be a subjective opinion, but it does lead in to my question: Do

  • ITunes 9.0.1 through SOFTWARE UPDATE - DON'T DO IT

    Good ol' Apple have done it again! Just DL-ed the latest iTunes 9.0.1 and as with the previous release, 8 something, it tells me that *_the installation was corrupted_*. As a result I now have Software Update telling me that the machine needs no new

  • Calculating currency

    All, I am parsing a csv file and I am reading in a properties files that contains headers: ACCT_NUM, TOTAL EQUITY, PRICIPAL I am using opencsv to read the data. [code' while((data = reader.readNext()) != null){                     for(int i =0;i<head

  • SUS-ERP integration w/o XI

    Hi! We have an extended classic scenario already up and running between ERP->EBP system without XI usage. We are using BBP_EXTREQ_TRANSFER report. And we would like to Configure SUS system to make Suppliers able to see Sales Orders and create Confirm

  • Import Images into slide show - Creating Thumbnail images -Hang

    I am using iDVD 7. I imported my images into a slideshow. The pictures were not in iPhoto but just a folder that I created and edited in Photoshop. Once I import the images, the window shows all the file names as expected but all the Image Thumbnails