In SAP system, you have an external BAPI that can be called to manage SAP jobs, check this FM: "BAPI_XBP_JOB".
You can use BAPI_XBP_JOB* function modules to create/schedule a job to run the query. For more details, you can refer below link −
There are various FM’s that can be used to start or stop a job immediately:
And many more.