Testing a Transaction Suitable for TCD (Record)

You can use the SAPGUI command to test the same transactions that the TCD command can test. So why learn to use a second command? For those transactions that TCD can test, it is much more efficient to use TCD than SAPGUI (perhaps fifty times faster), which can make a considerable difference to the execution time, especially when the transaction is called repeatedly.

Procedure

       1.      Create a new test script using the following information:

Field

Entry

Title

Testing Transaction EC_TUTORIAL_TCD

Component

BC-TWB-TST-ECA

System Data Container

TUTORIAL_SDC

Recording the Transaction

       2.      Using the Pattern function, choose UI Control, TCD (Record). Choose the target system TARGET_1. Enter the transaction code  EC_TUTORIAL_TCD and accept the automatically generated interface name.

       3.      Choose icon to start the transaction.

       4.      Use the F4 help to enter an airline and a flight number then choose Displ. Flights.

       5.      Select a flight and choose Create Booking.

       6.      Use the F4 help to choose a customer number.

       7.      Change to the Passengers tab and enter a name, title, and date of birth for the passenger.

       8.      Choose Save.

The success message appears with the booking number.

       9.      Leave the transaction by choosing  the popup appears.

   10.      Choose Yes, then save your script.

Look at the command interface of the TCD command.

Here, you can see the screens of the transaction listed under the DYNPRO node.

Executing the Transaction

   11.      Execute the test script. choose the option Process in background in the TCD start options. Notice how much faster it executes than the similar transaction that you recorded earlier with SAPGUI command. Execute the test script again. This time, choose Process in Foreground. With this option, you can see interact with the transaction during execution.

Parameterizing the Command Interface

   12.      In the structure editor, expand the command interface to show the fields of the first screen.

   13.      Double-click the Fields node to display the fields for editing.

   14.      Replace the recorded values ‘LH’ and 0400 in the VALINcolumn with the parameter names I_AIRLINEand I_FLIGHT_NUMBER respectively. In the dialog box that appears after you choose Enter, make the parameters input parameters.

A field mode ‘S’ denotes that the field will be set with the value in the VALIN column.

   15.      In the structure editor, expand the node for the second screen.

   16.      Double-click the field node to display the fields for editing.

   17.      Change the mode of field [5] to ‘G’ (for get) and then enter the parameter name V_CITY_FROM in the VALIN column. When you run the test script, the actual value will be read into the parameter and be available for use elsewhere in the script.

   18.      Change the mode of field [6] to ‘C’ ( for check) and then enter the name V_AIRPORT_FROM in the VALIN column. When you create the parameter make it a local variable and make sure the default value is FRA. When you execute the script, the actual value will be checked against the value of the parameter. If the values are different, the script will fail. You can try this later either by changing the value of the parameter or by entering an airline that does not fly from the airport.

   19.      In the command editor, enter LOG ( V_CITY_FROM ).

This is only to demonstrate that the value read from the TCD command interface is available in the parameter for use by another command.

   20.      Save and execute the test script.

Summary

You have seen that you can use TCD to record a transaction, and replay it in background mode for fast execution.

You always use the VALIN column of the command interface to parameterize fields of the transaction. You need to make the field mode ‘S’, ‘G’, or ‘C’, if you want the parameterization to have the effect of setting, getting, or checking a value.