InputScript for several SAP modes: In an InputScript I open a new SAP mode and continue with the first screen of the new transaction:
...
Screen SAPLCPDI.1400

  Enter "/OMM02"

Screen SAPLMGMM.0060

  Set F[Material] "&[MAT]"

  Enter

Screen SAPLMGMM.4004
..

This does not work; the InputScript is not continued in the new mode. What is wrong with my script?

You need two InputScripts. Specify the second InputScript in the Enter "/O..." command and pass all values that are required in the second mode as parameters:

Enter "/OMM02" process="material_change.txt"

   using MATNR =   "&V[MAT]"

Second InputScript "Material_change.txt":

Parameter MATNR

Screen SAPLMGMM.0060

  Set F[Material] "&U[MATNR]"

  Enter

Screen SAPLMGMM.4004

....

One InputScript always covers one SAP mode only.