BotreamDocs Website Türkçe v0.1.1

SAP commands

sap

sap SAP

SAP GUI for Windows through SAP GUI Scripting: sign in, run transactions, fill fields, press buttons, read tables and the status bar. Components are addressed by their id (wnd[0]/usr/ctxtVBAK-AUART), as Capture or SAP’s script recorder gives them.

Parameters of every variant

ParameterValueDefaultDescription
--sessiontextSAPSession name: given at logon/attach, used by the commands after it Names a sap session opened earlier.

Actions (--action)

--action:logon

Opens a connection of SAP Logon (started when it is not running) and signs in; the session gets the --session name.

ParameterValueDefaultDescription
--connection requiredtextThe connection as SAP Logon lists it, e.g. "PRD - Production"
--client requiredtextThe SAP client (Mandant), e.g. 100
--credential required$variable$A credential variable (set --type:credential) with the SAP user and password
--languagetextLogon language, e.g. EN or TR; the user’s default when empty
--multiplelogonone of continue, endothers, failcontinueWhen the user is already signed in elsewhere: continue (keep the other sessions), endothers or fail
--timeoutnumber60Seconds to wait for SAP Logon to start
--action:attach

Uses a session that is already open (signed in by hand or by single sign-on).

ParameterValueDefaultDescription
--connectiontextThe connection’s description (wildcards: PRD*); the first open connection when empty
--sessionindexnumber1Which window of the connection, 1 for the first
--action:starttransaction

Starts a transaction, e.g. VA01 (/n is added by SAP).

ParameterValueDefaultDescription
--transaction requiredtextTransaction code, e.g. VA01
--action:settext
ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--value requiredtextThe text to enter
--action:gettext
ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--output requiredvariable nameVariable that receives the result
--action:press

Presses a button, a toolbar button or a menu entry.

ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--action:select

Selects a radio button, a tab or a menu entry.

ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--action:setcheckbox
ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--value requiredtrue / falsetrue to tick, false to clear
--action:setcombo

Chooses an entry of a dropdown by its key or its text.

ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--value requiredtextKey or text of the entry
--action:sendkey

Presses a function key in a window: Enter, F1–F12, Shift+F1–F12, Ctrl+F1–F12, or Back, Exit, Cancel, Save, Execute.

ParameterValueDefaultDescription
--key requiredtextEnter, F8, Shift+F3, Back, Save, Execute… or a virtual key number
--windowtextwnd[0]The window: wnd[0] is the main window, wnd[1] a pop-up
--action:setfocus
ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--action:doubleclick

Double-clicks a component, or a cell of an ALV grid with --row and --column.

ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--rownumberGrid row, 0 for the first
--columntextGrid column name, e.g. VBELN
--action:selectrows

Selects rows of an ALV grid or a table control.

ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--rows requiredtextRow numbers, 0 for the first: "0,2,5" or a list variable
--action:exists

true when the component is on the screen.

ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--output requiredvariable nameVariable that receives the result
--action:getproperty
ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--property requiredtextA scripting property, e.g. Text, Tooltip, Changeable, Type, Name
--output requiredvariable nameVariable that receives the result
--action:gettable

Reads an ALV grid or a table control into a datatable (all rows, scrolling as needed).

ParameterValueDefaultDescription
--id requiredtextThe component id, e.g. wnd[0]/usr/ctxtVBAK-AUART (Capture: click it in SAP)
--maxrowsnumber10000Read at most this many rows
--output requiredvariable nameVariable that receives the result
--action:getstatusbar

The message at the bottom of the window as a record: Type (S success, W warning, E error, A abort, I info) and Text.

ParameterValueDefaultDescription
--failonerrortrue / falsefalseFail when the message is an error (E) or abort (A)
--outputvariable nameVariable that receives the result
--action:windowtitle
ParameterValueDefaultDescription
--windowtextwnd[0]The window: wnd[0] is the main window, wnd[1] a pop-up
--output requiredvariable nameVariable that receives the result
--action:logoff

Signs off and closes the connection (a session from attach is only forgotten).

No further parameters.

Examples

sap --action:logon --connection:"PRD - Production" --client:100 --credential:$sapUser$ --language:EN
sap --action:starttransaction --transaction:VA01
sap --action:settext --id:wnd[0]/usr/ctxtVBAK-AUART --value:OR
sap --action:sendkey --key:Enter
sap --action:gettable --id:wnd[0]/usr/cntlGRID1/shellcont/shell --output:rows
sap --action:getstatusbar --failonerror:true --output:status
sap --action:logoff
Botream 0.1.1 · Generated 2026-10-14