Command line tool

"Shortcut for SAP systems" comes with a command line tool. You can use the provided program Sc4SAPCmd.exe to execute most of the functions in a one-line expression. It enables you to use the functions of "Shortcut for SAP systems" in automation software (this covers the range from simple tools such as the Windows Task Scheduler to complex automation applications such as Automic Automation (former UC4), ActiveBatch etc.). The function will be executed outside of the GUI application.

Possible use cases:

  • create a daily backup of some important system specific data, e.g. RFC connections ("Process table data using R3trans").
  • Use the "Process table data using R3trans" function to export system specific tables in front of a system copy and restore them after the system copy.
  • distribute specific users (e.g. admin users) to any system with the "Copy user" function".
  • Set the passwords of system users after a system copy using the "Set password" function.
  • Ensure the availability of emergency users on your systems (they could be locked due to too many invalid login attempts) using the "Unlock user" function, scheduled periodically, for example every 10 minutes.
  • Use the "Unlock user" function within a user self-service to unlock own user ID or for assignment of roles within a workflow system (see chapter "Using XML files").


You can use a "Variant" or an XML file.

Using "Variants"


  1. Save a "Variant" of the function that you want to use with the command line tool.
  2. Execute Sc4SAPCmd.exe with the function name as the 1st and the variant name as the 2nd parameter.


Example: lock users automatically in an automated process of a system copy and unlock them afterwards. For this you need the function "Lock user" and "Unlock user". Specify the users to be locked with the "Lock user" function (you can also specify users that have to remain as unlocked and lock all other ones) and save a variant, for example "Userlock Syscopy QX1".

Do the same with the "Unlock user" function.


Then call the Sc4SAP command line tool in your automation software as following:

Sc4SAPCmd.exe lockuser "Userlock Syscopy QX1"

resp.

Sc4SAPCmd.exe unlockuser "Userlock Syscopy QX1"


Find here a list of the function names (to be given as 1st parameter):

1st parameter for command line tool (case insensitive)

Function

UNLOCKUSER (or UNLOCK)

Unlock user

LOCKUSER (or LOCK)

Lock user

SETPASSWORD (or SETPASS)

Set password

COPYUSER (or COPYU)

Copy user

CREATEUSER (or CREAU)

Create user

ADDREMOVEROLEPROFILE (or AUTH)

Add/remove a role and/or profile

ADDREMOVEHIDDENAUTHS (or HIDAUTH)

Add/remove hidden authorizations

VIEWTABLEDATA (or TABLEDATA)

View table data

You can give a 3rd parameter specifying a file where the read data is to be stored. If the filename ends with '.csv', a comma-separated file with column information will be created. With other endings of the filename the raw data without column information will be written into the file.

UPDATETABLEDATA (or UPDDATA)

Update table data

DELETETABLEDATA (or DELDATA)

Delete table data

DOWNLOADUPLOADTABLEDATA (or DLULDATA)

Download / upload table data

PROCESSDATAWITHR3TRANS (or R3TRANS)

Process table data using R3trans

INSERTPROGRAM (or INSPGM)

Insert / modify program
In case you have set the flag for "Execute immediately" in the variant, you can give a 3rd parameter specifying a file where the output of the executed program is to be stored.

EXECPROGRAM (or EXECPGM)

Execute a program

You can give a 3rd parameter specifying a file where the output of the executed program is to be stored.

DOWNLOADUPLOADSERVERFILE (or DLULFILE)

Download / upload server file

?  
help

Shows information for the use of the command line tool


Using XML files


With XML files using the command line tool is very flexible. A variant is not necessary. All necessary data can be handed over in an XML file.The XML files can be created either via a text editor or with any programming language. Numerous programming languages offer frameworks for processing XML files. The XML schema file supplied (file 'Sc4SAPCmd.xsd' in the folder 'xml') can support this - depending on the development environment and programming language. There are also several examples in the 'xml' folder. 


The command line tool can therefore be used very flexibly for almost all functions in "Shortcut for SAP systems", for example, for a self-service to unlock the own user, to execute role assignments e.g. within an approval workflow and many more. Multiple functions resp. tasks can be put into a single file, as part of an "ExecutionChain".  


Find here a simple example for an XML file for unlocking a user, stored as "H:\UserSelfService\UnlockUser_309823590.xml":


<ExecutionChain>

   <ID>309823590</ID>

   <Comment>Unlocking SAP user, generated by ChatBot system in chat #309823590</Comment>

   <Task>

       <UnlockUser StopOnError="false">

           <Connection>PX1/100, User Self service</Connection>

           <Users>mbrink</Users>

           <RemoveValidityRange>true</RemoveValidityRange>

       </UnlockUser>

   </Task>

</ExecutionChain>


Calling the command line tool with this file would be done as following:

sc4sapcmd.exe "H:\UserSelfService\UnlockUser_309823590.xml"


And this would be the output of the command line tool:


This is Sc4SAP command line tool version 1.2.1

----------------------------------------------

Started with parameters: [1] H:\UserSelfService\UnlockUser_PX1100_mbrink.xml

Now processing XML file...

Found XML data for Task [UnlockUser]

Now task #1 [Unlock user]...

  User: MBRINK  and remove a possibly given validity range.

Connection to destination PX1/100, User Self service_sappx1.shortcut.com_0_100_SYS_BC_01_EN established.

User MBRINK unlocked and validity range removed.

Done for 1 user(s). 1 user(s) unlocked. For 1 user(s) the validity range was removed.

----------------------------------------------

Sc4SAP command line tool finished without errors.


Find more information on https://www.shortcut-it.com/sc4sapcmd.html.