Run a Query solution from the command line - Automate_Studio - Latest

Automate Studio with Evolve User Guide

Product type
Product family
Automate > Automate Studio
Product name
Automate Studio
Automate Studio with Evolve User Guide
Topic type
How Do I
First publish date

All commands that run at the command prompt take precedence over the same commands that are already contained in the Query file.


To ensure that the log messages are saved, set the Excel save option to Save at end of run.

You can run a Query script from the command line using this syntax (note that this works even if the data file does not exist):

"Automate.Studio.Console.exe full path" -SapQuery -run"<Query solution name>” -lib"Qxq lib" -tms"MY App"


This command requires "Automate.Studio.Console.exe full path" to be enclosed in double quotes. In addition, ensure that there is a single space between "Automate.Studio.Console.exe full path" and "Query solution name".

Example 1: Note that this applies to solutions run locally. If you want to execute Sample.qsq in the default location at C:\MyDocuments\Automate\Studio\Script\, the command line syntax is:

"C:\Program Files\Automate\Studio\Automate.Studio.Console.exe" -SapQuery -run"C:\MyDocuments\Automate\Studio\Script\Sample.qsq"

This command launches Studio with the Sample.qsq file loaded and starts executing the Query script. You can test this command line operation by running this command in the Windows Run dialog box.

Note: Example 2:  Note that this applies to solutions run from Evolve. The command line syntax is: 
Note: “C:\Program Files\Automate\Studio\Automate.Studio.Console.exe" -SapQuery -run"Sample" -rfn"C:\Users\msharma\Documents\Automate\Studio\Data\Sample.xlsx" -cnn"W6R Non Prod" -lib"Query lib" -tms"Ms App" -dsr"2" -der"0" -rsn"Test Run reason" -eml"" -arf"True" -dsw"True" -irr"True"

Command reference

The Query Script Commands allow you to edit the Transaction scripts recording in the Mapper.


If email settings have not been added to the Evolve site and you specify the -eml (email) parameter in the command, you will receive a warning message.

Parameter Description Example
-drs Set the run sheet



AP connection name


-lib Library name -lib"Query lib"
-scn SQL connection name -scn”SQl1001”
-tms Teamspace name -tms"Ms App"


Attach the data file with the posting results



Disable the production server warning



Result file name



Send notification email on schedule confirmation



If run reason is required or not



Run reason

-rsn"This is a demo run"


Start Row



Save to Evolve



SQL logon file



SAP system name






Run time variables


To note for technical writers: All of the hidden text below was deleted in July 2018, per Joshua Whitener of Customer Support. Retaining in case it again becomes relevant.


Optional command.

When used, Transaction closes after running the Transaction scripts.




Optional command.

When used, When Transaction is opened, it automatically runs your Transaction scripts. The Run button is not required to execute processing.




Optional command.

When used, Transaction automatically create a backup copy of the current SAP data fields values.




Required command.

When used, specifies the Excel spreadsheet path and name.


#F1C:\My Documents\Change MRP Controller.xls


Required command.

When used, Transaction maintains the transaction log in the specified column of the selected Excel worksheet. Storing SAP data and returned messages in the same Excel worksheet allows you to view the processing results in one common place.

NOTE: Make sure the specified column on the worksheet is blank. Otherwise, Transaction overwrites any data contained in the column with the returned SAP messages. The spreadsheet is saved automatically when Transaction completes execution.



Maintains the transaction log in column G of the selected Excel worksheet.

#NTNext linked

Transaction scripts with complete path [,nCarryonSettings]

Optional command.

Use the #NT command to launch another (next) Transaction scripts after the current one finishes running.

nCarryonSettings could be:

0 [Default Value] Do not carry on settings (Excel spreadsheet name, sheet name, start row, and end row) from current Transaction scripts.

1 Carry over the settings from the current Transaction scripts.


#NTC:\My Documents\TRANSACTIONscript\ME01.TRANSACTIONscript

When Run is selected, Transaction launches ME01.TRANSACTIONscript after the current Transaction Scripts completes execution.

#NTC:\My Documents\TRANSACTIONscript\ME01.TRANSACTIONscript,1

The statement ignores the Excel filename, sheet name, start row, and end row values specified in the ME01.TRANSACTIONscript. Instead, Transaction carries these values over from Transaction scripts currently open.

