Extending Scripts with SAPGUI (Attach)

Use

When you have a test script that has been recorded with the SAPGUI commands, you may want extend the recording, replace existing sessions, or add new GETGUI or CHEGUI commands. The usual options when recording SAPGUI commands are available, such as using Insert GETGUI Command.

After activating attach mode you get a list of all the sessions that can be recorded. This list consists of all sessions on the local PC  where scripting is activated at the front and back end (with the exception of the eCATT session). You can select the sessions to be recorded. Multiple sessions can be recorded. The order in which the commands are entered is that in which you interact with the SAPGUI.

Here, we describe the normal case where you have one session open, the eCATT session. The execution of the test script opens a second session that stops at the point where you want to record new commands. One way to achieve this is by commenting out the remaining commands before execution.

Prerequisites

You have arranged for the script to stop at the point where the new recording should start.

Procedure

       1.      In the test script editor, choose Execute.

The Start Options appear.

       2.      In the Close GUIs field of the SAPGUI options, select O Do Not Close Created Sessions.

       3.      Choose Execute.

Another session opens where the script is replayed. The log (assuming Log Display was selected) is then displayed in the original session but the second session remains open.

       4.      In the log, choose Back to go to the test script editor.

       5.      Position the cursor where you want the SAPGUI commands to be entered.

       6.      Using the Pattern function, choose UI Control, SAPGUI (Attach) and accept the default value for the interface name.

       7.      In the Record SAPGUI dialog box, select how you want the commands to be generated (the granularity).

       8.      Choose Start Recording.

The Select Sessions dialog box appears.

       9.      In the Record field, select the session to be recorded. If necessary, correct the ConnectionId and SessionId.

   10.      Choose Continue.

   11.      In the other session, make your input. When you are finished return to the eCATT session and choose End Recording.

Result

...

The new SAPGUI, and possibly GETGUI and CHEGUI, commands are in the test script. The connection and session IDs in the newly recorded command interfaces are identical to those you entered in the Select Sessions dialog. If necessary edit the new command interfaces so that the connection and session IDs are the same as those in the other command interfaces in the script.

Tips

·        Before starting the recording, open the last command interface before the point where you intend to insert the new commands and note the values in ConnectionId and SessionID. When recording using SAPGUI (Attach) enter these values.

·        One way of stopping the execution of the script at the correct place is to set a breakpoint at the point where you intend to insert the new commands. Execute until the breakpoint, then use /nsecatt from within the debugger to start eCATT again, where you can then edit the test script and use SAPGUI (Attach).

·        You can split commands before specifying where the recording should begin.

·        You can also use SAPGUI (Attach) to record an existing GUI session. Again, be careful with the ConnectionIds and SessionIds.