|
Back to |
The TRANSACTION Script Commands allow you to edit the TRANSACTION scripts recording in the Mapper. See Editing a TRANSACTION script in the Mapper for more information.
You can also use the TRANSACTION script commands to pass these commands as parameters when you run a TRANSACTION scripts from the Command Line. See TRANSACTION and the command line for more information.
Each of the TRANSACTION Script Commands is described in this section.
Optional command.
When used, TRANSACTION closes after running the TRANSACTION scripts.
Example:
#AE
Optional command.
When used, When TRANSACTION is opened, it automatically runs your TRANSACTION scripts. The Run button is not required to execute processing.
Example:
#AR
Optional command.
When used, TRANSACTION automatically creates a backup copy of the current SAP data field's values.
Example:
#BD
Required command.
When used, specifies the Excel spreadsheet path and name.
Example:
#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.
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. |
Examples:
#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.
Example:
#S1Sheet2
Selects worksheet 2 in the specified Excel spreadsheet.
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. |
Examples:
#XS100
Saves the Excel spreadsheet after every 100th transaction run.
#XS0
Does not save the Excel spreadsheet; it must be saved manually.
#XSEND
Saves the Excel spreadsheet at the end of a run.
#XSEND,CLOSE
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.
#XS0,CLOSE
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.
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.
Example:
+FnRMMG1-MATNR
-FnMaterial Number
*Fv!A
Maps the Material Number to column A of the Excel spreadsheet.
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.
Example:
+FnEKKO-EKORG
*Fv?K
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>.
Optional command.
When used, TRANSACTION uses the auto logon file (ALF) specified in this command to logon to the SAP system.
Example:
#ALC:\MY DOCUMENTS\TRANSACTION\TestSystem.ALF
When running this TRANSACTION script, 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.
Examples:
+BI1
Runs the transaction in Batch Input mode [Default setting].
+BI0
Runs the transaction in Non-Batch Input mode. This is similar to running the transaction in GUI.
See Recording Modes for more information.
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.
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.
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>
...
+LOOP
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.
+DO WHILE A,H,L
'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
'----------------------------------------------------------------------------
+SpSAPMF05A
+Sn1200
-SpMain Screen for Single-Screen Transaction: Outgoing Invoice
+FnBDC_OKCODE
?
-FnOK Code for this screen
+Fv=0005
+FnACGL_ITEM-HKONT(01)
-FnGeneral ledger account
@Fv!C
+FnACGL_ITEM-WRBTR(01)
-FnAmount in document currency
@Fv!F
+FnACGL_ITEM-MWSKZ(01)
-FnTax
@Fv!G
+FnACGL_ITEM-MARKSP(01)
+FvX
+LOOP
'End do while loop here..
'----------------------------------------------------------------------------
+SpSAPMF05A
+Sn1200
-SpMain Screen for Single-Screen Transaction: Outgoing Invoice
+FnBDC_OKCODE
-FnOK Code for this screen
+Fv=BU
'----------------------------------------------------------------------------
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 |
|
Header row |
|
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.
|
Retrieves the extended log and writes it as a comment in each log cell in Excel. |
|
Retrieves the extended log and writes it in the specified Excel column or table field in an Access database. |
Example:
+EL
+EL!G
Writes the Extended Log in column G of the Excel spreadsheet.
+EL!MaterialMaster.ExtendedLog
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
Example:
"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.
&EndSession:<number>
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 available.
Example:
+FnRMMG1-WERKS
(WERKS = Plant)
Required command.
Use the +Fv command to specify a fixed value for a certain field. This command must follow the +Fn command.
Example:
+FnRMMG1-WERKS (WERKS = Plant)
+Fv0001
Assigns a fixed value of 0001 to the Plant field for the current transaction.
Optional command.
This text is displayed as the title when you open your TRANSACTION scripts.
Example:
+ HtTRANSACTION for Tcode MM02
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 Launch GUI option is available on the Run screen to facilitate the processing of these types of transactions. Selecting the Launch 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.
Example:
+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.
Example:
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.
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.
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.
Example:
+RTRequired fix to Material Group as requested by Steve.
Optional command.
This command causes TRANSACTION to stop executing transaction calls after nnn transactions.
Example:
+SA100
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.
Example:
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):
+SF\
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.
Example:
+Sn0060
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.
Example:
+SpSAPLMGMM
Optional command.
When used, the default value of 2 for the Start Row field is changed to the value stated in this command.
Example:
+SR7
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.
Example:
+TxMM02
Also in this section |