ABAP Unit: Can one call a method in the setup/teardown methods?

Hi all,
I'm using ABAP Unit test ClasseS (what's with the odd capitalization BTW?) in the class builder on NW7.0.
In my SETUP method I do not want to do a CREATE OBJECT, but want to use a GET_INSTANCE method of my main class to instantiate my object.
When I execute my unit test however the instance methods all fail with CX_REF_NOT_ASSIGNED - meaning there is no instance m_ref.
OK, fair enough methinks, let me debug and see what's going on.
Surprise: When I set a breakpoint in the SETUP method it all runs fine. Instances are instantiated and instance method tests execute successfully.
So now I'm a bit stuck trying to investigate a problem that disappears everytime you look at it, a bit like trying to see if the light is off when the fridge is closed... Any ideas?
Cheers,
Mike
Edit: Just to clarify, here's some code:
  method setup.
    m_ref = zcl_myclass=>get_instance( im_key = 'ABC' ).
    " when debugging m_ref is always instantiated and test runs successfully!
  endmethod.       "Setup
  method get_some_data.
    result = m_ref->get_some_data( ).
    " without breakpoint in the setup method, this fails because m_ref is not assigned
  endmethod.
Edited by: Mike Pokraka on Jun 23, 2008 11:57 PM

Never mind, found problem, schoolboy error:
My class_setup method created test data but the update hadn't completed so my GET_INSTANCE failed in normal execution but worked in debug because of the associated delay. 'commit work' needed an 'and wait' and now it's happy.

