15 Processing multiple transactions in one script You want to create a simple user interface for a certain task that, in SAP standard, requires 2 or more different transactions. For example, you implement a “Create customer” form that fits on one screen, covering both the data for transaction XD01 (create new customer) and for transaction FD32 (credit control data). Problems:

the second transaction needs to wait until the first one is completed (because of the asynchronous updating in SAP system)

the system-generated key (e.g. the customer number) of the first transaction is needed to perform the second one (unless external number assignment is used for the customer group)

if the second transaction cannot be completed (wrong input values), there might be no way to undo the first transaction. So, for example, the customer is created, but the credit data is not yet set.

To solve the first issue, use the “Retry on error” command.

To solve the second one, there are 3 possibilities:

Sometimes the SAP system already sets the key of the new object automatically in the first screen of the second transaction (this is the case for XD01 and then FD32)

Or you use the Search=… option of the Set command to get the key from the message text “&V[_message]“, after the update (as shown below in our example)

Or you first call the corresponding “Change” transaction (in our example XD02), where SAP almost always sets the new key automatically. You pick up the key from the screen and then go to the transaction you really want to perform (e.g. FD32).

To solve the 3rd issue, you can check all data in the InputScript before you start the first transaction. But in many cases a complete check will not be possible. An alternative approach is then: display the error message, let the user correct the values, and then perform the 2nd transaction alone, skipping the first one in the InputScript. We will cover this issue separately in our “Special topics”.