EasyCloud SAP Job Cmdlets

Set-CmSAPJob

Create a new SAP background job with one Step.

Example:

————–  Create a job.  ————–

PS C:\> $con = Get-CmSapConnect -UserName clebzien -Password  ****** -Language en -Client 100 -Host ERP -SystemNumber 0

$step = ,(“INITXBP2”, “”)

Set-CmSAPJob -JOBNAME TEST -Job_Steps $step -CmSapConnect $con

Creates a job with one step running an ABAP program.

Remove-CmSAPJob

Removes a background job.

Example:

————–  Delete a job.  ————–

PS C:\> $con = Get-CmSapConnect -UserName clebzien -Password  ****** -Language en -Client 100 -Host ERP -SystemNumber 0

Remove-CmSapJob -JobName SAP_CCMS_CENSYS_DISPATCHER -JobCount 23455200 -CmSapConnect $con

Delete a specific SAP background job by its ID and name.

Copy-CmSAPJob

Copy a single or a list of  SAP background jobs.

With this CmdLet you can copy a job definition including all definition data, except for the start conditions. The copy has the status ‘scheduled’. A name can be specified for the target with the parameter target_jobname. If no name is specified, the target job has the same name as the source job.

Examples:

————–  Copy a single job.  ————–

PS C:\> $con = Get-CmSapConnect -UserName clebzien -Password  ****** -Language en -Client 100 -Host ERP -SystemNumber 0

Copy-CmSAPJob -JobName SAP_CCMS_CENSYS_DISPATCHER -JobCount 23455200 $con

This example copies the SAP background job 23455200 to the same SAP Instance. The new job will be named by the name of the source job.

 

————–  Copy a list of jobs.  ————–

PS C:\> $con = Get-CmSapConnect -UserName clebzien -Password  ****** -Language en -Client 100 -Host ERP -SystemNumber 0

$sel = Select-CmSAPJob -JobOwner * -Finished $false -Running $false -Ready $false -Schedule $false –CmSapConnect $con

Copy-CmSAPJob -JobTable $sel -CmSapConnect $con

This example gets a list of all aborted jobs of all user at the current date. The jobs on the list will be copied to the same SAP Instance then. The new jobs will be named by the name of the source jobs.

Select-CmSAPJob

Select a set of jobs in the SAP R/3 system that match the selection criteria given. By default the username  is set to the SAP log on name and the job name is partly specified using wildcards (*). Further more the date to start from is set to the current date by default and all job selection criteria (scheduled, released, ready, active, finished, canceled) except released are chosen.

Examples:

————–  Get your today canceled jobs.  ————–

PS C:\> $con = Get-CmSapConnect -UserName clebzien -Password  ****** -Language en -Client 100 -Host ERP -SystemNumber 0

Select-CmSAPJob -Finished $false -Running $false -Ready $false -Schedul $false -CmSapConnect $con

This example gets a list of all aborted jobs of the log on user at the current date.

————–  Get your today canceled jobs by date.  ————–

PS C:\> $con = Get-CmSapConnect -UserName clebzien -Password  ****** -Language en -Client 100 -Host ERP -SystemNumber 0

Select-CmSAPJob -Finished $false -Running $false -Ready $false -Schedul $false -From_Date 20120520 -To_Date 20120522 -CmSapConnect $con

This example gets a list of all aborted jobs of the log on user at the date between 2012/05/20 ands 2012/05/22.

Start-CmSAPJob

Start a job immediately.

Example:

————–  Start a job immediately.  ————–

PS C:\> $con = Get-CmSapConnect -UserName clebzien -Password  ****** -Language en -Client 100 -Host ERP -SystemNumber 0

Start-CmSapJob -StartJobImmediately $true -JobCount 12290500 -JobName SAP_SLD_DATA_COLLECT -CmSapConnect $con -Target_Server ERP_EC1_00

This starts the job immediately on the given target server.