Using an Event Raised in SAP to Execute a JAMS PowerShell cmdlet

Follow

A Step can be defined within an SAP ABAP Process, to execute a JAMS PowerShell cmdlet from SAP. This can be useful for specific cases, where a Job must be Triggered to run within JAMS, after an Event has occurred in SAP.

When creating a Step in an ABAP Program Workflow, choose External Program from within SM36.

The External Program section defines the command needed to execute the external process.  

For example, to Submit a JAMS Job, the following should be used:

Name: POWERSHELL.EXE

Parameter: -Command "& {invoke-command -computer NB0011507 -script {import-module JAMS; Submit-JAMSEntry \JAMSFolderName\JobName -server localhost}}"

Be sure to give the SAP User permissions to run the PowerShell script on the machine as well.  

If the User running the script happens to be unknown, a command can be run to determine which User is running the command.

Change the External Program Parameter section to the following and re-run the program:

-Command "& {$env:userdomain; $env:username}"

The output of this command will give the Username and Domain that is running the process. This User should then be given access to the Remote Management Users group on the SAP host.

The output will look similar to the following:

Have more questions? Submit a request

Comments