Recording the Transaction

Introduction

You will record the transaction EC_TUTORIAL_SAPGUI. This transaction has been written to include the active use of controls, such as the tree control, and is therefore not suitable for recording using the TCD command. The SAPGUI command is designed for just such a transaction. For simplicity, you will record the complete transaction although this is not a restriction of the SAPGUI command.

Normally, we recommend that you try out a transaction before recording it. You would then be able to assess which command is the best to use. Additionally, you would also reduce the number of false entries and thereby reduce the complexity of the resulting script. Here, just go ahead and record the transaction. If you make too many errors, simply delete all the resulting commands and try again (of course, eCATT offers more sophisticated ways of reworking a test script).

When you start the recording process, eCATT automatically opens a new session. You will therefore have two sessions open – the original eCATT session, which provides you with various functions to use during recording, and the session containing the transaction that you will record.

The Transaction

The transaction is based on the flight data model. You use the transaction to create a booking. The generated booking number is displayed in a message and also in a field of an ALV grid.

Preparation

Make sure that scripting is enabled on the front end and that the profile parameter sapgui/user_scripting is set to TRUE in both systems. In many systems, the default is FALSE and automatically reverts to this value when the system is restarted.

Close all sessions except for the one with the eCATT test script editor. This is not for technical reasons – you will be switching back and forward between the two sessions and it is easy to get confused if you have more sessions open.

Procedure

Starting the Recorder

       1.      In the test script editor, choose the Pattern function to display the Insert Statement dialog.

       2.      In the dialog, change the group to UI Control, choose SAPGUI (Record) for the command, accept the interface name, and select the target system TARGET_1.

The target systems that you can choose from are the same ones that are in the system data container that is referenced in the attributes of the test script.

       3.      In the following dialog, specify the transaction (EC_TUTORIAL_SAPGUI) that you want to record. Additionally, select the check box that will automatically generate a new SAPGUI command after every screen change (to do this, you must first deselect manual generation).

By selecting After Every Screen Change, you have chosen a particular recording granularity. However, granularity does not directly affect how much information is recorded. At one extreme, all the information can be recorded into one command with a large command interface, and at the other extreme, you can have multiple SAPGUI commands, each with a small command interface. In practice, the selection of the granularity at this stage is usually not critical because you can change it in the script later.

       4.      Choose Start Recording or Enter.

       5.      A new session is automatically created. You can, and should, switch back and forward between the two sessions using the taskbar as shown below. Try it now.

       6.      In the Record SAPGUI Command dialog, confirm that you want to record the new session.

       7.      In the session containing the test script, you will see a control panel similar to the following screenshot. Leave the settings as they are for the moment.

In the second session, you see the transaction to be recorded.

The Transaction

       8.      Expand the Flights tree and choose New Booking from the context menu of a flight date.

       9.      On the Cust. Details tab, use the F4 help to enter a customer number.

   10.      Change to the Passengers tab. You will see some information already entered.

   11.      Enter the following information.

Field

Entry

Class

First class

Name

Smith

Form of address

Mr

DOB

10.10.1970

It is essential to change the data in a field during recording if you want to be able to parameterize that field later when editing the test script.

   12.      Choose Save.

   13.      Confirm the booking.

   14.      The message Flight was booked successfully. Booking number <number> appears.

That is the end of the transaction.

Ending the Recording

   15.      Using the task bar, change to the session containing the test script.

   16.      Select the Close Recorded GUIs check box and then choose End Recording.

The recorded session closes and you now see the SAPGUI commands in the command editor of the test script editor. Above the command editor is the parameter list. You can use the button at the top left of this section to toggle between the display of normal parameters and the command interfaces.

   17.      Choose Save.

Result

You have recorded a transaction in a remote system.

You have created a test script in the central test system, which can be executed repeatedly using exactly the same values that you entered during recording.