Page tree
Skip to end of metadata
Go to start of metadata

Parameterization for SAPGUI Scripts

There is no automatic parameterization of SAPGUI scripts as it is available for HTTP scripts, and for simple scripts this is not necessary either.

However, there may still be the need to extract values from a SAPGUI response into EEM variables and to use values from variables when filling input screens. The procedure how to do this is described in the following.

Extract Values from a SAPGUI Response

Responses of EEM messages can be processed in two different ways:

  • Checks allow to verify parts of the response and impact the result status of a script
  • Searches allow to extract values from the response into variables.
    For SAPGUI a specific SAPGUI search is available. However, this is currently not exposed in the EEM Editor for the message properties: It must be entered directly in the script XML file. For this purpose select the Source tab for a sapgui script. Find the right message and add a <Search> as shown below.
        <Message activated="true" id="8" method="sendVKey" name="4_sendVKey" type="ServerRequest" url="wnd[0]">
          <Param name="InvocationParam" value=" 8"/>
          <Search componentId="/app/con[0]/ses[0]/wnd[0]/usr/lbl[29,1]" name="" notfound="3" property="text" type="SAPGUI Property Substring">
            <Match instance="0" offset="0" variable="ContextId_0"/>
          </Search>
        </Message>
    
    The semantics of the attributes is as follows:
  • componentId the id of the UI element. You can derive it e.g. from a response check or from the component trace.
  • name keep empty
  • property property of the UI element, e.g. text, icon, tooltip
  • type the type of search, do not change. Only this type is currently available
  • Match/instance counter for the occurrance. Typically 0 for SAPGUI (first match)
  • Match/offset ignore
  • Match/variable name of the variable where to store the value

Save and switch back to the EEM tab in the editor. The column Search should now show an entry in the row of the corresponding message.

The SAPGUI search is available starting with LM-SERVICE 7.1 SP05

Use Variables for Input Fields

Similar to other script types you can use variables to fill input parameters for SAPGUI messages. The general syntax is {varx} to use the value of variable varx. Review the input parameters of a message (Message Properties > General / Parameters). Replace the actual value with a variable. Note that for SAPGUI the quotes must remain.

Example:
Original parameter:
Name = wnd0/usr/ctxtRS38L-NAME.text
Value = "XXX"

after replacing the value XXX with the value of variable varx:
Name = wnd0/usr/ctxtRS38L-NAME.text
Value = "{varx}"

Variables can be populated by searches (see above), by commands, or via configuration (Script Configuration -> Variables).

  • No labels