Similar Messages

  • Can one call a function module in Calculated Key Figure?

    Can one call a function module in Calculated Key Figure? If  yes how, if not, what is the solution if formula does not suffice?
    I want to convert duration which is in seconds to   Duration in Hours and Minutes. There is a function module for doing it. Not sure how to do it in a formula.

    One option you have is a Virtual Key Figure and User Exit to use the Function Module to convert the time from seconds to HH:MM. Here are two documents on this subject to help you create them, based on the technology your comfortable with:
    [Implementing Virtual Key Figure/ Characteristics Makes Query More Dynamic|https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/e051fda8-71a9-2a10-ac9e-8d17414a8c8c&overridelayout=true]
    [Step By Step Process for Virtual Key Figures and Characteristics through BAdi|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/60e34f63-f44c-2c10-488e-c89b04e0ca7c&overridelayout=true]

  • Can i call a Workbook trought the portal?

    Hi all,
    i have to call a workbook trought the portal, when i put the workbook en in the Rol, this just can be seen from the Browser. but im the portal doesnt appear,  now my task is put these reports (workbooks) that the users can execute them trought the portal, how can i do this? help

    this is what i got and what i need,
    i got a web template like a panel buttons, where behind each button is a web report,  but there is one report that is needed in a workbook,  i got the button for this report, the problem is how can i call this workbook trough the web template???
    trough javascript???
    trough html???
    trough FM ??
    i got a FM RSAH_LAUNCH_EXCEL , this FM just need the ID WORKBOOK and ID QUERY, this can fixed because this button is for this report, but now what can i do to make this...., help

  • Can I call two numbers at the same time on facebook?

    Can I call two numbers at the same time on facebook?

    thanks for your answer. Yes indeed HTML widgets run only full screen (snif snif). I consider this as a "distinguishing treatment".
    One solution  i read !!!!! was to create through keynote a countdown clock, to export to quicktime move and to imported at iBA predefined widgets. of course this is not the solution i need.
    So, in order to have at the same widget and run together a count down clock and a preview test (20 questions)  i must
    1)"hack" the preview widget and insert a countdown clock
    2) create a preview test using iAD.....
    thanks again
    haris

  • Can one organize a playlist in the grid or artist view in iTunes 11?

    can one organize a playlist in the grid or artist view in iTunes 11, i.e visually? the playlist as just a list of songs/ artists is a hopeless & very frustrating way to orgaize a list of maybe 30 songs/ artists that i might have downloaded in one session. or do the boffins at mac have that kind of brain numbing memory capacity?

    hi, yes i use that, but what i'm asking is can i drag the songs into the order i want when i have grid or artist list. in artist list it just lists alphabetically, it does not list in playlist order. it seem s to me that only in 'list' view without images that i can drag songs around, which is useless.
    thanks

  • Can we call another transaction from the Userexit

    Hi all,
            Can we call another transaction from the Userexit?
    Thanks,
    Balaji

    Hi
    Because the statament CALL TRANSACTION triggers the end of the LUW so COMMIT WORK, so you should be sure not to insert that statament while some updating actions are been doing.
    So that exit shouldn't be triggered while updating
    Max

  • How can i call ajax and extract the data?

    Hi all,
    I don't know briefly about ajax..i want to learn ajax, so my question is how can i call ajax and extract the data. for ex, i have JSON file
        "mobile": [
                "Name": "Micromax",
                "Model": A310
                "Name": "samsung",
                "Model": grand 2
    for above example how can i call ajax..please anyone explain with small example because it'll help me a lot.
    Thanks & Regards,
    Palsaran

    Hi Palsaran,
    As i understood, your requirement is to POST data from UI to backend.
    The above code you given is not correct if you want to use model based implementation.
    In UI5 you don't need to do an explicit Ajax call, for which we can use Models like OData, JSON etc.
    For your JSON example, you can use like,
    var oModel = new sap.ui.model.json.JSONModel();
    var oData = "YOUR JSON DATA";
    oModel.setData(oData)
    oModel.loadData(yourURL/Entityset,"POST");
    For ref, you can use the below link
    JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.json.JSONModel
    Thanks
    Naveenraj

  • Can one publish iBook textbooks outside the U.S.?

    Can one publish iBook textbooks outside the U.S.?

    There is currently only a "Textbooks" category in the iBookstore in the US.
    You CAN sell your .ibooks file in other countries by uploading it to alternate categories.
    https://discussions.apple.com/message/18802771

  • Can I call an EJB from the database?

    Hi,
    I've just spent the last few days attempting to call an EJB from a stored procedure in a 10g database (and still haven't succeeded).
    Now having spent hours searching the web (and this forum) for any successful examples (so far I have found none) I thought I'd add a message to see if there is anybody out there who has done this successfully. If so can you please provide me some details on how to do this?
    Alternatively, I'd appreciate any input on how I can overcome my current hurdle in attempting to do this myself.
    Here's how far I've got in my attempt:
    I have a simple stateless session bean deployed to both Oracle 10gAS (a standalone OC4J container in 10.1.3) and to Weblogic 9. I have a client java class that calls a method on this bean and displays some ouput if successful. This all works from a standalone JVM (version 1.4) on both Weblogic and 10gAS.
    I then tried to load the required libraries for Weblogic onto the database (namely the Weblogic.jar file). This resulted in the addition of some 32,000 odd objects of which 30,000 odd could not be resolved. I figured a lot of these may be down to JVM version issues (I believe that Weblogic 9 uses the 1.5 JRE) so I decided to put the Weblogic test on the back burner for now and just use the Oracle app server.
    The tests with the Oracle app server looked promising. I only needed a handful of libraries to be loaded onto the database and all the relevant classes required for my test client had resolved (including the initial context factory required to do the jndi lookup of the bean). After granting all the permissions I believed I needed I'd got to the point where I could do a jndi lookup of the EJB; but when I tried to create an instance of the beans remote interface I got the following error:
    java.security.AccessControlException: the Permission (java.lang.RuntimePermission getClassLoader) has not been granted to ProtectionDomain (file:generated/by/proxy <no certificates>)
    com.evermind.net.DynamicClassLoader@612d9d34
    <no principals>
    java.security.Permissions@eb0f3c1a (
    (java.util.PropertyPermission java.version read)
    (java.util.PropertyPermission java.vm.name read)
    (java.util.PropertyPermission java.vm.vendor read)
    (java.util.PropertyPermission os.name read)
    (java.util.PropertyPermission java.vendor.url read)
    (java.util.PropertyPermission java.vm.specification.vendor read)
    (java.util.PropertyPermission java.specification.vendor read)
    (java.util.PropertyPermission os.version read)
    (java.util.PropertyPermission java.specification.name read)
    (java.util.PropertyPermission java.class.version read)
    (java.util.PropertyPermission file.separator read)
    (java.util.PropertyPermission java.vm.version read)
    (java.util.PropertyPermission os.arch read)
    (java.util.PropertyPermission java.vm.specification.name read)
    (java.util.PropertyPermission java.vm.specification.version read)
    (java.util.PropertyPermission java.specification.version read)
    (java.util.PropertyPermission java.vendor read)
    (java.util.PropertyPermission path.separator read)
    (java.util.PropertyPermission line.separator read)
    (java.net.SocketPermission localhost:1024- listen,resolve)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:280)
         at java.security.AccessController.checkPermission(AccessController.java:429)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:528)
         at oracle.aurora.rdbms.SecurityManagerImpl.checkPermission(SecurityManagerImpl.java:192)
         at java.lang.Thread.getContextClassLoader(Thread.java:1203)
         at com.evermind.server.rmi.RMICall.<init>(RMICall.java:36)
         at com.evermind.server.rmi.RmiCallQueue.createCall(RmiCallQueue.java:33)
         at com.evermind.server.rmi.RMIClientConnection.createQueuedCall(RMIClientConnection.java:592)
         at com.evermind.server.rmi.RMIClientConnection.writeRequest(RMIClientConnection.java:581)
         at com.evermind.server.rmi.RMIClientConnection.sendMethodInvocationRequest(RMIClientConnection.java:426)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:415)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at __Proxy0.create(Unknown Source)
         at com.axiomsystems.test.client.TestDBClient.test(TestDBClient.java:76)
    Has anybody come across this before? If so can they help?
    If not has anybody out there actually managed to call an EJB method (without going via an RMI server/Servlet/or any other proxy).
    Any help in this matter would be greatfully appreciated.
    Cheers,
    Anand.

    Sure, here's the code. It's what JDev generates automatically but I have seperated some things into several diffrent lines so I could experiment easier.
    final Context context = getInitialContext();
    Object o=context.lookup( "SessionEJB4" );
    Object l= PortableRemoteObject.narrow( o, SessionEJB4Home.class );
    final SessionEJB4Home sessionEJB4Home = (SessionEJB4Home)l;
    SessionEJB4 sessionEJB4 = sessionEJB4Home.create();
    String ret=( sessionEJB4.hello( ) );
    As I mentioned, for this I have used EJB2.1 bean, because I had same problems with EJB3.0, so I tried earlier versions of Java to make sure that is not the problem.
    hello() method just returns string "hello".
    Of course, this works in standalone client that is not loaded into database.
    Now, I loaded all the jars mentioned in this thread, using loadjava options -v -resolve, and I loaded client using options -v -resolve -genmissing . Select query on user objects in database shows that client class and relevant classes are all valid.
    Then I created stub and ran it. First it stopped throwing exception ORA-29532: Java call terminated by uncought Java exception: Java.lang.NoClassDefFoundError.
    Method I try to run returns String value which is hello message if it works fine, else it prints the part of the stack trace. In this case, after p[revious error, When I try to run it again, i get return from the method :
    Lookup error: java.lang.NoClassDefFoundError; nested exception is:
         java.lang.NoClassDefFoundError
    com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:89)
    com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMIClientConnection.java:371)
    com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:179)
    com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:283)
    com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
    javax.naming.InitialContext.lookup(InitialContext.java:347)
    simpleejbproject.EJB4Client.hello(EJB4Client.java:35)
    Of course, regular version of the client I run frokm command line works fine.
    So I'm kind of a stuck here. I followed all directions, tried it on oracle 9 and oracle 10 DB, the problems remain the same. Am I missing something here?
    Thanks
    Just to add, getInitialContext()
        private static Context getInitialContext() throws NamingException {
            Hashtable env = new Hashtable();
            // Oracle Application Server 10g connection details
            env.put( Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory" );
            env.put( Context.SECURITY_PRINCIPAL, "oc4jadmin" );
            env.put( Context.SECURITY_CREDENTIALS, "manager1" );
            env.put(Context.PROVIDER_URL, "opmn:ormi://mserv:4005:home/TestEjb4");
            return new InitialContext( env );
    It goes withouth any exceptions.
    Message was edited by:
    user510152

  • I downloaded Maverick and now I can't open pages from the Dock.  The Pages icon just jumps up and down abut doesn't open.  However, I can one pages by clicking on the App. I have an iMac with iWork 08.

    Since upgrading to Maverick from Mountain Lion I am unable to open Pages from the Dock.  When I click on the pages icon in the dock the icon just keeps bouncing up and down.  However, I can open pages by clicking on the icon in the Apps folder.  No problems prior to upgrading to Maverick.

    Quit Pages. Drag its icon out of the Dock. Create a new one by dragging the application into the Dock. Test.

  • Yosemite iMac can start calls using iPhone, but the call doesn't move to the mac and stays on iPhone

    Hey,
    I've got a mid 2011 iMac, and I used it as part of the Yosemite beta program. During this, I was able to make and receive calls as part of the continuity feature perfectly.
    After initially swapping to the release version, the iMac wouldn't make/take calls from the phone at all. I rectified that by signing out and back in to iCloud through facetime on both the iMac and iPhone 6 on iOS 8.1.
    Now, the option to make/take a calls shows up on the iMac through facetime/contacts and the waveform appears from the notification centre, however all the audio comes from the iPhone as if it's been answered from the iPhone, there is no sound at all from the iMac.
    Does any one have any solutions to this problem?
    Thanks in advance.

    From King_Penguin in response to an earlier query on this topic:
    You should be able to copy it over by connecting your phone to your computer's iTunes and doing File > Devices > Transfer Purchases - it should copy over to the Books part of your library
    Cheers,
    GB

  • Can one share JPEG files using the Creative Cloud for example similar to Dropbox and Flickr

    Can one use the Creative Cloud facility to share JPEG files similar to Dropbox and Flickr

    ALakey, Yes!!! You can, you just have to click on Share and put the email address of the person and a link will be sent to him.
    - Nitin

  • Can one pin all items from the bookmark toolbar to the Windows 7 Taskbar Quicklaunch icon?

    Is it possible to have the favorites toolbar displayed as 'pinned favorites' on the Windows 7 Taskbar?
    I know I can just drag an favorite from the Favorites Toolbar to the Firefox Quicklaunch icon,
    but it looks really ugly;
    It shows the default Firefox favicon with the web address partially displayed instead of the name
    I have given it on the Bookmarks Toolbar.
    Is there a way to preserve the favicon, and have the Favorites name displayed instead?
    Thanks in advance!
    Regards,
    Nick.

    Heloo,
    thanks for the swift reply!
    That does not resolve my issue.
    My bookmarks toolbar is already nice and tidy. ([https://docs.google.com/file/d/0B3fLyJeN1WiBYUV2aWloVVlGWHc/edit Screenshot])
    What I am talking about, is getting them the same on the '''Windows 7 Taskbar'''.
    They now look like [https://docs.google.com/open?id=0B3fLyJeN1WiBRVlKT3hzQ2FLek0 this].
    The example shown is the address of my GMail inbox.
    I would like to have it just show "GMail inbox" for example, instead of the url it is referring to, with the GMail favicon.

  • Avoid Duplicate Named Ranges when copying a sheet from one wb to another with the worksheet.copy method

    I have a template monthly report with about 30 pages and 50+ users. Each user makes some modifications to their copy so they are loathe to adopt any new version. My solution is to migrate their data, etc across to the new version. I've solved many of
    the problems, but the current one has me stumped. Using OldWS.Copy After:=newWB.Sheets(newWB.Sheets.Count) I get a copy of new sheets in the old workbook and paste them at the end of the new workbook. So far ok. Problem is it duplicates named ranges. I added
    Application.DisplayAlerts = False, and that stops the dialog boxes, but the names get added as local sheet scope variables. The .Copy method doesn't seem to have any parameters except the choice of before or after. I've been searching for a week now to no
    avail. TIA for any help or suggestions.
    Question: How can I avoid duplicating the named ranges if there is already a global (workbook scope) named range in the workbook?

    Hi rdperkins,
    Base on my test, the result is the same to you, it will keep the same named range in the new worksheet.
    As far as I know, we can’t avoid the duplicate named range if there is already exist in the workbook.
    Base on my test, we can’t create the same named range through UI, but we can do it through the code.
    I suggest that you could delete the range in the target worksheet after copy a worksheet. (Name.Delete)
    # Names Object (Excel)
    http://msdn.microsoft.com/en-us/library/office/ff841280(v=office.15).aspx
    Best Regards
    Starain
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can i call a procedure from the app

    hi
    i have an establish connection to a database (MS SQL SERVER 2000) , i can get data from the tabels by sql statments.
    i have stored procedure in the database , how dan i run procedure with parameters from the app.
    lets say i have one procedure that takes one parameter "city_name"
    procedure delete_city ( @city_name char(100) )
    how can i run it
    thanks ahead
    johny

    Hi,
    Assuming con is the connection object:
    Assuming city_name is the name of the city to be passed to the stored proceduer
    Step 1: Create a callable statement object e.g. CallableStatement cs = con.preparecall("{delete_city(?)}");
    Step 2: Set the IN paramter of the stored procedure e.g. cs.setString(1, city_name);
    Step 3: Execute the callable statement e.g. ResultSet rs = cStat.executeQuery(); //assuming only one resultset is returned by your stored procedure
    Step 4: Process the resultset as you do for getting data from your other sql statements.
    This is a very basic way to execute a stored procedure. The complexity lies in executing stored procedures :
    1) which return a value
    2) which will result in multiple result sets
    3) having IN, OUT and INOUT parameters
    4) a combination of any or all of the above
    I would suggest you look up the JDBC API to get more details.
    Regards,
    bazooka

Maybe you are looking for

  • Month not showing on top left of calendar

    I have read several times that events show up in the Month view on iOS7 but they do not show on my iPhone 4. Neither is the month shown on the top left of the calendar. In the month view, the only thing at the top left is the year.

  • In case of a DB crash what happens to the status of the Control File

    When a DB is crashed will the Control file that exists in the OS also get corrupted, What happens to the Data Files , how to recover the Control files and Data Files , the DB in case there isn't any Backup media or any Dump available on the DB.

  • Running dead iMac from external SSD?

    After watching a video on how to install an SSD in my early 2008 iMac, I bought an external USB enclosure  and opted to simply boot off it, using my iMac's internal drive as a backup. This has worked great for more than a year. But last week, after 5

  • Ken Burns movie clips (not still photo)

    How can I apply ken burns to movie clips. I know that the ken burns button only appears when we edit still photos, not movie clips. Is there any method to achieve an effect similar to ken burns? Or at least remotely similar?

  • Mac book pro 13 boot issue

    I've been toying with my girl friends MacBook Pro  trying to fix it. She bought it in 2009.  The MBP does not seem to be reading the hard drive, it wouldn't even read the install disk and it took me about an hour to get that out. Finally after I remo