We use the F871, F872 and F873 transactions for creating, modifying or displaying payment requests. These transactions use the same screens and the same GuiXT scripts. In order to differentiate, we test the transaction code:
if Q[Transaction=F871] // Display
But in the display transaction (F873) it is possible to change to modification mode using a button. This doesn't change the transaction code. We would need a means to detect modification mode, because in this mode the script should behave as if transaction F872 were active. What can we do?

If the transaction code is not sufficient, you can either use

if Q[Status=...]

Look at the GUI status with "System->Status". Normally the SAP application uses two different GUI statuses to distinguish between display and change mode.

Alternatively, you can choose a certain field on the screen, e.g. the field [Price], and determine whether it is an input field or just read-only. Use the syntax

if I[Price]

This condition is fulfilled only if there is an input field [Price] on the screen, i.e.

I[Price] does not pertain if [Price] is a read-only field.