Key Points:

Only one Transaction scripts can be linked to the current Transaction scripts. For example, if the current Transaction scripts is MM01.TRANSACTIONscript, the ME01.TRANSACTIONscript can be linked to this file. However, when linking ME01.TRANSACTIONscript and ME11.TRANSACTIONscript, TRANSACTION gives you a syntax error that must be fixed before running the TRANSACTION Scripts.

Any number of TRANSACTION scripts can be chained. For example, MM01.TRANSACTIONscript can point to ME11.TRANSACTIONscript, which in turn can point to ME01.TRANSACTIONscript, and so on. TRANSACTION first runs MM01.TRANSACTIONscript, then ME11.TRANSACTIONscript, and ME01.TRANSACTIONscript.

The current TRANSACTION scripts cannot be linked to itself. There is no check to prevent indirect linking. For example, suppose MM01.TRANSACTIONscript links to ME01.TRANSACTIONscript, which links to ME11.TRANSACTIONscript, and ME11.TRANSACTIONscript links back to MM01.TRANSACTIONscript. This creates an infinite loop that causes TRANSACTION to continue until it is stopped manually.

A copy of the current TRANSACTION scripts can be linked to the original TRANSACTION Scripts. For example, suppose the links start with PA40.TRANSACTION script. The TRANSACTION Scripts can call PA40-1.TRANSACTION script, which in turn calls PA40-2.TRANSACTION script, and so on.

The linked TRANSACTION scripts starts only after all the records of the current TRANSACTION Scripts are processed.

The linked TRANSACTION scripts AutoLogon (ALF file) information is ignored. All linked TRANSACTION scripts use the SAP log on session of the current TRANSACTION scripts. In other words, only the original TRANSACTION Scripts can log on to SAP. All subsequent TRANSACTION scripts use the same SAP session.

All linked TRANSACTION scripts can use the same Excel spreadsheet or different spreadsheets. They can even use the same worksheet within one Excel spreadsheet or use a different worksheet. Ideally, the same worksheet should be used in order to allow the log to be compared and reused after parsing it in Excel.

TRANSACTION displays last linked TRANSACTION scripts when it finishes running all linked TRANSACTION scripts. In other words, it does not reload the original TRANSACTION scripts that started the chain.

The log file indicates linked TRANSACTION scripts run activity.

If the path of the next TRANSACTION script is left blank and only a filename is specified, TRANSACTION looks for the next TRANSACTION Scripts in the current TRANSACTION scripts path.


Optional command.

The default is Sheet1. If there's only one worksheet in the Excel spreadsheet, TRANSACTION selects it automatically. If there is more than one worksheet in the Excel spreadsheet, specify which worksheet (Sheet#) is to be used.



Selects worksheet 2 in the specified Excel spreadsheet.

#XS{ 0 | nnnnn | End } , [CLOSE]

Optional command.

This command controls how TRANSACTION saves and closes the Excel spreadsheet during and after each run.

#XS0 Indicates that TRANSACTION does not save the Excel spreadsheet at the end of a run. In this case, the Excel spreadsheet must be saved manually or any changes are lost, including the log messages returned by SAP. This subcommand is useful when there are multiple sessions of TRANSACTION running on the same Excel spreadsheet and only one of those Excel spreadsheets needs to be saved.

#XSnnnnn Prompts TRANSACTION to save the Excel spreadsheet after every nnnnn transactions

#XSEnd Saves the Excel spreadsheet at the end of a run. #XSEnd is the default value, unless otherwise specified.

CLOSE If CLOSE is included with any of these subcommands, TRANSACTION closes Excel after each run. When the CLOSE subcommand is issued and the Excel session has files to be saved, Excel prompts you to save the files before closing.



Saves the Excel spreadsheet after every 100th transaction run.


Does not save the Excel spreadsheet; it must be saved manually.


Saves the Excel spreadsheet at the end of a run.


Saves the Excel spreadsheet at the end of a run and then closes Excel. If Excel has any files to be saved, the user is prompted to save the files before closing.


Does not save the Excel spreadsheet during the run. Once the run is finished, TRANSACTION attempts to close Excel. Excel prompts the user to save the file before closing.

*Fv!FieldValue (read value from the spreadsheet column)

Optional command.

