This is a test message to test the length of the message box.
Login
ABAP Cloud Jobs
Created by Software-Heroes

ABAP Cloud - Jobs

2583

What do jobs actually look like in ABAP Cloud and how are they created and used in the new world? You can find out more about this in this article.



Almost every user in SAP should know about batch jobs or have at least used one. They are important for the night and distribute the workload in the system over the night times. In this article we will take a look at the changes in the area of jobs and what effects ABAP Cloud has on them.

 

Introduction

Jobs are a central part of the ABAP system because they transfer the burden of processing to the night and take on various tasks without user intervention. Whether it is building statistics, processing new data or simply cleaning the system. The concept of jobs has been in the system for ages and until now it had always worked the same way. With ABAP Cloud, this concept is thrown out of the window and enriched with something new.

 

Classic ABAP

In ABAP, jobs were based primarily on reports; using transaction SM36, new jobs could be created and scheduled in the system or the functionality could be executed directly via the relevant report. Using transaction SM37, you could evaluate the job runs, look at the logs or check the output. The basic functionality was made available via the GUI and everyone could view their jobs individually.

 

Application Job

The successor to the classic batch jobs is now the application job. This is no longer based on a report, since reports are not ABAP Cloud, but on classes. These classes are called for processing by the application job and represent the actual logic.

 

You can find the various articles on the topic here:

 

Comparison

Let's now compare the two techniques and compare them with each other to get a better overview of the functions.

 

Scheduling (User)

In the classic world, scheduling by the user takes place via transaction SM36 or the report itself. It is possible to create a recurring job that then runs regularly in the system.

 

In ABAP Cloud, you use the Fiori app "Application Jobs" (F1240) to create a new job or set up a recurring pattern.

 

User input

What does it look like in the area of user input? In classic ABAP, the user can set a variant from outside or enter variables to influence processing.

 

There are parameters for this in ABAP Cloud; these are queried when scheduling the job in step 3 of the “Application Jobs” app.

 

Job with steps

There is also the option of defining a job with several steps, for example if you want to run several reports in a certain order or you want to start the same report with different boundaries.

 

In ABAP Cloud there is the option to create additional templates using the “Application Job Templates” app (F2058). You can create templates that contain several steps and then later use the template for scheduling in the “Application Jobs” app.

 

Scheduling (API)

In the classic ABAP system, various function modules (JOB_*) are available to schedule jobs automatically or from processing in the system.

CALL FUNCTION 'JOB_OPEN'
  EXPORTING
    jobname          = ld_jobname
  IMPORTING
    jobcount         = ld_jobcount
  EXCEPTIONS
    cant_create_job  = 1
    invalid_job_data = 2
    jobname_missing  = 3
    OTHERS           = 4.

SUBMIT rs_aucv_runner
  USING SELECTION-SET 'TEST'
  USER sy-uname
  VIA JOB ld_jobname NUMBER ld_jobcount
  AND RETURN.

CALL FUNCTION 'JOB_CLOSE'
  EXPORTING
    jobcount             = ld_jobcount
    jobname              = ld_jobname
    strtimmed            = abap_true
  EXCEPTIONS
    cant_start_immediate = 1
    invalid_startdate    = 2
    jobname_missing      = 3
    job_close_failed     = 4
    job_nosteps          = 5
    job_notex            = 6
    lock_failed          = 7
    OTHERS               = 8.

 

ABAP Cloud provides an internal ABAP API (CL_APJ_RT_API), but also an external OData API (BC_EXT_APPJOB_MANAGEMENT) to plan jobs in the system. Further details about the APIs can be found in the articles linked above.

DATA(ls_start) = VALUE cl_apj_rt_api=>ty_start_info( start_immediately = abap_true ).

cl_apj_rt_api=>schedule_job( EXPORTING iv_job_template_name   = 'ZBS_DEMO_JOB_ADT_TEMPLATE'
                                       iv_job_text            = 'Single run from Code (Immediately)'
                                       is_start_info          = ls_start
                                       it_job_parameter_value = mt_parameter
                             IMPORTING ev_jobname             = DATA(ld_jobname)
                                       ev_jobcount            = DATA(ld_jobcount) ).

 

Analysis

Outputs in the batch job take place in the job log, and generated messages (via MESSAGE) are attached to the job. On the other hand, all WRITE outputs are transferred to the spool. In this way, different types of protocols and outputs can be generated, which can later be exported or printed.

 

In ABAP Cloud, several application logs can be attached to a job in order to pass all messages to the user. Spool output is no longer available out-of-the-box and must be implemented manually as a form or email (examples).

 

Hint: Depending on the status of your system, more or fewer functions of the application jobs will be available in the ABAP cloud environment. From S/4 HANA 2022, most of the functionalities will be available.

 

Difference

However, there may be a difference on your system. If you are not yet using the Business Partner, i.e. you are using the classic SU01 user, then the authorization will be assigned via the classic PFCG role. This means that no business catalogs are necessary and cannot be used. However, the future is the concept of the business partner in the system (employee/business user).

 

Conclusion

The concept of jobs changes most comprehensively with ABAP Cloud, but allows a clear distinction between job and application for the user and no longer mixes the two concepts. There are a few things you should keep in mind when creating jobs, but above all you should rely on robust development, otherwise it will be quite difficult to find errors.


Included topics:
ABAP CloudABAPApplication JobJob
Comments (7)



And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.


ABAP Cloud - Clean Core (Scenarios)

Category - ABAP

In this article, let's take another look at the Clean Core architecture with ABAP Cloud, where it is used and where you can build your applications.

01/10/2025

ABAP Cloud - Programming Model

Category - ABAP

Which programming model is used with ABAP Cloud and what can we learn from its predecessor? More details in the article.

01/03/2025

ABAP Cloud - ADT Trees (Overview)

Category - ABAP

What help and overviews are available in the ABAP Development Tools to simplify your life with ABAP Cloud?

12/17/2024

ABAP Cloud - Relevant Objects

Category - ABAP

Which objects are still relevant in ABAP development and which ones can you slowly put away? Find out more here.

11/19/2024

ABAP Cloud - Locks

Category - ABAP

What do you need to set locks for and how can you easily do that in ABAP Cloud? In this article we will look at the process in detail.

11/08/2024