Skip to Content

The following approach is not specific to single test automation tools but applies for most tools in the market like CBTA, eCATT and HP QTP/ HP UFT.

Typical situation when working with dynamic screens

Some transactions like ME51N Create Purchase Requisition remember the state from the last usage of the transaction in the user context. So the start screen in the transaction can have collapsed screen elements

/wp-content/uploads/2014/08/collapsed_524677.jpg

or the screen elements could be expanded

/wp-content/uploads/2014/08/expanded_524684.jpg

Challenge 1:

You perform a recording for an automated test while all required screen elements are already expanded. When you execute the test script later it might fail because some of the required screen elements can’t be processed as they are not visible. This could happen if same user left the transaction during the last usage in a different state or you are executing the script with a different user or even in a different system.

Challenge 2:

You perform the recording when the required screen element is initially not visible so you record the click on the button that expands it. When you replay the script most likely fails because the initial screen state is now expanded and the related button was replaced by the collapse button (e.g. ME51N).

Recommended Approach:

Before recording:

  1. Check which screen elements are required and get a clear picture of the initial screen state that is required to perform the actual test activities.
  2. Check for shortcuts to prepare the screen to always get to the right state (e.g. to expand the required screen elements). Most times you’ll find the shortcuts with mouse over text for the button (with ME51N) or context menu of right mouse click (ME21N)
    /wp-content/uploads/2014/08/find_shortcut_524717.jpg

During recording:

Shortcuts (e.g. Crtl+F2 and Crtl+F3) should be processed although the necessary screen elements are already expanded to ensure these actions are part of the script.

Result:

The recorded script will always ensure that the screen is prepared to meet the expected state and then is able to perform the actual test activities independent from last usage or user context.

To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

  1. Sonal Kumar

    Great blog Reiner!

    I would also like to add sometimes such kind of situation can also be handled using If-else construct. Such constructs is already present in CBTA – component based test automation.

    (0) 
  2. Rémi GODARD

    Hello Reiner,

    This is a very smart trick which I had not thought of, thanks for the tip!

    You may already know that SAP has developed custom function patterns, and in particular one which expands all sections of ME2xN and ME5xN transactions.

    See this document from SAP Marketplace (S-user required):

    http://service.sap.com/~sapidb/011000358700000194862014E.PDF

    To use this pattern, all you need to do is:

    – Check-out the RTL

    – Create a new function using the “Code Assistant” button, and select ME21N_ExpandAllSections

    => The corresponding function will be created in a new .vbs file

    – Insert the default component CBTA_GUI_A_INVOKE_FUNCTION at the beginning of your script (usually in second position – after the component CBTA_GUI_A_CHECKTCODE), and call this function

    One step further is to make sure that the tab you are about to fill is already visible – or better, to force to open it first (when you record your script).

    Kind regards,

    Rémi.

    (0) 
    1. Reiner Markheiser Post author

      Hello Remi,

      I was contacted for the same kind of problem in transaction MIGO. There are no shortcuts available here and so indeed the use of a custom function is required.

      It is possible to use ME21N_ExpandAllSections as pattern and replace the URI information accordingly in the .vbs file.

      Regards Reiner

      (0) 
      1. Deepanker Mahajan

        Hello,

        I am working on CBTA for the recording of the scenarios on the SAP portal.

        I am able to record and execute the simple scenarios.

        But in few cases the recording which I have done on the Portal and when I am trying to execute the recorded scenario again then the values are not getting mapped correctly on the Portal.

        Please let me know how to handle this case.

        Thank you in advance to unblock me.

        Deepanker Mahajan

        (0) 
  3. Ashishkumar Banker

    Hello Reiner,

    Very nice document.

    I am looking for similar kind of issue.

    I had tried to resolved similar issue for ME21N for hear detail ( Ctrl+F2) and Item detail, with the addition of default component “CBTA_GUI_A_PRESSKEY” with URI of Hear detail and KEY as Ctrl+F2, but it not work.

    But will try to add shortcut key ( Ctrl+F) in recording itself.

    However just want to ask is there any other alternative for similar kind of issue which we can resolve by adding default component like ( IF, ENDIF, CBTA_GUI_A_PRESSKEY etc.) then please let me know and if any document is available that will be good.

    Regards,

    Ashish

    (0) 
    1. Reiner Markheiser Post author

      Hi Ashish,

      I’m not sure if I fully  understand the issue, but you might check the following document that provides advanced options on how to solve similar and even more complex situations while using custom code patterns that are shipped with the software and can be easily adopted to your individual situation (e.g.replacing the URI).

      https://support.sap.com/content/dam/library/SAP%20Support%20Portal/support-programs-services/solution-manager/processes/Media%20Library/Test%20Management/CBTA%203.0%20SP05%20-%20Custom%20Code%20Patterns%20-%20CBASE%20Customization.pdf

      Let me know if this fits to your issue.

      Regards Reiner

      (0) 
  4. Andres Vasco

    Hello, guys

    I have automated many TCE using CBTA, but I am facing some challenges to reuse some transactions,

    for example: there are transactions that were recorded in 2016 and now in 2017 they bring many new warning messages, those messages did not appear when we recorded for first time and making the adaptation of the script takes a lot of time consuming and i think they could apply as Dynamic sap gui

    what is the best way to make a recording considering the warning messages in CBTA?

    (0) 

Leave a Reply