This command is used to map data values stored in the spreadsheet to SAP. The *FV command must always follow the +Fn command.



-FnMaterial Number


Maps the Material Number to column A of the Excel spreadsheet.

*Fv?<Excel receiver column ID>

Optional command.

TRANSACTION can download (read) data from SAP. This command allows you to assign a column for the SAP fields being downloaded.

Recommendation: Use the Mapper to assign Read From SAP values and avoid manual changes to the TRANSACTION scripts, unless required..




Shows the SAP field EKKO-EKORG is read from SAP and added to column K in the Excel spreadsheet.

Key Points:

This command is available only for SAP release 4.6 and higher.

Assign columns with no data as receiver columns. TRANSACTION does not check if there are any values present in the assigned Excel receiver column. It overwrites all values in the receiver columns, even when no value from SAP is returned.

TRANSACTION does not format the Excel receiver column. The Excel column must be formatted to appropriate data types before running the TRANSACTION scripts. For example, if the column is not formatted as Text and a value of 004 is assigned to that column, Excel converts this value to 4. In order to retain the value of 004, format that column as Text before the run.

This command requires additional authorization in SAP.

TRANSACTION may run a little slower when this command is run. For this reason, use this command only when required. If the TRANSACTION scripts does not have any fields marked as Read From SAP, TRANSACTION automatically switches back to update only mode.

NOTE: This command works the same way for an Access database. Simply substitute <Access receiver field name> for <Excel receiver column ID>.

+ALautologin file.ALF

Optional command.

When used, TRANSACTION uses the auto logon file (ALF) specified in this command to logon to the SAP system.



When running this TRANSACTION Scripts, TRANSACTION uses the logon information stored in TestSystem.ALF file. As a result, it does not prompt for a logon.


Optional command.

This command controls how a transaction is run.



Runs the transaction in Batch Input mode [Default setting].


Runs the transaction in Non-Batch Input mode. This is similar to running the transaction in GUI.

See Recording Modes for more information.

+DBnnnnnn (Delay before SAP log on)

Optional command.

This command delays the log on to SAP by nnnnnn milliseconds. Use this command to maintain the delay between various TRANSACTION sessions such as when the Scheduler cannot schedule sessions less than one minute apart, and sessions must be launched within that time frame. See Scheduling runs for more information.

This TRANSACTION script command can be passed from the command line as a parameter. If this is done, the command line parameters take precedence over the values specified in the TRANSACTION Scripts.

+DLnnnnnn (Delay between transaction run)

Optional command.

This command delays the calls to SAP between transactions by nnnnnn milliseconds. This command can be used to slow down the processing of the TRANSACTION scripts.

+Do-While Loop

Optional command.

This command provides a Do...While Loop mechanism for processing multiline transactions. TRANSACTION enters the Do...While Loop when the specified condition is met. Normally, this condition is determined dynamically. Fixed value <Check value> is compared against the value in the Excel column as indicated by <Excel identifier column id>.

Recommendation: Use the Mapper to manage your Do-While Loop and avoid manual changes.

Example 1:

+Do While <A:Excel record type identifier column ID>,<H:Header identifier string>,<L:Line Item identifier string>


*Fv!<Excel column id>


@Fv!<Excel column id>


+Fv<Fixed Value>


*Fv!<Excel column id>


+Fv<Fixed Vale>



Example 2:

This example shows that column A in Excel has item records for looping as identified with character D in that column. TRANSACTION loops through all of the rows in Excel spreadsheet, while the value of column A for that row is filled with D.


'Start Do While loop from next line, Row Identifier is stored in Excel column A, value of "H" indicates Header row while value of "L" indicates line item row




-SpMain Screen for Single-Screen Transaction: Outgoing Invoice



-FnOK Code for this screen




-FnGeneral ledger account




-FnAmount in document currency











'End do while loop here..




-SpMain Screen for Single-Screen Transaction: Outgoing Invoice


-FnOK Code for this screen



Key Points:

There must be separate Header and Line Item (detail) rows in Excel. There can be only one Header record, followed by one or more line item records.

Header and Line Item records should be clearly marked in the identifier Excel column. TRANSACTION ignores the case, while validating the Excel identifier value for Header or Line Item rows. Also, the loop row cannot contain data for Header. However, Header information can be used in each Line Item.

TRANSACTION starts building the transaction from the row identified as a Header. If a value other than H or D is encountered, TRANSACTION skips all rows until it finds the next Header row.

Do not leave an empty row between Line Item records.

While using the Do...While Loop, avoid making unnecessary key fields. (Skip the transaction if empty or *FV#<Column ID>). TRANSACTION uses the row type identifier column as the key column. If this column is left blank in any of the rows, TRANSACTION ignores the entire row and continue to the next record.

Key field (skip row, if value in Excel is empty for the field) has priority over Header/Line Item row types during the Do...While Loop. In other words, TRANSACTION first checks whether the row is selectable based on the key field settings. Then it performs validation based on the row type for Do...While Loop processing. If the row is skipped due to key field validation, it is not used as part of Do...While Loop processing.

NOTE: Do not mark any of the fields used inside the Do-While Loop as a key field. If any of the fields inside the Do...While Loop is marked as a key field, there can be unexpected results.

If you want to use incremental Excel rows, use identifier @ instead of + or * while inside the Do...While loop. The chart below shows which row in Excel is used to retrieve the data.

TRANSACTION script element falling between Do While Loop statement Read from

*Fv!<Excel column ID> or *Fv#<Excel column ID> (Value from Excel) Header row

@Fv!<Excel column ID> (Value from Excel) Corresponding loop row

NOTE: This command works the same way for an Access database. Simply substitute <Access field name> for <Excel column ID>.

See also Handling Multiline Transactions.


Optional command.

This command allows users to retrieve extended log information for a transaction. Extended log information includes the complete message stack for a transaction that is run in SAP.

+EL Retrieves the extended log and writes it as a comment in each log cell in Excel.

+EL!ExtendedLogColumn/+EL!Table.Field Retrieves the extended log and writes it in the specified Excel column or table field in an Access database.




Writes the Extended Log in column G of the Excel spreadsheet.


Writes the Extended Log in the Extended Log field of the Material Master table in the Access database.


Optional command.

When used, this command logs Extended Messages returned from SAP. Normally, TRANSACTION stores only the SAP message text. This text is placed in the assigned log column. However, the Message Type (E, I, S, and so on), Message No., and Message ID can be specified in the TRANSACTION Scripts.

The returned message includes these fields in the order shown below:

Message Type:Message ID - Message No - Message Text


"Selection criteria have been saved"

Message without +EM command (above).

"S:F4-431-Selection criteria have been saved"

Same message with +EM command, where S is Message Type, F4 is Message ID, 431 is Message Number, and the remainder is the actual Message Text.


Optional command.

For ML81N and other transactions, the service entry sheets are created for the first purchasing document, the header item, but the subsequent purchase documents error out. The EndSession command resets the SAP session after each run.


Number specifies the number of transactions or rows after which the SAP session must reset.


Required command.

This command must follow the +Sn command. Each Screen Number (+Sn) may have more than one field to available.



(WERKS = Plant)

+FvFieldValue (Fixed)

Required command.

Use the +Fv command to specify a fixed value for a certain field. This command must follow the +Fn command.




Assigns a fixed value of 0001 to the Plant field for the current transaction.

+HTHeader Text

Optional command.

This text is displayed as the title when you open your TRANSACTION scripts.


+ HtTRANSACTION for Tcode MM02


Optional command.

This command controls the condition for uploading data into SAP. The syntax of the condition parameter is:

Excel column id =, >, <, <=, >=, <>, {Starts_With}, {Contains}, {Ends_With} a Constant value

The left side of the operator above is the Excel column that is to be checked against the constant value on the right side. When the file containing an +IF condition is run, it executes only the Excel rows for which the specified condition is true.



Uploads only those Excel rows with 08/08/2004 in Excel column AH to SAP.

+IF!A{Starts_With} K

Processes only those Excel rows that contain data beginning with letter K in Excel column A.


Optional command.

This command launches SAP GUI while running the TRANSACTION scripts. TRANSACTION requires SAP GUI to be launched for certain types of transactions, such as file input/output dialog boxes, report generation, uploading files (images, PDF....), many HR transactions, and so on.

The Start SAP GUI option is available on the Run tab to facilitate the processing of these types of transactions. Selecting the Start SAP GUI check box activates the +LG command. Leaving the check box blank deactivates the +LG command.

Recommendation: Do not select this option, unless absolutely needed, as it may slow processing.

NOTE: If the following error message is displayed: "Protocol error when communicating with SAP GUI", the Launch GUI flag can be enabled to resolve the issue.


Optional command.

This command translates characters in Excel from Unicode to native SAP language format such as Shift-JIS. It is useful when entering data in Unicode into non-Unicode SAP systems. In this case, insert the +MB1 command before the +Tx command in the Editor. In Excel, insert the language code in the first cell of each column to be translated.


+MB 1000

For example, to upload Material descriptions in Japanese from column A in Excel, in the editor, specify +MB100 and, specify *DB982, which is the code page for Japanese, in cell A1000.


Optional command.

The Message Transformation (MT) command customizes log messages stored in the Excel spreadsheet. This command can be used to change a message such as to simplify the message and make the log more meaningful. For example, change the "No batch input data for screen RFEPOS00 0100" to "Record not found".

Translating a certain message requires the proper Message ID and Message Number. Use the +EM command to obtain the Message Type, Message ID, and Message Number in sequence. The Message Type is not required for the MT command.


This example uses the "No batch input data for screen RFEPOS00 0100" error message. With the +EM command turned on, this expanded message is received:

"S:00-344-No batch input data for screen RFEPOS00 0110"

Where S is Message Type, 00 is Message ID, 344 is Message Number, and the rest is the actual text returned by SAP.

Then use the +MT command to change the text:

+MT00-344=Record Not Found

When TRANSACTION encounters Message 00-344, it replaces the SAP text with the text specified above in the +MT command.

+NE[encrypted password]

Optional command.

Use the NE (No Edit) command to prompt for the password each time a user attempts to change any mapping information and run the TRANSACTION scripts.


Optional command.

Use the RE (Run on Errors) command to run the script even when errors appear.


Optional command.

When used, TRANSACTION helps the user to ensure that the data file (Microsoft Excel or Microsoft Access) for the run has not been used previously.

+RS (Global Read SAP option)

Optional command.

This command sends any transaction field read requests to SAP.

+RS1 Send the Read request to SAP.

+RS0 Do not send the Read request to SAP.

Key Points:

This option is available only for SAP release 4.6 or higher.

If you do not have any field mapped to Read From SAP, TRANSACTION disables this command. If any field is marked for Read From SAP later, this command is enabled, allowing it to be selected and deselected.

See "*Fv?<Excel receiver column ID> for more information.



Optional command.

This command adds a text record to the log file containing the reason for a particular run.


+RTRequired fix to Material Group as requested by Steve.

+SAnnn: StopAfter Transaction nnn

Optional command.

This command causes TRANSACTION to stop executing transaction calls after nnn transactions.



TRANSACTION runs only 100 transactions.



Optional command.

This command specifies a certain character as the Skip Field indicator. When TRANSACTION encounters the Skip Field indicator (character) in an Excel spreadsheet, it does not update that field in SAP.


Suppose an update is required for the Material Group (among other fields) for all materials, with the exception of a selected few. Use the +SF command in the TRANSACTION Scripts to specify the Skip Field indicator (character):


Where \ is our Skip Field indicator.

In addition, modify the Excel spreadsheet by inserting \ in the Material Group column for all rows where an update is not required.

Key Points:

Comparison is not case sensitive. For instance, if +SFbaddata is specified in TRANSACTION scripts and Excel column contains value of BADdata or BADDATA, this field is skipped (the update does not occur).

The Skip Field indicator is global for the TRANSACTION Scripts. Once specified in the TRANSACTION scripts, it applies to all mapped fields. When the value from Excel is read for any field, it is first compared against the Skip Field indicator before it is sent to SAP.

See also Skip Field indicator.



Required command.

This command specifies the Screen Number and it must follow the +Sp command. The command must always have a corresponding +Sp command.




Required command.

A transaction is divided into several screen programs, which are called in a pre-defined sequence. Generally, more than one +Sp command is used.





Optional command.

When used, the default value of 2 for the Start Row field is changed to the value stated in this command.



First six lines of the selected sheet are ignored and processing begins from the seventh row.



Required command.

This command specifies the transaction code for the TRANSACTION scripts. There can be only one transaction in the TRANSACTION scripts.